#ifndef __GT_CORE_ERROR_H__
#define __GT_CORE_ERROR_H__
#include <map>
#include <string>

class GtError
{
    public:
        static const int ERROR_TIMEOUT = -10000;
        static const int ERROR_SELECT = -10002;
        static const int ERROR_READ_FAILED = -10003;
        static const int ERROR_WRITE_FAILED = -10004;
        static const int ERROR_CLOSED = -10005;
        static const int ERROR_CREATE_SOCKET = -10006;
        static const int ERROR_SET_SOCKET = -10007;
        static const int ERROR_BIND_SOCKET = -10008;
        static const int ERROR_LISTEN_SOCKET = -10009;
        static const int ERROR_CONNECT_SOCKET = -10010;
        static const int ERROR_ACCEPT_SOCKET = -10011;
        static const int ERROR_DIR_NOT_EXIST = -10012;
        static const int ERROR_DIR_GET_CURRENT = -10013;
        static const int ERROR_DIR_CREATE = -10014;
        static const int ERROR_FILE_NOT_EXIST = -10015;
        static const int ERROR_FILE_OPEN = -10016;
        static const int ERROR_FILE_WRITE = -10017;
        static const int ERROR_FILE_READ = -10018;
        static const int ERROR_DL_OPEN = -10019;
        static const int ERROR_DL_SYM = -10020;
        static const int ERROR_DL_INVOKE = -10021;
        static const int ERROR_INVALID_FUNC_PARAM = -10022;
        static const int ERROR_INVALID_VALUE = -10023;
        static const int ERROR_PARSE_FAILED = -10024;
        static const int ERROR_OVERFLOW = -10025;
        static const int ERROR_FORMAT = -10026;
        static const int ERROR_SEM_OP = -10027;

        static const int ERROR_OTHER = -20000;
        static const int ERROR_MEM_LOCK_FAILED = -20001;
        static const int ERROR_MEM_UNLOCK_FAILED = -20002;
        static const int ERROR_FILE_SERVER_NOT_CONNECT = -20003;
        static const int ERROR_INVALID_FILE_MD5 = -20004;
        static const int ERROR_GENERATE_ENCRYPT_KEY = -20005;
        static const int ERROR_WRITE_LAST_TICKET = -20006;
        static const int ERROR_READ_LAST_TICKET = -20007;
        static const int ERROR_CLEAR_LAST_TICKET = -20008;

        static void localErrorString(int errCode, char *errStr);

    private:
        static std::map<int, std::string> _errorString;
        static bool _errorIsInit;
        static void init();
};

#endif
