-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathapi.h
171 lines (134 loc) · 3.14 KB
/
api.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
/*
* api.h
*
* Created on: 2013-4-9
* Author: zsg
*/
#ifndef API_H_
#define API_H_
/*
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include<unistd.h>
#include<sys/types.h>
#include<sys/stat.h>
#include<fcntl.h>
#include <locale.h>
#include <stddef.h>
#include <string.h>
#include <signal.h>
#include <time.h>
#include <stdarg.h>
#include<sys/stat.h>
#include <errno.h>
#include <pthread.h>
#include <syslog.h>
#include <semaphore.h>
#include <sys/socket.h>
#include <netdb.h>
//#include <my_global.h>
//#include <mysql.h>
*/
#include <list>
#include <map>
#include <vector>
#include <string>
using namespace std;
#include "g_api.h"
//ĬÈÏ Î³¶ÈŽÓ17.00 µœ 53.00; Ÿ«¶È0.01 ;ÿžöŸ¶È¶È¶Œ¶ÔÓŠ3600Ìõγ¶ÈŒÇÂŒ¡£
//ĬÈÏ Ÿ¶ÈŽÓ72.00 µœ 137.99£»Ÿ¶È0.01£»Ã¿žöγ¶È¶ÔÓŠ6600ÌõŸ¶ÈŒÇÂŒ¡£
//select lat,count(lng) from baidumaps group by lat;
#ifdef USE_ARRAY
typedef struct
{
double dx;
double dy;
}CPOI;
#else
class CPOI
{
public:
double dx;
double dy;
};
#endif
typedef std::map<unsigned int,CPOI*> LNGMAP;
class CClient;
class CXArray;
#include "CClient.h"
//Öն˶ÓÁÐ socket is key
typedef std::map<int, CClient*> CLIENT_MAP;
//ŸÀÆ«ÐÅÏ¢Áбí γ¶È is key
#ifdef USE_ARRAY
typedef std::map<unsigned int,CXArray*> INFO_MAP;
#else
typedef std::map<unsigned int,CLNGMAP*> INFO_MAP;
#endif
//
typedef vector< HANDLE > HL; //Ï̟߳ä±úŒ¯ºÏ
typedef HL::iterator HLI; //Ï̟߳ä±úÖžÕë
//
////
class CAutoLock
{
public:
CAutoLock(pthread_mutex_t *pmutex):m_pmutex(pmutex)
{
if(0!=pthread_mutex_lock(m_pmutex))
{
}
}
~CAutoLock(){
if(0!=pthread_mutex_unlock(m_pmutex))
{
}
}
private:
pthread_mutex_t * m_pmutex;
};
//
/////////////////////////////////////////
///ÈÕÆÚ¡¢Ê±ŒäÊýŸÝÀàÐÍ
typedef struct
{
BYTE year; ///Äê
BYTE month; ///ÔÂ
BYTE day; ///ÈÕ
BYTE hour; ///ʱ
BYTE min; ///·Ö
BYTE sec; ///Ãë
}GC_Time_Struct;
extern void LogExt(int loglevel,const char* lpszFormat,...);
///////////
char *getYYYYMMDD(char *nowdate);
void stopFrommyInter();
void setallthreadexitflag(int index);
//void exceptiontolog (CSeException *e);
extern bool volatile allExitFlag;
#ifdef _DEBUG
#ifdef WIN
#define DEBUGOUT OutputDebugString
#else
#define DEBUGOUT FLOG_MSG
#endif
#else
#define DEBUGOUT
#endif
#include "Ccfg.h"
extern Ccfg g_cfg;
//
struct tcp_keepalive_in
{
ULONG onoff;
ULONG keepalivetime;
ULONG keepaliveinterval;
};
#ifndef SIO_KEEPALIVE_VALS
#define SIO_KEEPALIVE_VALS _WSAIOW(IOC_VENDOR, 4)
#endif
int writelogimmediatly(const char *msg);
unsigned int getAccuracy01(double x); //°ŽŸ«¶È0.01È¡Öµ(*100È¡Õû) //²»×ŒÈ·
unsigned int chang2uint(const char*str);////°ŽŸ«¶È0.01È¡Öµ(*100È¡Õû)
///////////////////////
#endif /* API_H_ */