| 1 |
#pragma once |
| 2 |
|
| 3 |
#define WCS_PLUGIN_TYPE_GRAPHICS 1 |
| 4 |
#define WCS_PLUGIN_TYPE_CONSOLE 2 |
| 5 |
|
| 6 |
#define WCS_BUILD_TYPE_RELEASE 1 |
| 7 |
#define WCS_BUILD_TYPE_DEBUG 2 |
| 8 |
|
| 9 |
////////////////////////////////////////////////////////////////////////// |
| 10 |
|
| 11 |
typedef struct _BM_DATA |
| 12 |
{ |
| 13 |
WORD wNodeID; |
| 14 |
DWORD dwAddress; |
| 15 |
DWORD dwProcessors; |
| 16 |
DWORD dwIterations; |
| 17 |
double dbRlt1; |
| 18 |
double dbRlt2; |
| 19 |
double dbRlt3; |
| 20 |
double dbRlt4; |
| 21 |
double dbRltAvg; |
| 22 |
double dbRuntime; |
| 23 |
BOOL fSet; |
| 24 |
} |
| 25 |
BM_DATA, *LPBM_DATA; |
| 26 |
|
| 27 |
typedef struct _NODE_DATA |
| 28 |
{ |
| 29 |
DWORD dwAddress; |
| 30 |
WORD wPort; |
| 31 |
WORD wNodeID; |
| 32 |
WORD wNodeType; |
| 33 |
WORD wNodeState; |
| 34 |
DWORD dwProcessors; |
| 35 |
BM_DATA bm; |
| 36 |
} |
| 37 |
NODE_DATA, *LPNODE_DATA; |
| 38 |
|
| 39 |
typedef struct _PLUGIN_INFO |
| 40 |
{ |
| 41 |
WORD wPluginID; |
| 42 |
WORD wType; |
| 43 |
WORD wVersion; |
| 44 |
UINT nBuildType; |
| 45 |
DWORD dwTimeout; |
| 46 |
TCHAR szText[512]; |
| 47 |
} |
| 48 |
PLUGIN_INFO, *LPPLUGIN_INFO; |
| 49 |
|
| 50 |
typedef struct _MASTER_SETTING |
| 51 |
{ |
| 52 |
BOOL fInternet; |
| 53 |
BOOL fRtRendering; |
| 54 |
BOOL fLogPlugin; |
| 55 |
UINT nConnections; |
| 56 |
UINT nProcessors; |
| 57 |
UINT nRecvCount; |
| 58 |
UINT nTotalCount; |
| 59 |
} |
| 60 |
MASTER_SETTING, *LPMASTER_SETTING; |
| 61 |
|
| 62 |
typedef struct _SLAVE_SETTING |
| 63 |
{ |
| 64 |
BOOL fAutoDownload; |
| 65 |
UINT nProcessors; |
| 66 |
} |
| 67 |
SLAVE_SETTING, *LPSLAVE_SETTING; |
| 68 |
|
| 69 |
typedef struct _CALCREPORT |
| 70 |
{ |
| 71 |
WORD wNodeID; |
| 72 |
WORD wSubID; |
| 73 |
DWORD dwAddress; |
| 74 |
double dbRuntime; |
| 75 |
} |
| 76 |
CALCREPORT, *LPCALCREPORT; |
| 77 |
|
| 78 |
typedef struct _CALCSIZE |
| 79 |
{ |
| 80 |
UINT nWidth; |
| 81 |
UINT nHeight; |
| 82 |
UINT nRange; |
| 83 |
} |
| 84 |
CALCSIZE, *LPCALCSIZE; |
| 85 |
|
| 86 |
typedef struct _NODEINIT |
| 87 |
{ |
| 88 |
int nIndex; |
| 89 |
int nYInit; |
| 90 |
int nStep; |
| 91 |
int nRange; |
| 92 |
WORD wNodeID; |
| 93 |
WORD wSubID; |
| 94 |
BOOL fEnd; |
| 95 |
DWORD dwAddress; |
| 96 |
double dbRuntime; |
| 97 |
} |
| 98 |
NODEINIT, *LPNODEINIT; |
| 99 |
|
| 100 |
////////////////////////////////////////////////////////////////////////// |
| 101 |
|
| 102 |
typedef unsigned (__stdcall *PTHREAD_START)(void *); // Thread |
| 103 |
|
| 104 |
typedef CArray<NODE_DATA> NodeDataList; |
| 105 |
typedef CArray<HANDLE> HandleList; |
| 106 |
typedef CArray<DWORD> DWORDList; |
| 107 |
typedef CArray<CALCREPORT> CalcReportList; |
| 108 |
typedef CArray<NODEINIT> NodeInitList; |
| 109 |
|
| 110 |
typedef struct _MASTER_PLUGIN |
| 111 |
{ |
| 112 |
WORD wNodeID; |
| 113 |
DWORD dwAddress; |
| 114 |
DWORD dwProcessors; |
| 115 |
BOOL bSystem; |
| 116 |
BOOL bFront; |
| 117 |
UINT nPluginType; |
| 118 |
CString csWndName; |
| 119 |
NodeDataList list; |
| 120 |
} |
| 121 |
MASTER_PLUGIN, *LPMASTER_PLUGIN; |
| 122 |
|
| 123 |
typedef struct _SLAVE_PLUGIN |
| 124 |
{ |
| 125 |
WORD wNodeID; |
| 126 |
DWORD dwProcessors; |
| 127 |
double dbRuntime; |
| 128 |
} |
| 129 |
SLAVE_PLUGIN, *LPSLAVE_PLUGIN; |
| 130 |
|
| 131 |
////////////////////////////////////////////////////////////////////////// |
| 132 |
|
| 133 |
typedef CInterlockedType<HANDLE> ATM_HANDLE; |
| 134 |
typedef CInterlockedScalar<WORD> ATM_WORD; |
| 135 |
typedef CInterlockedScalar<DWORD> ATM_DWORD; |
| 136 |
typedef CInterlockedScalar<double> ATM_DOUBLE; |
| 137 |
|
| 138 |
////////////////////////////////////////////////////////////////////////// |
| 139 |
|
| 140 |
#define MC_MINSIZE(x, y) \ |
| 141 |
(sizeof(x) < sizeof(y)) ? sizeof(x) : sizeof(y) |
| 142 |
|
| 143 |
#define MC_BEGINTHREADEX(psa, cbStack, pfnStartAddr, \ |
| 144 |
pvParam, fdwCreate, pdwThreadId) \ |
| 145 |
((HANDLE)_beginthreadex( \ |
| 146 |
(void *) (psa), \ |
| 147 |
(unsigned) (cbStack), \ |
| 148 |
(PTHREAD_START) (pfnStartAddr), \ |
| 149 |
(void *) (pvParam), \ |
| 150 |
(unsigned) (fdwCreate), \ |
| 151 |
(unsigned *) (pdwThreadId))) |
| 152 |
|
| 153 |
////////////////////////////////////////////////////////////////////////// |