CCOSLogicDeviceStructure.h 35 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633
  1. #pragma once
  2. #include <stdlib.h>
  3. #include "Detector_Model_Def.h"
  4. #include "Generator_Model_Def.h"
  5. #include "ResDataObject.h"
  6. #define Gen_DEFAULT_PARAM_ZERO 0.0f
  7. #define Gen_DEFAULT_APPMODE APP_DR
  8. #define Gen_DEFAULT_EXAMMODE EXM_SINGLE
  9. #define Gen_DEFAULT_PARAM_KV 0.0f
  10. #define Gen_DEFAULT_PARAM_MAS 0.0f
  11. #define Gen_DEFAULT_PARAM_MA 0.0f
  12. #define Gen_DEFAULT_PARAM_MS 0.0f
  13. #define Gen_DEFAULT_PARAM_FOCUS -1
  14. #define Gen_DEFAULT_PARAM_WORKSTATION -1
  15. #define Gen_DEFAULT_PARAM_TECHMODE -1
  16. #define Gen_DEFAULT_PARAM_AECDENSITY 0.0f
  17. #define Gen_DEFAULT_PARAM_AECFIELD -1
  18. #define Gen_DEFAULT_PARAM_AECFILM -1
  19. #define Gen_DEFAULT_PARAM_POSTMS 0.0f
  20. #define Gen_DEFAULT_PARAM_POSTMAS 0.0f
  21. #define MAX_STRING 1024
  22. typedef enum _Application_Mode {
  23. APP_DR,
  24. APP_DX,
  25. APP_US,
  26. APP_MODE_MAX
  27. }APP_MODE;
  28. #define APPMODEDX ("DX")
  29. #define APPMODERF ("RF")
  30. //mamo
  31. #define APPMODEMG ("MG")
  32. typedef enum _Exam_Mode {
  33. EXM_ERROR = -1,
  34. EXM_SINGLE = 0,
  35. EXM_DUALENERGY,
  36. EXM_STITCH,
  37. EXM_AEC,
  38. EXM_HDR,
  39. EXM_GAIN,
  40. EXM_OFFSET,
  41. EXM_TOMO,
  42. EXM_MAMO_MANUAL,
  43. EXM_MAMO_SEMIAUTO,
  44. EXM_MAMO_AUTOMATIC,
  45. EXM_MAMO_AUTOFILTER,
  46. EXM_MAMO_TOMOSEMIAUTO,
  47. EXM_MAMO_TOMOAUTOMATIC,
  48. EXM_MODE_MAX
  49. }EXAM_MODE;
  50. #define EXAMMODE_SINGLE ("Single")
  51. #define EXAMMODE_STITCH ("Stitch")
  52. #define EXAMMODE_PF ("PulseSerial")
  53. #define EXAMMODE_CF ("CoutineSerial")
  54. #define EXAMMODE_TOMO ("TOMO")
  55. #define EXAMMODE_MAMO_MANUAL ("MANUAL")
  56. #define EXAMMODE_MAMO_SEMIAUTO ("SEMIAUTO")
  57. #define EXAMMODE_MAMO_AUTOMATIC ("AUTOMATIC")
  58. #define EXAMMODE_MAMO_AUTOFILTER ("AUTOFILTER")
  59. #define EXAMMODE_MAMO_TOMOSEMIAUTO ("TOMO_SEMIAUTO")
  60. #define EXAMMODE_MAMO_TOMOAUTOMATIC ("TOMO_AUTOMATIC")
  61. typedef enum _Ultral_Sound_Exam_Mode {
  62. EXM_BRIGHTNESS,
  63. EXM_COLOR_DOPPLER_FLOW,
  64. EXM_POWER_DOPPLER,
  65. EXM_DIRECTIONAL_POWER_DOPPLER,
  66. EXM_PULSE_WAVE,
  67. EXM_CONTINOUS_WAVE
  68. }US_EXAM_MODE;
  69. typedef enum _Result_SM {
  70. RESM_INVALID = -3,
  71. RESM_NOSUPPORT = -2,
  72. RESM_TIMEOUT = -1,
  73. RESM_FAILED = 0,
  74. RESM_SUCCEED,
  75. RESM_WARNING
  76. }RES_SM;
  77. typedef enum Image_Type {
  78. IMAGE_TYPE_2D,
  79. IMAGE_TYPE_3D,
  80. IMAGE_TYPE_1D
  81. }IMAGE_TYPE;
  82. typedef enum WorkStation_Type {
  83. WS_TABLE,
  84. WS_WALL,
  85. WS_CONVENTIONAL,
  86. WS_FREE,
  87. WS_TOMO,
  88. WS_TABLE_WALL,
  89. }WORKSTATION_TYPE;
  90. typedef enum Techmode_Type {
  91. TECHMODE_NOAEC_3P,
  92. TECHMODE_NOAEC_2P,
  93. TECHMODE_AEC_3P,
  94. TECHMODE_AEC_2P,
  95. TECHMODE_AEC_1P
  96. }TECHMODE_TYPE;
  97. typedef enum Focus_Type {
  98. FOCUS_SMALL,
  99. FOCUS_LARGE,
  100. FOCUS_AUTOMATIC
  101. }FOCUS_TYPE;
  102. typedef enum AECField_Type {
  103. FIELD_RIGHT = 1,
  104. FIELD_CENTER,
  105. FIELD_RIGHT_CENTER,
  106. FIELD_LEFT,
  107. FIELD_LEFT_RIGHT,
  108. FIELD_CENTER_LEFT,
  109. FIELD_LEFT_CENTER_RIGHT
  110. }AECFIELD_TYPE;
  111. typedef enum AECFilm_Type {
  112. FILM_SLOW,
  113. FILM_MEDIUM,
  114. FILM_FAST
  115. }AECFILM_TYPE;
  116. typedef enum _Gen_Param {
  117. Gen_APPMODE,
  118. Gen_EXAMMODE,
  119. Gen_Param_KV,
  120. Gen_Param_MAS,
  121. Gen_Param_MA,
  122. Gen_Param_MS,
  123. Gen_Param_FOCUS,
  124. Gen_Param_WORKSTATION,
  125. Gen_Param_TECHMODE,
  126. Gen_Param_AECDENSITY,
  127. Gen_Param_AECFIELD,
  128. Gen_Param_AECFILM,
  129. Gen_Param_POSTKV,
  130. Gen_Param_POSTMA,
  131. Gen_Param_POSTMS,
  132. Gen_Param_POSTMAS,
  133. Gen_Param_REPLAYWALLKV,
  134. Gen_Param_REPLAYWALLMA,
  135. Gen_Param_REPLAYWALLMS,
  136. Gen_Param_REPLAYTABLEKV,
  137. Gen_Param_REPLAYTABLEMA,
  138. Gen_Param_REPLAYTABLEMS,
  139. Gen_Param_APR,
  140. Gen_RESET,
  141. Gen_EXPOSURESTATUS,
  142. Gen_IMAGESTATUS,
  143. Gen_Param_CUREXPOSURESTEP,
  144. Gen_Param_TOTALEXPOSURESTEP,
  145. Gen_Param_CURMECHSIZE,
  146. Gen_Param_TOTALMECHSIZE,
  147. Gen_Param_STEPMECHSIZE,
  148. Gen_Param_EXPOSEDDOSE,
  149. Gen_Param_FLKV,
  150. Gen_Param_FLMA,
  151. Gen_Param_ABS,
  152. Gen_Param_EXO,
  153. Gen_Param_HE,
  154. Gen_Param_DAP,
  155. Gen_Param_PositionCode
  156. }GEN_PARAM;
  157. typedef enum _Dap_Param {
  158. Dap_Param_KV,
  159. Dap_Param_MA,
  160. Dap_Param_MS,
  161. Dap_Param_MAS,
  162. Dap_Param_PostMS,
  163. Dap_Param_PostMAS,
  164. Dap_Param_DAP,
  165. Dap_Param_DapRate,
  166. Dap_Param_MAX
  167. }DAP_PARAM;
  168. typedef enum _Gen_Exposure_Status {
  169. Gen_Infomation = 0,
  170. Gen_Warning,
  171. Gen_Error,
  172. Gen_PerHandSwitchPress, //First HandSwitch press
  173. Gen_SecondHandSwitchPress, //Second HandSwitch press
  174. Gen_Ready,
  175. Gen_XayOn,
  176. Gen_XayOff,
  177. Gen_SecondHandSwitchRelease, //Second HandSwitch press
  178. Gen_PerHandSwitchRelease, //First HandSwitch Release
  179. Gen_ExpDisEnable, //Device No Ready
  180. Gen_ExpEnable //Device Ready
  181. }GEN_EXPOSURE_STATUS;
  182. typedef enum US_Image_View_Type
  183. {
  184. IMAGE_B = 0,
  185. IMAGE_CDF,
  186. IMAGE_M
  187. }US_IMAGE_VIEW_TYPE;
  188. typedef enum _SM_Status
  189. {
  190. SM_SeqPrep = 0,
  191. SM_SeqReady,
  192. SM_FramePrep,
  193. SM_FrameReady,
  194. SM_FrameStart,
  195. SM_FrameIn,
  196. SM_FramePost,
  197. SM_FrameEnd,
  198. SM_FrameError,
  199. SM_SeqPost
  200. }SM_STATUS;
  201. typedef enum Calibration_Type
  202. {
  203. CAL_TYPE_NONE = 0,
  204. CAL_TYPE_OFFSET,
  205. CAL_TYPE_GAIN,
  206. CAL_TYPE_DEFECT
  207. }CAL_TYPE;
  208. typedef enum Calibration_Status
  209. {
  210. CAL_STATUS_NOTSTART = 0,
  211. CAL_STATUS_START,
  212. CAL_STATUS_COMPLETE
  213. }CAL_STATUS;
  214. typedef enum Offset_Type
  215. {
  216. OFT_NONE= 0,
  217. OFT_OOOEO, //AAAAAAAAAAA(A) + Exp + B
  218. OFT_O_PERIOD_E,//A__ + A__ + A__ + Exp//采集界面有offset超时
  219. OFT_OOO_PERIOD_E,//AAAAAAAA ____Exp1__Exp2__Exp3______AAAAAAAA//采集界面有offset超时
  220. OFT_PANEL
  221. }OFFSET_TYPE;
  222. /*
  223. typedef enum ECOM_FPD_State
  224. {
  225. ECOM_FPD_STATE_NOT_INI = 0,
  226. ECOM_FPD_STATE_ERR,
  227. ECOM_FPD_STATE_STANDBY,
  228. ECOM_FPD_STATE_PREPARE,
  229. ECOM_FPD_STATE_READY,
  230. ECOM_FPD_STATE_SLEEP,
  231. ECOM_FPD_STATE_SHUTDOWN,
  232. ECOM_FPD_STATE_EXIT
  233. }ECOM_FPD_STATE;*/
  234. typedef enum ECOM_GRID_State
  235. {
  236. ECOM_GRID_ABSENT = 0,
  237. ECOM_GRID_PRESENT,
  238. ECOM_GRID_120,
  239. ECOM_GRID_180,
  240. ECOM_GRID_UNKNOWN,
  241. ECOM_GRID_120_ROTATE,
  242. ECOM_GRID_PARALLEL,
  243. ECOM_GRID_100,
  244. ECOM_GRID_150,
  245. ECOM_GRID_PARTINSERT,
  246. ECOM_GRID_STATE_MAX
  247. }ECOM_GRID_STATE;
  248. typedef enum ECOM_Templerature_state
  249. {
  250. ECOM_TEM_STATE_TOO_LOW = 0,
  251. ECOM_TEM_STATE_LOW,
  252. ECOM_TEM_STAE_NORMAL,
  253. ECOM_TEM_STATE_HIGH,
  254. ECOM_TEM_STATE_TOO_HIGH
  255. }ECOM_TEMPERATURE_STATE;
  256. typedef enum ECOM_Battery_state
  257. {
  258. ECOM_BAT_STATE_TOO_LOW = 0,
  259. ECOM_BAT_STATE_LOW,
  260. ECOM_BAT_STAE_NORMAL,
  261. ECOM_BAT_STATE_GOOD,
  262. ECOM_BAT_STATE_FULL
  263. }ECOM_BATTERY_STATE;
  264. typedef enum ECOM_Wifi_state
  265. {
  266. ECOM_WIFI_STATE_TOO_LOW = 0,
  267. ECOM_WIFI_STATE_LOW,
  268. ECOM_WIFI_STAE_NORMAL,
  269. ECOM_WIFI_STATE_GOOD,
  270. ECOM_WIFI_STATE_FULL
  271. }ECOM_WIFI_STATE;
  272. typedef enum ECOM_Wifi_UNIT_TYPE
  273. {
  274. ECOM_WIFI_UNIT_PERCENTAGE= 0,
  275. ECOM_WIFI_UNIT_DBM
  276. }ECOM_WIFI_UNIT_TYPE;
  277. typedef enum ECOM_Battery_Charg_State
  278. {
  279. BATTERY_CHARG = 0,
  280. BATTERY_DISCHARG,
  281. BATTERY_CHARG_AND_DISCHARG
  282. }ECOM_BATTERY_CHARG_STATE;
  283. typedef struct _Xray_Cal_Attr_Struct
  284. {
  285. bool bExpired;
  286. bool bShowImage;
  287. bool bECOMCal;
  288. unsigned int nCalStatus;
  289. }Xray_Cal_Attr_Struct;
  290. typedef struct _Offset_Cal_Attr_Struct
  291. {
  292. bool bExpired;
  293. bool bShowImage;
  294. bool bECOMCal;
  295. unsigned int nCalStatus;
  296. unsigned int nOftType;
  297. }Offset_Cal_Attr_Struct;
  298. template<typename T> class AECInfo : public BaseJsonDataObject<T>
  299. {
  300. public:
  301. BaseJsonDataObject<int> m_AECDensity;
  302. BaseJsonDataObject<int> m_AECFiled;
  303. BaseJsonDataObject<int> m_AECFilm;
  304. BaseJsonDataObject<float> m_AECDose;
  305. AECInfo(void)
  306. {
  307. BaseJsonDataObject<T>::SetKey("AEC");
  308. m_AECDensity.SetKey("AECDensity");
  309. m_AECFiled.SetKey("AECFiled");
  310. m_AECFilm.SetKey("AECFilm");
  311. m_AECDose.SetKey("AECDose");
  312. }
  313. virtual ~AECInfo(void)
  314. {
  315. }
  316. virtual bool SetResDataObject(ResDataObject &obj)
  317. {
  318. bool ret = true;
  319. try {
  320. m_AECDensity = obj[m_AECDensity.GetKey()];
  321. m_AECFiled = obj[m_AECFiled.GetKey()];
  322. m_AECFilm = obj[m_AECFilm.GetKey()];
  323. m_AECDose = obj[m_AECDose.GetKey()];
  324. }
  325. catch (...)
  326. {
  327. ret = false;
  328. }
  329. return ret;
  330. };
  331. virtual void GetResDataObject(ResDataObject &obj)
  332. {
  333. //ResDataObject loca1;
  334. obj.add(m_AECDensity.GetKey(), m_AECDensity.GetVal());
  335. obj.add(m_AECFiled.GetKey(), m_AECFiled.GetVal());
  336. obj.add(m_AECFilm.GetKey(), m_AECFilm.GetVal());
  337. obj.add(m_AECDose.GetKey(), m_AECDose.GetVal());
  338. //obj.add(GetKey(), loca1);
  339. };
  340. virtual const char *GetVal()
  341. {
  342. ResDataObject obj;
  343. obj.add(m_AECDensity.GetKey(), m_AECDensity.GetVal());
  344. obj.add(m_AECFiled.GetKey(), m_AECFiled.GetVal());
  345. obj.add(m_AECFilm.GetKey(), m_AECFilm.GetVal());
  346. obj.add(m_AECDose.GetKey(), m_AECDose.GetVal());
  347. std::string m_ValString = obj.encode();
  348. return m_ValString.c_str();
  349. };
  350. virtual bool SetVal(const char* pValString)
  351. {
  352. ResDataObject obj;
  353. if (obj.decode(pValString))
  354. {
  355. int idx;
  356. idx = obj.GetFirstOf(m_AECDensity.GetKey());
  357. if (idx >= 0)
  358. {
  359. m_AECDensity.SetVal(obj[idx]);
  360. }
  361. idx = obj.GetFirstOf(m_AECFiled.GetKey());
  362. if (idx >= 0)
  363. {
  364. m_AECFiled.SetVal(obj[idx]);
  365. }
  366. idx = obj.GetFirstOf(m_AECFilm.GetKey());
  367. if (idx >= 0)
  368. {
  369. m_AECFilm.SetVal(obj[idx]);
  370. }
  371. idx = obj.GetFirstOf(m_AECDose.GetKey());
  372. if (idx >= 0)
  373. {
  374. m_AECDose.SetVal(obj[idx]);
  375. }
  376. return true;
  377. }
  378. return false;
  379. };
  380. };
  381. class APRStruct : public BaseJsonDataObject<BOOL>
  382. {
  383. public:
  384. /* "FOCUS": "0",
  385. "TECHMODE" : "0",
  386. "AECFIELD" : "0",
  387. "AECFILM" : "0",
  388. "AECDENSITY" : "0",
  389. "KV" : "70",
  390. "MA" : "160.0",
  391. "MS" : "100.0",
  392. "MAS" : "16.0",
  393. "DOSE" : "0.0",
  394. "FILTER" : "0",
  395. "TUBELOAD" : "80.0"*/
  396. BaseJsonDataObject<float> m_KV;
  397. BaseJsonDataObject<float> m_MA;
  398. BaseJsonDataObject<float> m_MS;
  399. BaseJsonDataObject<float> m_MAS;
  400. BaseJsonDataObject<int> m_FOCUS;
  401. BaseJsonDataObject<float> m_FOCUSSIZE;
  402. BaseJsonDataObject<int> m_TECHMODE;
  403. BaseJsonDataObject<int> m_AECFIELD;
  404. BaseJsonDataObject<int> m_AECFILM;
  405. BaseJsonDataObject<int> m_AECDENSITY;
  406. BaseJsonDataObject<float> m_TUBELOAD;
  407. BaseJsonDataObject<float> m_DOSE;
  408. BaseJsonDataObject<int> m_FILTER;
  409. BaseJsonDataObject<int> m_WORKSTATION;
  410. //AECInfo<int> m_AEC;
  411. APRStruct(void)
  412. {
  413. SetKey("APR");
  414. m_KV.SetKey("KV");
  415. m_MA.SetKey("MA");
  416. m_MS.SetKey("MS");
  417. m_MAS.SetKey("MAS");
  418. m_FOCUS.SetKey("FOCUS");
  419. m_FOCUSSIZE.SetKey("FOCUSSIZE");
  420. m_TECHMODE.SetKey("TECHMODE");
  421. m_AECFIELD.SetKey("AECFIELD");
  422. m_AECFILM.SetKey("AECFILM");
  423. m_AECDENSITY.SetKey("AECDENSITY");
  424. m_TUBELOAD.SetKey("TUBELOAD");
  425. m_DOSE.SetKey("DOSE");
  426. m_FILTER.SetKey("FILTER");
  427. m_WORKSTATION.SetKey("WORKSTATION");
  428. }
  429. virtual ~APRStruct(void)
  430. {
  431. }
  432. virtual bool SetResDataObjectfromUI(ResDataObject &obj)
  433. {
  434. bool ret = true;
  435. try {
  436. if (obj.GetFirstOf(m_KV.GetKey()) >= 0)
  437. {
  438. m_KV = (float)atof((const char *)obj[m_KV.GetKey()]);
  439. }
  440. if (obj.GetFirstOf(m_MA.GetKey()) >= 0)
  441. {
  442. m_MA = (float)atof((const char *)obj[m_MA.GetKey()]);
  443. }
  444. if (obj.GetFirstOf(m_MS.GetKey()) >= 0)
  445. {
  446. m_MS = (float)atof((const char *)obj[m_MS.GetKey()]);
  447. }
  448. if (obj.GetFirstOf(m_MAS.GetKey()) >= 0)
  449. {
  450. m_MAS = (float)atof((const char *)obj[m_MAS.GetKey()]);
  451. }
  452. if (obj.GetFirstOf(m_FOCUS.GetKey()) >= 0)
  453. {
  454. m_FOCUS = obj[m_FOCUS.GetKey()];
  455. }
  456. if (obj.GetFirstOf(m_TECHMODE.GetKey()) >= 0)
  457. {
  458. m_TECHMODE = obj[m_TECHMODE.GetKey()];
  459. }
  460. if (obj.GetFirstOf(m_AECFIELD.GetKey()) >= 0)
  461. {
  462. m_AECFIELD = obj[m_AECFIELD.GetKey()];
  463. }
  464. if (obj.GetFirstOf(m_AECFILM.GetKey()) >= 0)
  465. {
  466. m_AECFILM = obj[m_AECFILM.GetKey()];
  467. }
  468. if (obj.GetFirstOf(m_AECDENSITY.GetKey()) >= 0)
  469. {
  470. m_AECDENSITY = obj[m_AECDENSITY.GetKey()];
  471. }
  472. if (obj.GetFirstOf(m_TUBELOAD.GetKey()) >= 0)
  473. {
  474. m_TUBELOAD = (float)atof((const char *)obj[m_TUBELOAD.GetKey()]);
  475. }
  476. if (obj.GetFirstOf(m_DOSE.GetKey()) >= 0)
  477. {
  478. m_DOSE = (float)atof((const char *)obj[m_DOSE.GetKey()]);
  479. }
  480. if (obj.GetFirstOf(m_FILTER.GetKey()) >= 0)
  481. {
  482. m_FILTER = obj[m_FILTER.GetKey()];
  483. }
  484. if (obj.GetFirstOf(m_WORKSTATION.GetKey()) >= 0)
  485. {
  486. m_WORKSTATION = obj[m_WORKSTATION.GetKey()];
  487. }
  488. }
  489. catch (...)
  490. {
  491. ret = false;
  492. }
  493. return ret;
  494. };
  495. virtual bool SetResDataObject(ResDataObject &obj)
  496. {
  497. bool ret = true;
  498. try {
  499. if (obj.GetFirstOf(m_KV.GetKey()) >= 0)
  500. {
  501. m_KV = obj[m_KV.GetKey()];
  502. }
  503. if (obj.GetFirstOf(m_MA.GetKey()) >= 0)
  504. {
  505. m_MA = obj[m_MA.GetKey()];
  506. }
  507. if (obj.GetFirstOf(m_MS.GetKey()) >= 0)
  508. {
  509. m_MS = obj[m_MS.GetKey()];
  510. }
  511. if (obj.GetFirstOf(m_MAS.GetKey()) >= 0)
  512. {
  513. m_MAS = obj[m_MAS.GetKey()];
  514. }
  515. if (obj.GetFirstOf(m_FOCUS.GetKey()) >= 0)
  516. {
  517. m_FOCUS = obj[m_FOCUS.GetKey()];
  518. }
  519. if (obj.GetFirstOf(m_TECHMODE.GetKey()) >= 0)
  520. {
  521. m_TECHMODE = obj[m_TECHMODE.GetKey()];
  522. }
  523. if (obj.GetFirstOf(m_AECFIELD.GetKey()) >= 0)
  524. {
  525. m_AECFIELD = obj[m_AECFIELD.GetKey()];
  526. }
  527. if (obj.GetFirstOf(m_AECFILM.GetKey()) >= 0)
  528. {
  529. m_AECFILM = obj[m_AECFILM.GetKey()];
  530. }
  531. if (obj.GetFirstOf(m_AECDENSITY.GetKey()) >= 0)
  532. {
  533. m_AECDENSITY = obj[m_AECDENSITY.GetKey()];
  534. }
  535. if (obj.GetFirstOf(m_TUBELOAD.GetKey()) >= 0)
  536. {
  537. m_TUBELOAD = obj[m_TUBELOAD.GetKey()];
  538. }
  539. if (obj.GetFirstOf(m_DOSE.GetKey()) >= 0)
  540. {
  541. m_DOSE = obj[m_DOSE.GetKey()];
  542. }
  543. if (obj.GetFirstOf(m_FILTER.GetKey()) >= 0)
  544. {
  545. m_FILTER = obj[m_FILTER.GetKey()];
  546. }
  547. if (obj.GetFirstOf(m_WORKSTATION.GetKey()) >= 0)
  548. {
  549. m_WORKSTATION = obj[m_WORKSTATION.GetKey()];
  550. }
  551. }
  552. catch (...)
  553. {
  554. ret = false;
  555. }
  556. return ret;
  557. };
  558. virtual void GetResDataObject(ResDataObject &obj)
  559. {
  560. //ResDataObject loca1;
  561. //m_AEC.GetResDataObject(loca1);
  562. obj.add(m_KV.GetKey(), m_KV);
  563. obj.add(m_MA.GetKey(), m_MA);
  564. obj.add(m_MS.GetKey(), m_MS);
  565. obj.add(m_MAS.GetKey(), m_MAS);
  566. obj.add(m_FOCUS.GetKey(), m_FOCUS);
  567. obj.add(m_TECHMODE.GetKey(), m_TECHMODE);
  568. obj.add(m_FILTER.GetKey(), m_FILTER);
  569. obj.add(m_DOSE.GetKey(), m_DOSE);
  570. obj.add(m_AECDENSITY.GetKey(), m_AECDENSITY);
  571. obj.add(m_AECFILM.GetKey(), m_AECFILM);
  572. obj.add(m_AECFIELD.GetKey(), m_AECFIELD);
  573. obj.add(m_TUBELOAD.GetKey(), m_TUBELOAD);
  574. obj.add(m_WORKSTATION.GetKey(), m_WORKSTATION);
  575. //obj.add(m_AEC.GetKey(), loca1);
  576. //obj.add(GetKey(), loca1);
  577. };
  578. virtual const char *GetVal()
  579. {
  580. ResDataObject obj;
  581. obj.add(m_KV.GetKey(), m_KV.GetVal());
  582. obj.add(m_MA.GetKey(), m_MA.GetVal());
  583. obj.add(m_MS.GetKey(), m_MS.GetVal());
  584. obj.add(m_MAS.GetKey(), m_MAS.GetVal());
  585. obj.add(m_FOCUS.GetKey(), m_FOCUS.GetVal());
  586. obj.add(m_TECHMODE.GetKey(), m_TECHMODE.GetVal());
  587. obj.add(m_FILTER.GetKey(), m_FILTER.GetVal());
  588. obj.add(m_DOSE.GetKey(), m_DOSE.GetVal());
  589. //obj.add(m_AEC.GetKey(), m_AEC.GetVal());
  590. std::string m_ValString = obj.encode();
  591. return m_ValString.c_str();
  592. };
  593. virtual bool SetVal(const char* pValString)
  594. {
  595. ResDataObject obj;
  596. if (obj.decode(pValString))
  597. {
  598. int idx;
  599. idx = obj.GetFirstOf(m_KV.GetKey());
  600. if (idx >= 0)
  601. {
  602. m_KV.SetVal(obj[idx]);
  603. }
  604. idx = obj.GetFirstOf(m_MA.GetKey());
  605. if (idx >= 0)
  606. {
  607. m_MA.SetVal(obj[idx]);
  608. }
  609. idx = obj.GetFirstOf(m_MS.GetKey());
  610. if (idx >= 0)
  611. {
  612. m_MS.SetVal(obj[idx]);
  613. }
  614. idx = obj.GetFirstOf(m_MAS.GetKey());
  615. if (idx >= 0)
  616. {
  617. m_MAS.SetVal(obj[idx]);
  618. }
  619. idx = obj.GetFirstOf(m_FOCUS.GetKey());
  620. if (idx >= 0)
  621. {
  622. m_FOCUS.SetVal(obj[idx]);
  623. }
  624. idx = obj.GetFirstOf(m_TECHMODE.GetKey());
  625. if (idx >= 0)
  626. {
  627. m_TECHMODE.SetVal(obj[idx]);
  628. }
  629. idx = obj.GetFirstOf(m_FILTER.GetKey());
  630. if (idx >= 0)
  631. {
  632. m_FILTER.SetVal(obj[idx]);
  633. }
  634. idx = obj.GetFirstOf(m_DOSE.GetKey());
  635. if (idx >= 0)
  636. {
  637. m_DOSE.SetVal(obj[idx]);
  638. }
  639. //idx = obj.GetFirstOf(m_AEC.GetKey());
  640. //if (idx >= 0)
  641. //{
  642. // m_AEC.SetVal(obj[idx]);
  643. //}
  644. return true;
  645. }
  646. return false;
  647. }
  648. //virtual void SetKey(const char* pKeyString)
  649. //{
  650. // SetKey(pKeyString);
  651. // //return true;
  652. //};
  653. };
  654. template<typename T> class FrameData : public BaseJsonDataObject<T>
  655. {
  656. public:
  657. BaseJsonDataObject<string> m_FrameID;
  658. APRStruct m_ExpData;
  659. FrameData(void)
  660. {
  661. BaseJsonDataObject<T>::SetKey("FrameData");
  662. m_FrameID.SetKey("FramID");
  663. m_ExpData.SetKey("EXPData");
  664. }
  665. virtual ~FrameData(void)
  666. {
  667. }
  668. virtual const char *GetVal()
  669. {
  670. ResDataObject obj;
  671. obj.add(m_FrameID.GetKey(), m_FrameID.GetVal());
  672. obj.add(m_ExpData.GetKey(), m_ExpData.GetVal());
  673. std::string m_ValString = obj.encode();
  674. return m_ValString.c_str();
  675. };
  676. virtual bool SetVal(const char* pValString)
  677. {
  678. ResDataObject obj;
  679. if (obj.decode(pValString))
  680. {
  681. int idx;
  682. idx = obj.GetFirstOf(m_FrameID.GetKey());
  683. if (idx >= 0)
  684. {
  685. m_FrameID.SetVal(obj[idx]);
  686. }
  687. idx = obj.GetFirstOf(m_ExpData.GetKey());
  688. if (idx >= 0)
  689. {
  690. m_ExpData.SetVal(obj[idx]);
  691. }
  692. return true;
  693. }
  694. return false;
  695. }
  696. };
  697. template<typename T> class ExamDatalist : public BaseJsonDataObject<T>
  698. {
  699. public:
  700. vector<FrameData<T>>m_ExamDatalist;
  701. FrameData<T> temp;
  702. ExamDatalist(void)
  703. {
  704. BaseJsonDataObject<T>::SetKey("FrameData");
  705. }
  706. virtual ~ExamDatalist(void)
  707. {
  708. }
  709. virtual const char *GetVal()
  710. {
  711. ResDataObject obj;
  712. for (size_t i = 0; i<m_ExamDatalist.size(); i++)
  713. {
  714. obj.add(m_ExamDatalist[i].GetKey(), m_ExamDatalist[i].GetVal());
  715. }
  716. std::string m_ValString = obj.encode();
  717. return m_ValString.c_str();
  718. };
  719. void AddVal(string pValString)
  720. {
  721. temp.SetVal(pValString.c_str());
  722. m_ExamDatalist.push_back(temp);
  723. }
  724. int DelVal(string pValString)
  725. {
  726. ResDataObject obj;
  727. if (obj.decode(pValString.c_str()))
  728. {
  729. int idx;
  730. for (int i = 0; i<m_ExamDatalist.size(); i++)
  731. {
  732. idx = obj.GetFirstOf(m_ExamDatalist[i].m_FrameID.GetKey());
  733. if (idx >= 0)
  734. {
  735. if (m_ExamDatalist[i].m_FrameID.GetVal() == obj[idx])
  736. {
  737. m_ExamDatalist.erase(i);
  738. return true;
  739. }
  740. }
  741. }
  742. }
  743. return false;
  744. }
  745. int Find(const char * pValString)
  746. {
  747. ResDataObject obj;
  748. int index;
  749. if (obj.decode(pValString))
  750. {
  751. int idx;
  752. for (int i = 0; i<m_ExamDatalist.size(); i++)
  753. {
  754. idx = obj.GetFirstOf(m_ExamDatalist[i].m_FrameID.GetKey());
  755. if (idx >= 0)
  756. {
  757. if (m_ExamDatalist[i].m_FrameID.GetVal() == obj[idx])
  758. {
  759. index = i;
  760. return index;
  761. }
  762. }
  763. }
  764. }
  765. return false;
  766. }
  767. };
  768. template<typename T> class EXAMInfo : public BaseJsonDataObject<T>
  769. {
  770. public:
  771. BaseJsonDataObject<int> m_ExamMode;
  772. BaseJsonDataObject<int> m_WorkStation;
  773. BaseJsonDataObject<int> m_FrameID;
  774. EXAMInfo(void)
  775. {
  776. BaseJsonDataObject<T>::SetKey("EXAMInfo");
  777. m_ExamMode.SetKey("ExamMode");
  778. m_WorkStation.SetKey("WorkStation");
  779. m_FrameID.SetKey("FrameID");
  780. }
  781. virtual ~EXAMInfo(void)
  782. {
  783. }
  784. virtual bool SetResDataObject(ResDataObject &obj)
  785. {
  786. bool ret = true;
  787. try {
  788. m_ExamMode = obj[m_ExamMode.GetKey()];
  789. m_WorkStation = obj[m_WorkStation.GetKey()];
  790. m_FrameID = obj[m_FrameID.GetKey()];
  791. }
  792. catch (...)
  793. {
  794. ret = false;
  795. }
  796. return ret;
  797. };
  798. virtual void GetResDataObject(ResDataObject &obj)
  799. {
  800. obj.add(m_ExamMode.GetKey(), m_ExamMode);
  801. obj.add(m_WorkStation.GetKey(), m_WorkStation);
  802. obj.add(m_FrameID.GetKey(), m_FrameID);
  803. };
  804. virtual const char *GetVal()
  805. {
  806. ResDataObject obj;
  807. obj.add(m_ExamMode.GetKey(), m_ExamMode.GetVal());
  808. obj.add(m_WorkStation.GetKey(), m_WorkStation.GetVal());
  809. obj.add(m_FrameID.GetKey(), m_FrameID.GetVal());
  810. std::string m_ValString = obj.encode();
  811. return m_ValString.c_str();
  812. };
  813. virtual bool SetVal(const char* pValString)
  814. {
  815. ResDataObject obj;
  816. if (obj.decode(pValString))
  817. {
  818. int idx;
  819. idx = obj.GetFirstOf(m_ExamMode.GetKey());
  820. if (idx >= 0)
  821. {
  822. m_ExamMode.SetVal(obj[idx]);
  823. }
  824. idx = obj.GetFirstOf(m_WorkStation.GetKey());
  825. if (idx >= 0)
  826. {
  827. m_WorkStation.SetVal(obj[idx]);
  828. }
  829. idx = obj.GetFirstOf(m_FrameID.GetKey());
  830. if (idx >= 0)
  831. {
  832. m_FrameID.SetVal(obj[idx]);
  833. }
  834. return true;
  835. }
  836. return false;
  837. };
  838. };
  839. class ImgInfoDef : public BaseJsonDataObject<bool>
  840. {
  841. public:
  842. BaseJsonDataObject<unsigned int> nWidth;//宽度
  843. BaseJsonDataObject<unsigned int> nHeight;//高度
  844. BaseJsonDataObject<unsigned int> nBit;//位数
  845. ImgInfoDef()
  846. {
  847. SetKey("ImgInfo");
  848. nWidth.SetKey("Width");
  849. nHeight.SetKey("Height");
  850. nBit.SetKey("Bit");
  851. }
  852. virtual ~ImgInfoDef(void)
  853. {
  854. }
  855. virtual void GetResDataObject(ResDataObject &obj)
  856. {
  857. obj.clear();
  858. obj.add(nWidth.GetKey(), nWidth.GetVal());
  859. obj.add(nHeight.GetKey(), nHeight.GetVal());
  860. obj.add(nBit.GetKey(), nBit.GetVal());
  861. //obj.add(GetKey(), loca1);
  862. };
  863. virtual bool SetResDataObject(ResDataObject &obj)
  864. {
  865. bool ret = true;
  866. try {
  867. nBit = obj[nBit.GetKey()];
  868. nHeight = obj[nHeight.GetKey()];
  869. nWidth = obj[nWidth.GetKey()];
  870. }
  871. catch (...)
  872. {
  873. ret = false;
  874. }
  875. return ret;
  876. };
  877. virtual const char *GetVal()
  878. {
  879. ResDataObject obj;
  880. obj.add(nWidth.GetKey(), nWidth.GetVal());
  881. obj.add(nHeight.GetKey(), nHeight.GetVal());
  882. obj.add(nBit.GetKey(), nBit.GetVal());
  883. std::string m_ValString = obj.encode();
  884. return m_ValString.c_str();
  885. };
  886. virtual bool SetVal(const char* pValString)
  887. {
  888. ResDataObject obj;
  889. if (obj.decode(pValString))
  890. {
  891. int idx;
  892. idx = obj.GetFirstOf(nWidth.GetKey());
  893. if (idx >= 0)
  894. {
  895. nWidth.SetVal(obj[idx]);
  896. }
  897. idx = obj.GetFirstOf(nHeight.GetKey());
  898. if (idx >= 0)
  899. {
  900. nHeight.SetVal(obj[idx]);
  901. }
  902. idx = obj.GetFirstOf(nBit.GetKey());
  903. if (idx >= 0)
  904. {
  905. nBit.SetVal(obj[idx]);
  906. }
  907. return true;
  908. }
  909. return false;
  910. };
  911. virtual void SetKey(const char* pKeyString)
  912. {
  913. std::string temp = pKeyString;
  914. std::string keystring;
  915. BaseJsonDataObject<bool>::SetKey(pKeyString);
  916. //make key
  917. keystring = "Width";
  918. nWidth.SetKey(keystring.c_str());
  919. keystring = "Height";
  920. nHeight.SetKey(keystring.c_str());
  921. keystring = "Bit";
  922. nBit.SetKey(keystring.c_str());
  923. };
  924. };
  925. class ImgDataInfo : public BaseJsonDataObject<bool>
  926. {
  927. public:
  928. BaseJsonDataObject<unsigned int> nImageType;
  929. BaseJsonDataObject<unsigned int> nViewType;
  930. BaseJsonDataObject<unsigned long long> nShareMemID;
  931. BaseJsonDataObject<unsigned long long> nImageID;
  932. BaseJsonDataObject<unsigned int> nWidth;
  933. BaseJsonDataObject<unsigned int> nHeight;
  934. BaseJsonDataObject<unsigned int> nBit;
  935. ImgDataInfo(void)
  936. {
  937. const char* keystring = "ImageType";
  938. nImageType.SetKey(keystring);
  939. keystring = "Viewtype";
  940. nViewType.SetKey(keystring);
  941. keystring = "Sharememid";
  942. nShareMemID.SetKey(keystring);
  943. keystring = "Imageid";
  944. nImageID.SetKey(keystring);
  945. keystring = "Width";
  946. nWidth.SetKey(keystring);
  947. keystring = "Height";
  948. nHeight.SetKey(keystring);
  949. keystring = "Bit";
  950. nBit.SetKey(keystring);
  951. }
  952. virtual ~ImgDataInfo(void)
  953. {
  954. }
  955. virtual void GetResDataObject(ResDataObject &obj)
  956. {
  957. //ResDataObject loca1;
  958. obj.add(nImageType.GetKey(), nImageType.GetVal());
  959. obj.add(nViewType.GetKey(), nViewType.GetVal());
  960. obj.add(nShareMemID.GetKey(), nShareMemID.GetVal());
  961. obj.add(nImageID.GetKey(), nImageID.GetVal());
  962. obj.add(nWidth.GetKey(), nWidth.GetVal());
  963. obj.add(nHeight.GetKey(), nHeight.GetVal());
  964. obj.add(nBit.GetKey(), nBit.GetVal());
  965. //obj.add(GetKey(), loca1);
  966. };
  967. virtual bool SetResDataObject(ResDataObject &obj)
  968. {
  969. bool ret = true;
  970. try {
  971. nImageType = obj[nImageType.GetKey()];
  972. nViewType = obj[nViewType.GetKey()];
  973. nShareMemID = obj[nShareMemID.GetKey()];
  974. nImageID = obj[nImageID.GetKey()];
  975. nWidth = obj[nWidth.GetKey()];
  976. nHeight = obj[nHeight.GetKey()];
  977. nBit = obj[nBit.GetKey()];
  978. }
  979. catch (...)
  980. {
  981. ret = false;
  982. }
  983. return ret;
  984. };
  985. virtual const char *GetVal()
  986. {
  987. ResDataObject obj;
  988. obj.add(nImageType.GetKey(), nImageType.GetVal());
  989. obj.add(nViewType.GetKey(), nViewType.GetVal());
  990. obj.add(nShareMemID.GetKey(), nShareMemID.GetVal());
  991. obj.add(nImageID.GetKey(), nImageID.GetVal());
  992. obj.add(nWidth.GetKey(), nWidth.GetVal());
  993. obj.add(nHeight.GetKey(), nHeight.GetVal());
  994. obj.add(nBit.GetKey(), nBit.GetVal());
  995. std::string m_ValString = obj.encode();
  996. return m_ValString.c_str();
  997. };
  998. virtual bool SetVal(const char* pValString)
  999. {
  1000. ResDataObject obj;
  1001. if (obj.decode(pValString))
  1002. {
  1003. int idx;
  1004. idx = obj.GetFirstOf(nImageType.GetKey());
  1005. if (idx >= 0)
  1006. {
  1007. nImageType.SetVal(obj[idx]);
  1008. }
  1009. idx = obj.GetFirstOf(nViewType.GetKey());
  1010. if (idx >= 0)
  1011. {
  1012. nViewType.SetVal(obj[idx]);
  1013. }
  1014. idx = obj.GetFirstOf(nShareMemID.GetKey());
  1015. if (idx >= 0)
  1016. {
  1017. nShareMemID.SetVal(obj[idx]);
  1018. }
  1019. idx = obj.GetFirstOf(nImageID.GetKey());
  1020. if (idx >= 0)
  1021. {
  1022. nImageID.SetVal(obj[idx]);
  1023. }
  1024. idx = obj.GetFirstOf(nWidth.GetKey());
  1025. if (idx >= 0)
  1026. {
  1027. nWidth.SetVal(obj[idx]);
  1028. }
  1029. idx = obj.GetFirstOf(nHeight.GetKey());
  1030. if (idx >= 0)
  1031. {
  1032. nHeight.SetVal(obj[idx]);
  1033. }
  1034. idx = obj.GetFirstOf(nBit.GetKey());
  1035. if (idx >= 0)
  1036. {
  1037. nBit.SetVal(obj[idx]);
  1038. }
  1039. return true;
  1040. }
  1041. return false;
  1042. };
  1043. virtual void SetKey(const char* pKeyString)
  1044. {
  1045. BaseJsonDataObject<bool>::SetKey(pKeyString);
  1046. //make key
  1047. const char* keystring = "ImageType";
  1048. nImageType.SetKey(keystring);
  1049. keystring = "Viewtype";
  1050. nViewType.SetKey(keystring);
  1051. keystring = "Sharememid";
  1052. nShareMemID.SetKey(keystring);
  1053. keystring = "Imageid";
  1054. nImageID.SetKey(keystring);
  1055. keystring = "Width";
  1056. nWidth.SetKey(keystring);
  1057. keystring = "Height";
  1058. nHeight.SetKey(keystring);
  1059. keystring = "Bit";
  1060. nBit.SetKey(keystring);
  1061. };
  1062. };
  1063. class XRAY_CAL_ATTR : public BaseJsonDataObject<bool>
  1064. {
  1065. public:
  1066. BaseJsonDataObject<bool> bExpired;
  1067. BaseJsonDataObject<bool> bShowImage;
  1068. BaseJsonDataObject<bool> bECOMCal;
  1069. BaseJsonDataObject<unsigned int> nCalStatus;
  1070. XRAY_CAL_ATTR(void)
  1071. {
  1072. const char* keystring = "Expire";
  1073. bExpired.SetKey(keystring);
  1074. bShowImage = "ShowImage";
  1075. bShowImage.SetKey(keystring);
  1076. keystring = "ECOMCal";
  1077. bECOMCal.SetKey(keystring);
  1078. keystring = "CalStatus";
  1079. nCalStatus.SetKey(keystring);
  1080. bExpired = false;
  1081. bShowImage = false;
  1082. bECOMCal = false;
  1083. nCalStatus = CAL_TYPE_NONE;
  1084. }
  1085. virtual ~XRAY_CAL_ATTR(void)
  1086. {
  1087. }
  1088. virtual void GetResDataObject(ResDataObject &obj)
  1089. {
  1090. //ResDataObject loca1;
  1091. obj.add(bExpired.GetKey(), bExpired.GetVal());
  1092. obj.add(bShowImage.GetKey(), bShowImage.GetVal());
  1093. obj.add(bECOMCal.GetKey(), bECOMCal.GetVal());
  1094. obj.add(nCalStatus.GetKey(), nCalStatus.GetVal());
  1095. //obj.add(GetKey(), loca1);
  1096. };
  1097. virtual bool SetResDataObject(ResDataObject &obj)
  1098. {
  1099. bool ret = true;
  1100. try {
  1101. bExpired = obj[bExpired.GetKey()];
  1102. bShowImage = obj[bShowImage.GetKey()];
  1103. bECOMCal = obj[bECOMCal.GetKey()];
  1104. nCalStatus = obj[nCalStatus.GetKey()];
  1105. }
  1106. catch (...)
  1107. {
  1108. ret = false;
  1109. }
  1110. return ret;
  1111. };
  1112. virtual const char *GetVal()
  1113. {
  1114. ResDataObject obj;
  1115. obj.add(bExpired.GetKey(), bExpired.GetVal());
  1116. obj.add(bShowImage.GetKey(), bShowImage.GetVal());
  1117. obj.add(bECOMCal.GetKey(), bECOMCal.GetVal());
  1118. obj.add(nCalStatus.GetKey(), nCalStatus.GetVal());
  1119. std::string m_ValString = obj.encode();
  1120. return m_ValString.c_str();
  1121. };
  1122. virtual bool SetVal(const char* pValString)
  1123. {
  1124. ResDataObject obj;
  1125. if (obj.decode(pValString))
  1126. {
  1127. int idx;
  1128. idx = obj.GetFirstOf(bExpired.GetKey());
  1129. if (idx >= 0)
  1130. {
  1131. bExpired.SetVal(obj[idx]);
  1132. }
  1133. idx = obj.GetFirstOf(bShowImage.GetKey());
  1134. if (idx >= 0)
  1135. {
  1136. bShowImage.SetVal(obj[idx]);
  1137. }
  1138. idx = obj.GetFirstOf(bECOMCal.GetKey());
  1139. if (idx >= 0)
  1140. {
  1141. bECOMCal.SetVal(obj[idx]);
  1142. }
  1143. idx = obj.GetFirstOf(nCalStatus.GetKey());
  1144. if (idx >= 0)
  1145. {
  1146. nCalStatus.SetVal(obj[idx]);
  1147. }
  1148. return true;
  1149. }
  1150. return false;
  1151. };
  1152. virtual void SetKey(const char* pKeyString)
  1153. {
  1154. BaseJsonDataObject<bool>::SetKey(pKeyString);
  1155. //make key
  1156. const char* keystring = "Expired";
  1157. bExpired.SetKey(keystring);
  1158. keystring = "ShowImage";
  1159. bShowImage.SetKey(keystring);
  1160. keystring = "ECOMCal";
  1161. bECOMCal.SetKey(keystring);
  1162. keystring = "CalStatus";
  1163. nCalStatus.SetKey(keystring);
  1164. };
  1165. };
  1166. class OFFSETT_CAL_ATTR : public BaseJsonDataObject<bool>
  1167. {
  1168. public:
  1169. BaseJsonDataObject<bool> bExpired;
  1170. BaseJsonDataObject<bool> bShowImage;
  1171. BaseJsonDataObject<bool> bECOMCal;
  1172. BaseJsonDataObject<unsigned int> nCalStatus;
  1173. BaseJsonDataObject<unsigned int> nOftType;
  1174. OFFSETT_CAL_ATTR(void)
  1175. {
  1176. const char* keystring = "Expire";
  1177. bExpired.SetKey(keystring);
  1178. bShowImage = "ShowImage";
  1179. bShowImage.SetKey(keystring);
  1180. keystring = "ECOMCal";
  1181. bECOMCal.SetKey(keystring);
  1182. keystring = "CalStatus";
  1183. nCalStatus.SetKey(keystring);
  1184. keystring = "OftType";
  1185. nOftType.SetKey(keystring);
  1186. bExpired = false;
  1187. bShowImage = false;
  1188. bECOMCal = false;
  1189. nCalStatus = CAL_TYPE_NONE;
  1190. nOftType = OFT_NONE;
  1191. }
  1192. virtual ~OFFSETT_CAL_ATTR(void)
  1193. {
  1194. }
  1195. virtual void GetResDataObject(ResDataObject &obj)
  1196. {
  1197. //ResDataObject loca1;
  1198. obj.add(bExpired.GetKey(), bExpired.GetVal());
  1199. obj.add(bShowImage.GetKey(), bShowImage.GetVal());
  1200. obj.add(bECOMCal.GetKey(), bECOMCal.GetVal());
  1201. obj.add(nCalStatus.GetKey(), nCalStatus.GetVal());
  1202. obj.add(nOftType.GetKey(), nOftType.GetVal());
  1203. //obj.add(GetKey(), loca1);
  1204. };
  1205. virtual bool SetResDataObject(ResDataObject &obj)
  1206. {
  1207. bool ret = true;
  1208. try {
  1209. bExpired = obj[bExpired.GetKey()];
  1210. bShowImage = obj[bShowImage.GetKey()];
  1211. bECOMCal = obj[bECOMCal.GetKey()];
  1212. nCalStatus = obj[nCalStatus.GetKey()];
  1213. nOftType = obj[nOftType.GetKey()];
  1214. }
  1215. catch (...)
  1216. {
  1217. ret = false;
  1218. }
  1219. return ret;
  1220. };
  1221. virtual const char *GetVal()
  1222. {
  1223. ResDataObject obj;
  1224. obj.add(bExpired.GetKey(), bExpired.GetVal());
  1225. obj.add(bShowImage.GetKey(), bShowImage.GetVal());
  1226. obj.add(bECOMCal.GetKey(), bECOMCal.GetVal());
  1227. obj.add(nCalStatus.GetKey(), nCalStatus.GetVal());
  1228. obj.add(nOftType.GetKey(), nOftType.GetVal());
  1229. std::string m_ValString = obj.encode();
  1230. return m_ValString.c_str();
  1231. };
  1232. virtual bool SetVal(const char* pValString)
  1233. {
  1234. ResDataObject obj;
  1235. if (obj.decode(pValString))
  1236. {
  1237. int idx;
  1238. idx = obj.GetFirstOf(bExpired.GetKey());
  1239. if (idx >= 0)
  1240. {
  1241. bExpired.SetVal(obj[idx]);
  1242. }
  1243. idx = obj.GetFirstOf(bShowImage.GetKey());
  1244. if (idx >= 0)
  1245. {
  1246. bShowImage.SetVal(obj[idx]);
  1247. }
  1248. idx = obj.GetFirstOf(bECOMCal.GetKey());
  1249. if (idx >= 0)
  1250. {
  1251. bECOMCal.SetVal(obj[idx]);
  1252. }
  1253. idx = obj.GetFirstOf(nCalStatus.GetKey());
  1254. if (idx >= 0)
  1255. {
  1256. nCalStatus.SetVal(obj[idx]);
  1257. }
  1258. idx = obj.GetFirstOf(nOftType.GetKey());
  1259. if (idx >= 0)
  1260. {
  1261. nOftType.SetVal(obj[idx]);
  1262. }
  1263. return true;
  1264. }
  1265. return false;
  1266. };
  1267. virtual void SetKey(const char* pKeyString)
  1268. {
  1269. BaseJsonDataObject<bool>::SetKey(pKeyString);
  1270. //make key
  1271. const char* keystring = "Expired";
  1272. bExpired.SetKey(keystring);
  1273. keystring = "ShowImage";
  1274. bShowImage.SetKey(keystring);
  1275. keystring = "ECOMCal";
  1276. bECOMCal.SetKey(keystring);
  1277. keystring = "CalStatus";
  1278. nCalStatus.SetKey(keystring);
  1279. keystring = "OftType";
  1280. nOftType.SetKey(keystring);
  1281. };
  1282. };
  1283. //class MESSAGE_ERROR : public BaseJsonDataObject<bool>
  1284. //{
  1285. //public:
  1286. // BaseJsonDataObject<int> nCode;
  1287. // BaseJsonDataObject<string> strName;
  1288. // BaseJsonDataObject<string> strDescription;
  1289. // BaseJsonDataObject<string> strSolution;
  1290. // BaseJsonDataObject<int> nNotifyType;
  1291. // BaseJsonDataObject<string> strInterlock;
  1292. // BaseJsonDataObject<string> strBackCommand;
  1293. // MESSAGE_ERROR(void)
  1294. // {
  1295. // const char* keystring = "Code";
  1296. // nCode.SetKey(keystring);
  1297. // keystring = "Name";
  1298. // strName.SetKey(keystring);
  1299. // keystring = "Description";
  1300. // strDescription.SetKey(keystring);
  1301. // keystring = "Solution";
  1302. // strSolution.SetKey(keystring);
  1303. // keystring = "NotifyType";
  1304. // nNotifyType.SetKey(keystring);
  1305. // keystring = "Interlock";
  1306. // strInterlock.SetKey(keystring);
  1307. // keystring = "BackCommand";
  1308. // strBackCommand.SetKey(keystring);
  1309. // nCode = 0;
  1310. // strName = "";
  1311. // strDescription = "";
  1312. // strSolution = "";
  1313. // nNotifyType = 0;
  1314. // strInterlock = "";
  1315. // strBackCommand = "";
  1316. // }
  1317. // virtual ~MESSAGE_ERROR(void)
  1318. // {
  1319. // }
  1320. // virtual void GetResDataObject(ResDataObject &obj)
  1321. // {
  1322. // //ResDataObject loca1;
  1323. // obj.add(nCode.GetKey(), nCode.GetVal());
  1324. // obj.add(strName.GetKey(), strName.GetVal());
  1325. // obj.add(strDescription.GetKey(), strDescription.GetVal());
  1326. // obj.add(strSolution.GetKey(), strSolution.GetVal());
  1327. // obj.add(nNotifyType.GetKey(), nNotifyType.GetVal());
  1328. // obj.add(strInterlock.GetKey(), strInterlock.GetVal());
  1329. // obj.add(strBackCommand.GetKey(), strBackCommand.GetVal());
  1330. // };
  1331. // virtual bool SetResDataObject(ResDataObject &obj)
  1332. // {
  1333. // bool ret = true;
  1334. // try {
  1335. // nCode = obj[nCode.GetKey()];
  1336. // strName = (const char *)obj[strName.GetKey()];
  1337. // strDescription = (const char *)obj[strDescription.GetKey()];
  1338. // strSolution = (const char *)obj[strSolution.GetKey()];
  1339. // nNotifyType = obj[nNotifyType.GetKey()];
  1340. // strInterlock = (const char *)obj[strInterlock.GetKey()];
  1341. // strBackCommand = (const char *)obj[strBackCommand.GetKey()];
  1342. // }
  1343. // catch (...)
  1344. // {
  1345. // ret = false;
  1346. // }
  1347. // return ret;
  1348. // };
  1349. // virtual const char *GetVal()
  1350. // {
  1351. // ResDataObject obj;
  1352. // obj.add(nCode.GetKey(), nCode.GetVal());
  1353. // obj.add(strName.GetKey(), strName.GetVal());
  1354. // obj.add(strDescription.GetKey(), strDescription.GetVal());
  1355. // obj.add(strSolution.GetKey(), strSolution.GetVal());
  1356. // obj.add(nNotifyType.GetKey(), nNotifyType.GetVal());
  1357. // obj.add(strInterlock.GetKey(), strInterlock.GetVal());
  1358. // obj.add(strBackCommand.GetKey(), strBackCommand.GetVal());
  1359. // std::string m_ValString = obj.encode();
  1360. // return m_ValString.c_str();
  1361. // };
  1362. // virtual bool SetVal(const char* pValString)
  1363. // {
  1364. // ResDataObject obj;
  1365. // if (obj.decode(pValString))
  1366. // {
  1367. // int idx;
  1368. // idx = obj.GetFirstOf(nCode.GetKey());
  1369. // if (idx >= 0)
  1370. // {
  1371. // nCode.SetVal(obj[idx]);
  1372. // }
  1373. // idx = obj.GetFirstOf(strName.GetKey());
  1374. // if (idx >= 0)
  1375. // {
  1376. // strName.SetVal(obj[idx]);
  1377. // }
  1378. // idx = obj.GetFirstOf(strDescription.GetKey());
  1379. // if (idx >= 0)
  1380. // {
  1381. // strDescription.SetVal(obj[idx]);
  1382. // }
  1383. // idx = obj.GetFirstOf(strSolution.GetKey());
  1384. // if (idx >= 0)
  1385. // {
  1386. // strSolution.SetVal(obj[idx]);
  1387. // }
  1388. // idx = obj.GetFirstOf(nNotifyType.GetKey());
  1389. // if (idx >= 0)
  1390. // {
  1391. // nNotifyType.SetVal(obj[idx]);
  1392. // }
  1393. // idx = obj.GetFirstOf(strInterlock.GetKey());
  1394. // if (idx >= 0)
  1395. // {
  1396. // strInterlock.SetVal(obj[idx]);
  1397. // }
  1398. // idx = obj.GetFirstOf(strBackCommand.GetKey());
  1399. // if (idx >= 0)
  1400. // {
  1401. // strBackCommand.SetVal(obj[idx]);
  1402. // }
  1403. // return true;
  1404. // }
  1405. // return false;
  1406. // };
  1407. // virtual void SetKey(const char* pKeyString)
  1408. // {
  1409. // BaseJsonDataObject<bool>::SetKey(pKeyString);
  1410. // //make key
  1411. // const char* keystring = "Code";
  1412. // nCode.SetKey(keystring);
  1413. // keystring = "Name";
  1414. // strName.SetKey(keystring);
  1415. // keystring = "Description";
  1416. // strDescription.SetKey(keystring);
  1417. // keystring = "Solution";
  1418. // strSolution.SetKey(keystring);
  1419. // keystring = "NotifyType";
  1420. // nNotifyType.SetKey(keystring);
  1421. // keystring = "Interlock";
  1422. // strInterlock.SetKey(keystring);
  1423. // keystring = "BackCommand";
  1424. // strBackCommand.SetKey(keystring);
  1425. // };
  1426. //};