Scheduled service maintenance on November 22


On Friday, November 22, 2024, between 06:00 CET and 18:00 CET, GIN services will undergo planned maintenance. Extended service interruptions should be expected. We will try to keep downtimes to a minimum, but recommend that users avoid critical tasks, large data uploads, or DOI requests during this time.

We apologize for any inconvenience.

CCFUtilsXmlItems.cpp 50 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309
  1. // =STS=> CCFUtilsXmlItems.cpp[4878].aa03 open SMID:3
  2. //////////////////////////////////////////////////////////////////////
  3. //
  4. // (c) Copyright 2012-2013 Blackrock Microsystems
  5. //
  6. // $Workfile: CCFUtilsXmlItems.cpp $
  7. // $Archive: /Cerebus/Human/WindowsApps/cbhwlib/CCFUtilsXmlItems.cpp $
  8. // $Revision: 1 $
  9. // $Date: 4/13/12 3:47p $
  10. // $Author: Ehsan $
  11. //
  12. // $NoKeywords: $
  13. //
  14. //////////////////////////////////////////////////////////////////////
  15. //
  16. // Purpose: Implements CCFUtilsXmlItemsGenerate and CCFUtilsXmlItemsParse interfaces
  17. //
  18. // Note:
  19. // Do not validate the packets in this unit, here is not the right place
  20. //
  21. // Note on selecting tag names:
  22. // 1- We do not yet have a standard for this,
  23. // these rules help in keeping the field format clean.
  24. // 2- Do not include the type qualifiers in the name,
  25. // For example use "Threshold" for pkt.fThreshold (instead of "fThreshold")
  26. // Type attribute is automatically added for clarity
  27. // 3- It is encouraged to use prefix tags for domain clarity,
  28. // For example, "monitor/lowsamples" separates the monitor union
  29. // 4- It is encouraged to predict future additions and use prefix tags.
  30. // For example even though we currently have only 2 reference channels for adaptive filter
  31. // "RefChan/RefChan_item" is used to make future possible addition more seamless.
  32. // 5- Use English tag names, unless it conveys something different
  33. // For example use "spike/filter" instead of "spkfilter",
  34. // but keep "spkcaps" because it better conveys a bitfiled.
  35. // 6- If the packet has positional field in an array (such as chan in chaninfo) keep it
  36. // 7- If a filed name is used in one packet (e.g. "mode") keep the capital/lower case the same
  37. // in future packets, for example another packet with "nMode" should also use "mode" instead of "Mode"
  38. // this means before adding new packets consistency in naming is important and older name should be kept
  39. //
  40. // --------- Last rule after this line ---------
  41. // 8- Giving above rules higher precedence, use filed-name keeping its captial/lower case the same
  42. //
  43. #include "StdAfx.h"
  44. #include <algorithm> // Use C++ default min and max implementation.
  45. #include "CCFUtilsXmlItems.h"
  46. #include "CCFUtilsXmlItemsGenerate.h"
  47. #include "CCFUtilsXmlItemsParse.h"
  48. #include "debugmacs.h"
  49. #ifdef _DEBUG
  50. #undef THIS_FILE
  51. static char THIS_FILE[]=__FILE__;
  52. #endif
  53. // Author & Date: Ehsan Azar 17 April 2012
  54. // Purpose: CCF XML item copy constructor
  55. CCFXmlItem::operator const QVariant() const
  56. {
  57. return QVariant::fromValue(*this);
  58. }
  59. // Author & Date: Ehsan Azar 11 April 2012
  60. // Purpose: CCF XML item constructor
  61. CCFXmlItem::CCFXmlItem(cbPKT_CHANINFO & pkt, QString strName)
  62. {
  63. m_xmlTag = strName;
  64. pkt.label[cbLEN_STR_LABEL - 1] = 0;
  65. m_xmlAttribs.insert("label", QString(pkt.label));
  66. m_xmlAttribs.insert("Type", "cbPKT_CHANINFO");
  67. if (pkt.chan == 0)
  68. return;
  69. QVariantList lst;
  70. lst += ccf::GetCCFXmlItem(pkt.chid, "chid");
  71. lst += ccf::GetCCFXmlItem(pkt.type, "type");
  72. lst += ccf::GetCCFXmlItem(pkt.dlen, "dlen");
  73. lst += ccf::GetCCFXmlItem(pkt.chan, "chan");
  74. lst += ccf::GetCCFXmlItem(pkt.proc, "proc");
  75. lst += ccf::GetCCFXmlItem(pkt.bank, "bank");
  76. lst += ccf::GetCCFXmlItem(pkt.term, "term");
  77. lst += ccf::GetCCFXmlItem(pkt.chancaps, "caps/chancaps");
  78. lst += ccf::GetCCFXmlItem(pkt.doutcaps, "caps/doutcaps");
  79. lst += ccf::GetCCFXmlItem(pkt.dinpcaps, "caps/dinpcaps");
  80. lst += ccf::GetCCFXmlItem(pkt.aoutcaps, "caps/aoutcaps");
  81. lst += ccf::GetCCFXmlItem(pkt.ainpcaps, "caps/ainpcaps");
  82. lst += ccf::GetCCFXmlItem(pkt.spkcaps, "caps/spkcaps");
  83. lst += ccf::GetCCFXmlItem(pkt.physcalin, "scale/physcalin");
  84. lst += ccf::GetCCFXmlItem(pkt.phyfiltin, "filterdesc/phyfiltin");
  85. lst += ccf::GetCCFXmlItem(pkt.physcalout, "scale/physcalout");
  86. lst += ccf::GetCCFXmlItem(pkt.phyfiltout, "filterdesc/phyfiltout");
  87. lst += ccf::GetCCFXmlItem(pkt.label, cbLEN_STR_LABEL, "label");
  88. lst += ccf::GetCCFXmlItem(pkt.userflags, "userflags");
  89. lst += ccf::GetCCFXmlItem(pkt.position, 4, "position");
  90. lst += ccf::GetCCFXmlItem(pkt.scalin, "scale/scalin");
  91. lst += ccf::GetCCFXmlItem(pkt.scalout, "scale/scalout");
  92. lst += ccf::GetCCFXmlItem(pkt.doutopts, "options/doutopts");
  93. lst += ccf::GetCCFXmlItem(pkt.dinpopts, "options/dinpopts");
  94. lst += ccf::GetCCFXmlItem(pkt.aoutopts, "options/aoutopts");
  95. lst += ccf::GetCCFXmlItem(pkt.eopchar, "eopchar");
  96. { // For union we recoord the most informative one
  97. lst += ccf::GetCCFXmlItem(pkt.lowsamples, "monitor/lowsamples");
  98. lst += ccf::GetCCFXmlItem(pkt.highsamples, "monitor/highsamples");
  99. lst += ccf::GetCCFXmlItem(pkt.offset, "monitor/offset");
  100. }
  101. lst += ccf::GetCCFXmlItem(pkt.ainpopts, "options/ainpopts");
  102. lst += ccf::GetCCFXmlItem(pkt.lncrate, "lnc/rate");
  103. lst += ccf::GetCCFXmlItem(pkt.smpfilter, "sample/filter");
  104. lst += ccf::GetCCFXmlItem(pkt.smpgroup, "sample/group");
  105. lst += ccf::GetCCFXmlItem(pkt.smpdispmin, "sample/dispmin");
  106. lst += ccf::GetCCFXmlItem(pkt.smpdispmax, "sample/dispmax");
  107. lst += ccf::GetCCFXmlItem(pkt.spkfilter, "spike/filter");
  108. lst += ccf::GetCCFXmlItem(pkt.spkdispmax, "spike/dispmax");
  109. lst += ccf::GetCCFXmlItem(pkt.lncdispmax, "lnc/dispmax");
  110. lst += ccf::GetCCFXmlItem(pkt.spkopts, "options/spkopts");
  111. lst += ccf::GetCCFXmlItem(pkt.spkthrlevel, "spike/threshold/level");
  112. lst += ccf::GetCCFXmlItem(pkt.spkthrlimit, "spike/threshold/limit");
  113. lst += ccf::GetCCFXmlItem(pkt.spkgroup, "spike/group");
  114. lst += ccf::GetCCFXmlItem(pkt.amplrejpos, "spike/amplituderejecet/positive");
  115. lst += ccf::GetCCFXmlItem(pkt.amplrejneg, "spike/amplituderejecet/negative");
  116. lst += ccf::GetCCFXmlItem(pkt.refelecchan, "refelecchan");
  117. lst += ccf::GetCCFXmlItem(pkt.unitmapping, cbMAXUNITS, "unitmapping");
  118. lst += ccf::GetCCFXmlItem(pkt.spkhoops, cbMAXUNITS, cbMAXHOOPS, "spike/hoops", "hoop");
  119. lst += ccf::GetCCFXmlItem(pkt.trigtype, "douttrig/type");
  120. lst += ccf::GetCCFXmlItem(pkt.trigchan, "douttrig/chan");
  121. lst += ccf::GetCCFXmlItem(pkt.trigval, "douttrig/val");
  122. // Now use the list
  123. m_xmlValue = lst;
  124. }
  125. // Author & Date: Ehsan Azar 11 April 2012
  126. // Purpose: CCF XML item constructor
  127. CCFXmlItem::CCFXmlItem(cbPKT_ADAPTFILTINFO & pkt, QString strName)
  128. {
  129. m_xmlTag = strName;
  130. m_xmlAttribs.insert("Type", "cbPKT_ADAPTFILTINFO");
  131. if (pkt.type == 0)
  132. return;
  133. QVariantList lst;
  134. lst += ccf::GetCCFXmlItem(pkt.chid, "chid");
  135. lst += ccf::GetCCFXmlItem(pkt.type, "type");
  136. lst += ccf::GetCCFXmlItem(pkt.dlen, "dlen");
  137. lst += ccf::GetCCFXmlItem(pkt.chan, "chan");
  138. lst += ccf::GetCCFXmlItem(pkt.nMode, "mode");
  139. lst += ccf::GetCCFXmlItem(pkt.dLearningRate, "LearningRate");
  140. lst += ccf::GetCCFXmlItem(pkt.nRefChan1, "RefChan/RefChan_item");
  141. lst += ccf::GetCCFXmlItem(pkt.nRefChan2, "RefChan/RefChan_item<1>");
  142. // Now use the list
  143. m_xmlValue = lst;
  144. }
  145. // Author & Date: Ehsan Azar 11 April 2012
  146. // Purpose: CCF XML item constructor
  147. CCFXmlItem::CCFXmlItem(cbPKT_SS_DETECT & pkt, QString strName)
  148. {
  149. m_xmlTag = strName;
  150. m_xmlAttribs.insert("Type", "cbPKT_SS_DETECT");
  151. if (pkt.type == 0)
  152. return;
  153. QVariantList lst;
  154. lst += ccf::GetCCFXmlItem(pkt.chid, "chid");
  155. lst += ccf::GetCCFXmlItem(pkt.type, "type");
  156. lst += ccf::GetCCFXmlItem(pkt.dlen, "dlen");
  157. lst += ccf::GetCCFXmlItem(pkt.fThreshold, "Threshold");
  158. lst += ccf::GetCCFXmlItem(pkt.fMultiplier, "Multiplier");
  159. // Now use the list
  160. m_xmlValue = lst;
  161. }
  162. // Author & Date: Ehsan Azar 11 April 2012
  163. // Purpose: CCF XML item constructor
  164. CCFXmlItem::CCFXmlItem(cbPKT_SS_ARTIF_REJECT & pkt, QString strName)
  165. {
  166. m_xmlTag = strName;
  167. m_xmlAttribs.insert("Type", "cbPKT_SS_ARTIF_REJECT");
  168. if (pkt.type == 0)
  169. return;
  170. QVariantList lst;
  171. lst += ccf::GetCCFXmlItem(pkt.chid, "chid");
  172. lst += ccf::GetCCFXmlItem(pkt.type, "type");
  173. lst += ccf::GetCCFXmlItem(pkt.dlen, "dlen");
  174. lst += ccf::GetCCFXmlItem(pkt.nMaxSimulChans, "MaxSimulChans");
  175. lst += ccf::GetCCFXmlItem(pkt.nRefractoryCount, "RefractoryCount");
  176. // Now use the list
  177. m_xmlValue = lst;
  178. }
  179. // Author & Date: Ehsan Azar 11 April 2012
  180. // Purpose: CCF XML item constructor
  181. CCFXmlItem::CCFXmlItem(cbPKT_SS_NOISE_BOUNDARY & pkt, QString strName)
  182. {
  183. m_xmlTag = strName;
  184. m_xmlAttribs.insert("Type", "cbPKT_SS_NOISE_BOUNDARY");
  185. if (pkt.chan == 0)
  186. return;
  187. QVariantList lst;
  188. lst += ccf::GetCCFXmlItem(pkt.chid, "chid");
  189. lst += ccf::GetCCFXmlItem(pkt.type, "type");
  190. lst += ccf::GetCCFXmlItem(pkt.dlen, "dlen");
  191. lst += ccf::GetCCFXmlItem(pkt.chan, "chan");
  192. lst += ccf::GetCCFXmlItem(pkt.afc, 3, "center");
  193. lst += ccf::GetCCFXmlItem(pkt.afS, 3, 3, "axes", "axis");
  194. // Now use the list
  195. m_xmlValue = lst;
  196. }
  197. // Author & Date: Ehsan Azar 11 April 2012
  198. // Purpose: CCF XML item constructor
  199. CCFXmlItem::CCFXmlItem(cbPKT_SS_STATISTICS & pkt, QString strName)
  200. {
  201. m_xmlTag = strName;
  202. m_xmlAttribs.insert("Type", "cbPKT_SS_STATISTICS");
  203. if (pkt.type == 0)
  204. return;
  205. QVariantList lst;
  206. lst += ccf::GetCCFXmlItem(pkt.chid, "chid");
  207. lst += ccf::GetCCFXmlItem(pkt.type, "type");
  208. lst += ccf::GetCCFXmlItem(pkt.dlen, "dlen");
  209. lst += ccf::GetCCFXmlItem(pkt.nUpdateSpikes, "UpdateSpikes");
  210. lst += ccf::GetCCFXmlItem(pkt.nAutoalg, "Autoalg");
  211. lst += ccf::GetCCFXmlItem(pkt.nMode, "mode");
  212. lst += ccf::GetCCFXmlItem(pkt.fMinClusterPairSpreadFactor, "Cluster/MinClusterPairSpreadFactor");
  213. lst += ccf::GetCCFXmlItem(pkt.fMaxSubclusterSpreadFactor, "Cluster/MaxSubclusterSpreadFactor");
  214. lst += ccf::GetCCFXmlItem(pkt.fMinClusterHistCorrMajMeasure, "Cluster/MinClusterHistCorrMajMeasure");
  215. lst += ccf::GetCCFXmlItem(pkt.fMaxClusterPairHistCorrMajMeasure, "Cluster/MaxClusterPairHistCorrMajMeasure");
  216. lst += ccf::GetCCFXmlItem(pkt.fClusterHistValleyPercentage, "Cluster/ClusterHistValleyPercentage");
  217. lst += ccf::GetCCFXmlItem(pkt.fClusterHistClosePeakPercentage, "Cluster/ClusterHistClosePeakPercentage");
  218. lst += ccf::GetCCFXmlItem(pkt.fClusterHistMinPeakPercentage, "Cluster/ClusterHistMinPeakPercentage");
  219. lst += ccf::GetCCFXmlItem(pkt.nWaveBasisSize, "WaveBasisSize");
  220. lst += ccf::GetCCFXmlItem(pkt.nWaveSampleSize, "WaveSampleSize");
  221. // Now use the list
  222. m_xmlValue = lst;
  223. }
  224. // Author & Date: Ehsan Azar 11 April 2012
  225. // Purpose: CCF XML item constructor
  226. CCFXmlItem::CCFXmlItem(cbPKT_SS_STATUS & pkt, QString strName)
  227. {
  228. m_xmlTag = strName;
  229. m_xmlAttribs.insert("Type", "cbPKT_SS_STATUS");
  230. if (pkt.type == 0)
  231. return;
  232. QVariantList lst;
  233. lst += ccf::GetCCFXmlItem(pkt.chid, "chid");
  234. lst += ccf::GetCCFXmlItem(pkt.type, "type");
  235. lst += ccf::GetCCFXmlItem(pkt.dlen, "dlen");
  236. lst += ccf::GetCCFXmlItem(pkt.cntlUnitStats, "cntlUnitStats");
  237. lst += ccf::GetCCFXmlItem(pkt.cntlNumUnits, "cntlNumUnits");
  238. // Now use the list
  239. m_xmlValue = lst;
  240. }
  241. // Author & Date: Ehsan Azar 11 April 2012
  242. // Purpose: CCF XML item constructor
  243. CCFXmlItem::CCFXmlItem(cbPKT_SYSINFO & pkt, QString strName)
  244. {
  245. m_xmlTag = strName;
  246. m_xmlAttribs.insert("Type", "cbPKT_SYSINFO");
  247. if (pkt.type == 0)
  248. return;
  249. QVariantList lst;
  250. lst += ccf::GetCCFXmlItem(pkt.chid, "chid");
  251. lst += ccf::GetCCFXmlItem(pkt.type, "type");
  252. lst += ccf::GetCCFXmlItem(pkt.dlen, "dlen");
  253. lst += ccf::GetCCFXmlItem(pkt.sysfreq, "sysfreq");
  254. lst += ccf::GetCCFXmlItem(pkt.spikelen, "spike/length");
  255. lst += ccf::GetCCFXmlItem(pkt.spikepre, "spike/pretrigger");
  256. lst += ccf::GetCCFXmlItem(pkt.resetque, "resetque");
  257. lst += ccf::GetCCFXmlItem(pkt.runlevel, "runlevel");
  258. lst += ccf::GetCCFXmlItem(pkt.runflags, "runflags");
  259. // Now use the list
  260. m_xmlValue = lst;
  261. }
  262. // Author & Date: Ehsan Azar 11 April 2012
  263. // Purpose: CCF XML item constructor
  264. CCFXmlItem::CCFXmlItem(cbPKT_NTRODEINFO & pkt, QString strName)
  265. {
  266. m_xmlTag = strName;
  267. pkt.label[cbLEN_STR_LABEL - 1] = 0;
  268. m_xmlAttribs.insert("label", QString(pkt.label));
  269. m_xmlAttribs.insert("Type", "cbPKT_NTRODEINFO");
  270. if (pkt.ntrode == 0)
  271. return;
  272. QVariantList lst;
  273. lst += ccf::GetCCFXmlItem(pkt.chid, "chid");
  274. lst += ccf::GetCCFXmlItem(pkt.type, "type");
  275. lst += ccf::GetCCFXmlItem(pkt.dlen, "dlen");
  276. lst += ccf::GetCCFXmlItem(pkt.ntrode, "ntrode");
  277. lst += ccf::GetCCFXmlItem(pkt.label, cbLEN_STR_LABEL, "label");
  278. lst += ccf::GetCCFXmlItem(pkt.ellipses, cbMAXSITEPLOTS, cbMAXUNITS, "ellipses", "ellipse");
  279. lst += ccf::GetCCFXmlItem(pkt.nSite, "site");
  280. lst += ccf::GetCCFXmlItem(pkt.fs, "featurespace");
  281. lst += ccf::GetCCFXmlItem(pkt.nChan, cbMAXSITES, "chan");
  282. // Now use the list
  283. m_xmlValue = lst;
  284. }
  285. // Author & Date: Ehsan Azar 11 Sept 2012
  286. // Purpose: CCF XML item constructor
  287. CCFXmlItem::CCFXmlItem(cbPKT_LNC & pkt, QString strName)
  288. {
  289. m_xmlTag = strName;
  290. m_xmlAttribs.insert("Type", "cbPKT_LNC");
  291. if (pkt.lncFreq == 0)
  292. return;
  293. QVariantList lst;
  294. lst += ccf::GetCCFXmlItem(pkt.chid, "chid");
  295. lst += ccf::GetCCFXmlItem(pkt.type, "type");
  296. lst += ccf::GetCCFXmlItem(pkt.dlen, "dlen");
  297. lst += ccf::GetCCFXmlItem(pkt.lncFreq, "frequency");
  298. lst += ccf::GetCCFXmlItem(pkt.lncRefChan, "RefChan/RefChan_item");
  299. lst += ccf::GetCCFXmlItem(pkt.lncGlobalMode, "GlobalMode");
  300. // Now use the list
  301. m_xmlValue = lst;
  302. }
  303. // Author & Date: Ehsan Azar 11 Sept 2012
  304. // Purpose: CCF XML item constructor
  305. CCFXmlItem::CCFXmlItem(cbPKT_FILTINFO & pkt, QString strName)
  306. {
  307. m_xmlTag = strName;
  308. pkt.label[cbLEN_STR_LABEL - 1] = 0;
  309. m_xmlAttribs.insert("label", QString(pkt.label));
  310. m_xmlAttribs.insert("Type", "cbPKT_FILTINFO");
  311. if (pkt.type == 0)
  312. return;
  313. QVariantList lst;
  314. lst += ccf::GetCCFXmlItem(pkt.chid, "chid");
  315. lst += ccf::GetCCFXmlItem(pkt.type, "type");
  316. lst += ccf::GetCCFXmlItem(pkt.dlen, "dlen");
  317. lst += ccf::GetCCFXmlItem(pkt.proc, "proc");
  318. lst += ccf::GetCCFXmlItem(pkt.filt, "filter");
  319. lst += ccf::GetCCFXmlItem(pkt.label, cbLEN_STR_LABEL, "label");
  320. lst += ccf::GetCCFXmlItem(pkt.hpfreq, "filterdesc/digfilt/hpfreq");
  321. lst += ccf::GetCCFXmlItem(pkt.hporder, "filterdesc/digfilt/hporder");
  322. lst += ccf::GetCCFXmlItem(pkt.hptype, "filterdesc/digfilt/hptype");
  323. lst += ccf::GetCCFXmlItem(pkt.lpfreq, "filterdesc/digfilt/lpfreq");
  324. lst += ccf::GetCCFXmlItem(pkt.lporder, "filterdesc/digfilt/lporder");
  325. lst += ccf::GetCCFXmlItem(pkt.lptype, "filterdesc/digfilt/lptype");
  326. // Although we can save as an array such as sos[2][2], I do not think that is good idea
  327. // because we never plan to go higher than second-order (already IIR is problematic)
  328. lst += ccf::GetCCFXmlItem(pkt.sos1a1, "filterdesc/digfilt/sos1/a1");
  329. lst += ccf::GetCCFXmlItem(pkt.sos1a2, "filterdesc/digfilt/sos1/a2");
  330. lst += ccf::GetCCFXmlItem(pkt.sos1b1, "filterdesc/digfilt/sos1/b1");
  331. lst += ccf::GetCCFXmlItem(pkt.sos1b2, "filterdesc/digfilt/sos1/b2");
  332. lst += ccf::GetCCFXmlItem(pkt.sos2a1, "filterdesc/digfilt/sos2/a1");
  333. lst += ccf::GetCCFXmlItem(pkt.sos2a2, "filterdesc/digfilt/sos2/a2");
  334. lst += ccf::GetCCFXmlItem(pkt.sos2b1, "filterdesc/digfilt/sos2/b1");
  335. lst += ccf::GetCCFXmlItem(pkt.sos2b2, "filterdesc/digfilt/sos2/b2");
  336. lst += ccf::GetCCFXmlItem(pkt.gain, "filterdesc/digfilt/gain");
  337. // Now use the list
  338. m_xmlValue = lst;
  339. }
  340. // Author & Date: Ehsan Azar 11 Sept 2012
  341. // Purpose: CCF XML item constructor
  342. CCFXmlItem::CCFXmlItem(cbPKT_AOUT_WAVEFORM & pkt, QString strName)
  343. {
  344. m_xmlTag = strName;
  345. m_xmlAttribs.insert("Type", "cbPKT_AOUT_WAVEFORM");
  346. if (pkt.chan == 0)
  347. return;
  348. QVariantList lst;
  349. lst += ccf::GetCCFXmlItem(pkt.chid, "chid");
  350. lst += ccf::GetCCFXmlItem(pkt.type, "type");
  351. lst += ccf::GetCCFXmlItem(pkt.dlen, "dlen");
  352. lst += ccf::GetCCFXmlItem(pkt.chan, "chan");
  353. lst += ccf::GetCCFXmlItem(pkt.repeats, "repeats");
  354. lst += ccf::GetCCFXmlItem(pkt.trig, "trigger/type");
  355. lst += ccf::GetCCFXmlItem(pkt.trigChan, "trigger/channel");
  356. lst += ccf::GetCCFXmlItem(pkt.trigValue, "trigger/value");
  357. lst += ccf::GetCCFXmlItem(pkt.trigNum, "number");
  358. lst += ccf::GetCCFXmlItem(pkt.active, "active");
  359. lst += ccf::GetCCFXmlItem(pkt.mode, "wave/mode");
  360. QVariant var = CCFXmlItem(pkt.wave, pkt.mode, "wave");
  361. lst += var;
  362. // Now use the list
  363. m_xmlValue = lst;
  364. }
  365. // Author & Date: Ehsan Azar 11 April 2012
  366. // Purpose: CCF XML item constructor
  367. CCFXmlItem::CCFXmlItem(cbSCALING & pkt, QString strName)
  368. {
  369. m_xmlTag = strName;
  370. m_xmlAttribs.insert("Type", "cbSCALING");
  371. QVariantList lst;
  372. lst += ccf::GetCCFXmlItem(pkt.digmin, "digmin");
  373. lst += ccf::GetCCFXmlItem(pkt.digmax, "digmax");
  374. lst += ccf::GetCCFXmlItem(pkt.anamin, "anamin");
  375. lst += ccf::GetCCFXmlItem(pkt.anamax, "anamax");
  376. lst += ccf::GetCCFXmlItem(pkt.anagain, "anagain");
  377. lst += ccf::GetCCFXmlItem(pkt.anaunit, cbLEN_STR_UNIT, "anaunit");
  378. // Now use the list
  379. m_xmlValue = lst;
  380. }
  381. // Author & Date: Ehsan Azar 11 April 2012
  382. // Purpose: CCF XML item constructor
  383. CCFXmlItem::CCFXmlItem(cbFILTDESC & pkt, QString strName)
  384. {
  385. m_xmlTag = strName;
  386. m_xmlAttribs.insert("Type", "cbFILTDESC");
  387. QVariantList lst;
  388. lst += ccf::GetCCFXmlItem(pkt.label, cbLEN_STR_FILT_LABEL, "label");
  389. lst += ccf::GetCCFXmlItem(pkt.hpfreq, "hpfreq");
  390. lst += ccf::GetCCFXmlItem(pkt.hporder, "hporder");
  391. lst += ccf::GetCCFXmlItem(pkt.hptype, "hptype");
  392. lst += ccf::GetCCFXmlItem(pkt.lpfreq, "lpfreq");
  393. lst += ccf::GetCCFXmlItem(pkt.lporder, "lporder");
  394. lst += ccf::GetCCFXmlItem(pkt.lptype, "lptype");
  395. // Now use the list
  396. m_xmlValue = lst;
  397. }
  398. // Author & Date: Ehsan Azar 11 April 2012
  399. // Purpose: CCF XML item constructor
  400. CCFXmlItem::CCFXmlItem(cbMANUALUNITMAPPING & pkt, QString strName)
  401. {
  402. m_xmlTag = strName;
  403. m_xmlAttribs.insert("Type", "cbMANUALUNITMAPPING");
  404. QVariantList lst;
  405. lst += ccf::GetCCFXmlItem(pkt.nOverride, "Override");
  406. lst += ccf::GetCCFXmlItem(pkt.afOrigin, 3, "center");
  407. lst += ccf::GetCCFXmlItem(pkt.afShape, 3, 3, "axes", "axis");
  408. lst += ccf::GetCCFXmlItem(pkt.aPhi, "Phi");
  409. lst += ccf::GetCCFXmlItem(pkt.bValid, "Valid");
  410. // Now use the list
  411. m_xmlValue = lst;
  412. }
  413. // Author & Date: Ehsan Azar 11 April 2012
  414. // Purpose: CCF XML item constructor
  415. CCFXmlItem::CCFXmlItem(cbHOOP & pkt, QString strName)
  416. {
  417. m_xmlTag = strName;
  418. m_xmlAttribs.insert("Type", "cbHOOP");
  419. QVariantList lst;
  420. lst += ccf::GetCCFXmlItem(pkt.valid, "valid");
  421. lst += ccf::GetCCFXmlItem(pkt.time, "time");
  422. lst += ccf::GetCCFXmlItem(pkt.min, "min");
  423. lst += ccf::GetCCFXmlItem(pkt.max, "max");
  424. // Now use the list
  425. m_xmlValue = lst;
  426. }
  427. // Author & Date: Ehsan Azar 17 April 2012
  428. // Purpose: CCF XML item constructor
  429. CCFXmlItem::CCFXmlItem(cbAdaptControl & pkt, QString strName)
  430. {
  431. m_xmlTag = strName;
  432. m_xmlAttribs.insert("Type", "cbAdaptControl");
  433. QVariantList lst;
  434. lst += ccf::GetCCFXmlItem(pkt.nMode, "mode");
  435. lst += ccf::GetCCFXmlItem(pkt.fTimeOutMinutes, "TimeOutMinutes");
  436. lst += ccf::GetCCFXmlItem(pkt.fElapsedMinutes, "ElapsedMinutes");
  437. // Now use the list
  438. m_xmlValue = lst;
  439. }
  440. // Author & Date: Ehsan Azar 11 Sept 2012
  441. // Purpose: CCF XML item constructor
  442. CCFXmlItem::CCFXmlItem(cbWaveformData & pkt, uint16_t mode, QString strName)
  443. {
  444. m_xmlTag = strName;
  445. m_xmlAttribs.insert("Type", "cbWaveformData");
  446. if (mode == 0)
  447. return;
  448. QVariantList lst;
  449. lst += ccf::GetCCFXmlItem(pkt.offset, "offset");
  450. if (mode == cbWAVEFORM_MODE_SINE)
  451. {
  452. lst += ccf::GetCCFXmlItem(pkt.sineFrequency, "sine/frequency");
  453. lst += ccf::GetCCFXmlItem(pkt.sineAmplitude, "sine/amplitude");
  454. }
  455. else if (mode == cbWAVEFORM_MODE_PARAMETERS)
  456. {
  457. lst += ccf::GetCCFXmlItem(pkt.seqTotal, "parameters/total");
  458. lst += ccf::GetCCFXmlItem(pkt.seq, "parameters/seq");
  459. lst += ccf::GetCCFXmlItem(pkt.phases, "parameters/phases");
  460. // Partially save these parameters
  461. uint16_t phases = pkt.phases;
  462. if (phases > cbMAX_WAVEFORM_PHASES)
  463. phases = cbMAX_WAVEFORM_PHASES;
  464. lst += ccf::GetCCFXmlItem(pkt.duration, phases, "parameters/duration");
  465. lst += ccf::GetCCFXmlItem(pkt.amplitude, phases, "parameters/amplitude");
  466. // future sequences will go to the parameters<n>
  467. }
  468. // Now use the list
  469. m_xmlValue = lst;
  470. }
  471. // Author & Date: Ehsan Azar 11 April 2012
  472. // Purpose: CCF XML basic number constructor
  473. CCFXmlItem::CCFXmlItem(uint32_t & number, QString strName)
  474. {
  475. m_xmlTag = strName;
  476. m_xmlAttribs.insert("Type", QString("uint32_t"));
  477. m_xmlValue = (uint) number;
  478. }
  479. // Author & Date: Ehsan Azar 11 April 2012
  480. // Purpose: CCF XML basic number constructor
  481. CCFXmlItem::CCFXmlItem(int32_t & number, QString strName)
  482. {
  483. m_xmlTag = strName;
  484. m_xmlAttribs.insert("Type", "int32_t");
  485. m_xmlValue = number;
  486. }
  487. // Author & Date: Ehsan Azar 11 April 2012
  488. // Purpose: CCF XML basic number constructor
  489. CCFXmlItem::CCFXmlItem(uint16_t & number, QString strName)
  490. {
  491. m_xmlTag = strName;
  492. m_xmlAttribs.insert("Type", "uint16_t");
  493. m_xmlValue = number;
  494. }
  495. // Author & Date: Ehsan Azar 11 April 2012
  496. // Purpose: CCF XML basic number constructor
  497. CCFXmlItem::CCFXmlItem(int16_t & number, QString strName)
  498. {
  499. m_xmlTag = strName;
  500. m_xmlAttribs.insert("Type", "int16_t");
  501. m_xmlValue = number;
  502. }
  503. // Author & Date: Ehsan Azar 11 April 2012
  504. // Purpose: CCF XML basic number constructor
  505. CCFXmlItem::CCFXmlItem(uint8_t & number, QString strName)
  506. {
  507. m_xmlTag = strName;
  508. m_xmlAttribs.insert("Type", "uint8_t");
  509. m_xmlValue = number;
  510. }
  511. // Author & Date: Ehsan Azar 11 April 2012
  512. // Purpose: CCF XML basic number constructor
  513. CCFXmlItem::CCFXmlItem(int8_t & number, QString strName)
  514. {
  515. m_xmlTag = strName;
  516. m_xmlAttribs.insert("Type", "int8_t");
  517. m_xmlValue = number;
  518. }
  519. // Author & Date: Ehsan Azar 11 April 2012
  520. // Purpose: CCF XML basic number constructor
  521. CCFXmlItem::CCFXmlItem(float & number, QString strName)
  522. {
  523. m_xmlTag = strName;
  524. m_xmlAttribs.insert("Type", "single");
  525. m_xmlValue = number;
  526. }
  527. // Author & Date: Ehsan Azar 11 April 2012
  528. // Purpose: CCF XML basic number constructor
  529. CCFXmlItem::CCFXmlItem(double & number, QString strName)
  530. {
  531. m_xmlTag = strName;
  532. m_xmlAttribs.insert("Type", "double");
  533. m_xmlValue = number;
  534. }
  535. // Author & Date: Ehsan Azar 16 April 2012
  536. // Purpose: CCF XML basic array constructor
  537. CCFXmlItem::CCFXmlItem(char cstr[], int count, QString strName)
  538. {
  539. m_xmlTag = strName;
  540. m_xmlAttribs.insert("Type", "cstring");
  541. cstr[count - 1] = 0;
  542. m_xmlValue = QString(cstr);
  543. }
  544. // Author & Date: Ehsan Azar 11 April 2012
  545. // Purpose: CCF XML basic number constructor
  546. CCFXmlItem::CCFXmlItem(QVariantList lst, QString strName)
  547. {
  548. m_xmlTag = strName;
  549. m_xmlValue = lst;
  550. }
  551. //------------------------------------------------------------------------------------
  552. // Abstract interface for CCFUtilsXmlItems
  553. //------------------------------------------------------------------------------------
  554. // Author & Date: Ehsan Azar 16 April 2012
  555. // Purpose: Construct basic Xml item aray
  556. template <typename T>
  557. QVariant ccf::GetCCFXmlItem(T & pkt, QString strName)
  558. {
  559. QVariant var = CCFXmlItem(pkt, strName);
  560. return var;
  561. }
  562. // Author & Date: Ehsan Azar 16 April 2012
  563. // Purpose: Construct Xml item aray
  564. // Inputs:
  565. // pkt - array
  566. // count - number of elements
  567. // strName - array name
  568. template <typename T>
  569. QVariant ccf::GetCCFXmlItem(T pkt[], int count, QString strName)
  570. {
  571. QVariantList lst;
  572. for (int i = 0; i < count; ++i)
  573. {
  574. CCFXmlItem item(pkt[i]);
  575. if (item.IsValid())
  576. lst += item;
  577. }
  578. QVariant var = CCFXmlItem(lst, strName);
  579. return var;
  580. }
  581. // Author & Date: Ehsan Azar 16 April 2012
  582. // Purpose: Construct Xml item 2D aray
  583. // Inputs:
  584. // ppkt - pointer to array
  585. // count1 - number of first level elements
  586. // count2 - number of second level elements
  587. // strName1 - first level name
  588. // strName2 - second level name
  589. template <typename T>
  590. QVariant ccf::GetCCFXmlItem(T ppkt[], int count1, int count2, QString strName1, QString strName2)
  591. {
  592. QVariantList sublst;
  593. for (int i = 0; i < count1; ++i)
  594. sublst += ccf::GetCCFXmlItem(ppkt[i], count2, strName2);
  595. QVariant var = CCFXmlItem(sublst, strName1);
  596. return var;
  597. }
  598. // Author & Date: Ehsan Azar 16 April 2012
  599. // Purpose: Construct Xml item character string (specialize array for char type)
  600. template <>
  601. QVariant ccf::GetCCFXmlItem<char>(char pkt[], int count, QString strName)
  602. {
  603. QVariant var = CCFXmlItem(pkt, count, strName);
  604. return var;
  605. }
  606. //------------------------------------------------------------------------------------
  607. // Abstract interface for reading CCFUtilsXmlItems
  608. //------------------------------------------------------------------------------------
  609. // Author & Date: Ehsan Azar 16 April 2012
  610. // Purpose: Read generic version of item
  611. // (item should be something QVariant can parse)
  612. // Inputs:
  613. // xml - the xml file in the item group
  614. // item - item to read
  615. // strName - item name
  616. template <typename T>
  617. void ccf::ReadItem(XmlFile * const xml, T & item)
  618. {
  619. QVariant var = xml->value();
  620. item = var.value<T>();
  621. }
  622. // Author & Date: Ehsan Azar 16 April 2012
  623. // Purpose: Enumerate this version of item
  624. // Inputs:
  625. // xml - the xml file in the item group
  626. // item - item for this version
  627. // Outputs:
  628. // Returns the item number (1-based)
  629. template<>
  630. int ccf::ItemNumber(XmlFile * const xml, cbPKT_CHANINFO & item)
  631. {
  632. ccf::ReadItem(xml, item.chan, "chan");
  633. return item.chan;
  634. }
  635. // Author & Date: Ehsan Azar 16 April 2012
  636. // Purpose: Read this version of item
  637. // Inputs:
  638. // xml - the xml file in the item group
  639. // item - item for this version
  640. template<>
  641. void ccf::ReadItem(XmlFile * const xml, cbPKT_CHANINFO & item)
  642. {
  643. ccf::ReadItem(xml, item.chid, "chid");
  644. ccf::ReadItem(xml, item.type, "type");
  645. ccf::ReadItem(xml, item.dlen, "dlen");
  646. ccf::ReadItem(xml, item.chan, "chan");
  647. ccf::ReadItem(xml, item.proc, "proc");
  648. ccf::ReadItem(xml, item.bank, "bank");
  649. ccf::ReadItem(xml, item.term, "term");
  650. ccf::ReadItem(xml, item.chancaps, "caps/chancaps");
  651. ccf::ReadItem(xml, item.doutcaps, "caps/doutcaps");
  652. ccf::ReadItem(xml, item.dinpcaps, "caps/dinpcaps");
  653. ccf::ReadItem(xml, item.aoutcaps, "caps/aoutcaps");
  654. ccf::ReadItem(xml, item.ainpcaps, "caps/ainpcaps");
  655. ccf::ReadItem(xml, item.spkcaps, "caps/spkcaps");
  656. ccf::ReadItem(xml, item.physcalin, "scale/physcalin");
  657. ccf::ReadItem(xml, item.phyfiltin, "filterdesc/phyfiltin");
  658. ccf::ReadItem(xml, item.physcalout, "scale/physcalout");
  659. ccf::ReadItem(xml, item.phyfiltout, "filterdesc/phyfiltout");
  660. ccf::ReadItem(xml, item.label, cbLEN_STR_LABEL, "label");
  661. ccf::ReadItem(xml, item.userflags, "userflags");
  662. ccf::ReadItem(xml, item.position, 4, "position");
  663. ccf::ReadItem(xml, item.scalin, "scale/scalin");
  664. ccf::ReadItem(xml, item.scalout, "scale/scalout");
  665. ccf::ReadItem(xml, item.doutopts, "options/doutopts");
  666. ccf::ReadItem(xml, item.dinpopts, "options/dinpopts");
  667. ccf::ReadItem(xml, item.aoutopts, "options/aoutopts");
  668. ccf::ReadItem(xml, item.eopchar, "eopchar");
  669. { // For union we recoord the most informative one
  670. ccf::ReadItem(xml, item.lowsamples, "monitor/lowsamples");
  671. ccf::ReadItem(xml, item.highsamples, "monitor/highsamples");
  672. ccf::ReadItem(xml, item.offset, "monitor/offset");
  673. }
  674. ccf::ReadItem(xml, item.ainpopts, "options/ainpopts");
  675. ccf::ReadItem(xml, item.lncrate, "lnc/rate");
  676. ccf::ReadItem(xml, item.smpfilter, "sample/filter");
  677. ccf::ReadItem(xml, item.smpgroup, "sample/group");
  678. ccf::ReadItem(xml, item.smpdispmin, "sample/dispmin");
  679. ccf::ReadItem(xml, item.smpdispmax, "sample/dispmax");
  680. ccf::ReadItem(xml, item.spkfilter, "spike/filter");
  681. ccf::ReadItem(xml, item.spkdispmax, "spike/dispmax");
  682. ccf::ReadItem(xml, item.lncdispmax, "lnc/dispmax");
  683. ccf::ReadItem(xml, item.spkopts, "options/spkopts");
  684. ccf::ReadItem(xml, item.spkthrlevel, "spike/threshold/level");
  685. ccf::ReadItem(xml, item.spkthrlimit, "spike/threshold/limit");
  686. ccf::ReadItem(xml, item.spkgroup, "spike/group");
  687. ccf::ReadItem(xml, item.amplrejpos, "spike/amplituderejecet/positive");
  688. ccf::ReadItem(xml, item.amplrejneg, "spike/amplituderejecet/negative");
  689. ccf::ReadItem(xml, item.refelecchan, "refelecchan");
  690. ccf::ReadItem(xml, item.unitmapping, cbMAXUNITS, "unitmapping");
  691. ccf::ReadItem(xml, item.spkhoops, cbMAXUNITS, cbMAXHOOPS, "spike/hoops");
  692. ccf::ReadItem(xml, item.trigtype, "douttrig/type");
  693. ccf::ReadItem(xml, item.trigchan, "douttrig/chan");
  694. ccf::ReadItem(xml, item.trigval, "douttrig/val");
  695. }
  696. // Author & Date: Ehsan Azar 16 April 2012
  697. // Purpose: Read this version of item
  698. // Inputs:
  699. // xml - the xml file in the item group
  700. // item - item for this version
  701. template<>
  702. void ccf::ReadItem(XmlFile * const xml, cbPKT_ADAPTFILTINFO & item)
  703. {
  704. ccf::ReadItem(xml, item.chid, "chid");
  705. ccf::ReadItem(xml, item.type, "type");
  706. ccf::ReadItem(xml, item.dlen, "dlen");
  707. ccf::ReadItem(xml, item.chan, "chan");
  708. ccf::ReadItem(xml, item.nMode, "mode");
  709. ccf::ReadItem(xml, item.dLearningRate, "LearningRate");
  710. ccf::ReadItem(xml, item.nRefChan1, "RefChan/RefChan_item");
  711. ccf::ReadItem(xml, item.nRefChan2, "RefChan/RefChan_item<1>");
  712. }
  713. // Author & Date: Ehsan Azar 16 April 2012
  714. // Purpose: Read this version of item
  715. // Inputs:
  716. // xml - the xml file in the item group
  717. // item - item for this version
  718. template<>
  719. void ccf::ReadItem(XmlFile * const xml, cbPKT_SS_DETECT & item)
  720. {
  721. ccf::ReadItem(xml, item.chid, "chid");
  722. ccf::ReadItem(xml, item.type, "type");
  723. ccf::ReadItem(xml, item.dlen, "dlen");
  724. ccf::ReadItem(xml, item.fThreshold, "Threshold");
  725. ccf::ReadItem(xml, item.fMultiplier, "Multiplier");
  726. }
  727. // Author & Date: Ehsan Azar 16 April 2012
  728. // Purpose: Read this version of item
  729. // Inputs:
  730. // xml - the xml file in the item group
  731. // item - item for this version
  732. template<>
  733. void ccf::ReadItem(XmlFile * const xml, cbPKT_SS_ARTIF_REJECT & item)
  734. {
  735. ccf::ReadItem(xml, item.chid, "chid");
  736. ccf::ReadItem(xml, item.type, "type");
  737. ccf::ReadItem(xml, item.dlen, "dlen");
  738. ccf::ReadItem(xml, item.nMaxSimulChans, "MaxSimulChans");
  739. ccf::ReadItem(xml, item.nRefractoryCount, "RefractoryCount");
  740. }
  741. // Author & Date: Ehsan Azar 16 April 2012
  742. // Purpose: Enumerate this version of item
  743. // Inputs:
  744. // xml - the xml file in the item group
  745. // item - item for this version
  746. // Outputs:
  747. // Returns the item number (1-based)
  748. template<>
  749. int ccf::ItemNumber(XmlFile * const xml, cbPKT_SS_NOISE_BOUNDARY & item)
  750. {
  751. ccf::ReadItem(xml, item.chan, "chan");
  752. return item.chan;
  753. }
  754. // Author & Date: Ehsan Azar 16 April 2012
  755. // Purpose: Read this version of item
  756. // Inputs:
  757. // xml - the xml file in the item group
  758. // item - item for this version
  759. template<>
  760. void ccf::ReadItem(XmlFile * const xml, cbPKT_SS_NOISE_BOUNDARY & item)
  761. {
  762. ccf::ReadItem(xml, item.chid, "chid");
  763. ccf::ReadItem(xml, item.type, "type");
  764. ccf::ReadItem(xml, item.dlen, "dlen");
  765. ccf::ReadItem(xml, item.chan, "chan");
  766. ccf::ReadItem(xml, item.afc, 3, "center");
  767. ccf::ReadItem(xml, item.afS, 3, 3, "axes");
  768. }
  769. // Author & Date: Ehsan Azar 16 April 2012
  770. // Purpose: Read this version of item
  771. // Inputs:
  772. // xml - the xml file in the item group
  773. // item - item for this version
  774. template<>
  775. void ccf::ReadItem(XmlFile * const xml, cbPKT_SS_STATISTICS & item)
  776. {
  777. ccf::ReadItem(xml, item.chid, "chid");
  778. ccf::ReadItem(xml, item.type, "type");
  779. ccf::ReadItem(xml, item.dlen, "dlen");
  780. ccf::ReadItem(xml, item.nUpdateSpikes, "UpdateSpikes");
  781. ccf::ReadItem(xml, item.nAutoalg, "Autoalg");
  782. ccf::ReadItem(xml, item.nMode, "mode");
  783. ccf::ReadItem(xml, item.fMinClusterPairSpreadFactor, "Cluster/MinClusterPairSpreadFactor");
  784. ccf::ReadItem(xml, item.fMaxSubclusterSpreadFactor, "Cluster/MaxSubclusterSpreadFactor");
  785. ccf::ReadItem(xml, item.fMinClusterHistCorrMajMeasure, "Cluster/MinClusterHistCorrMajMeasure");
  786. ccf::ReadItem(xml, item.fMaxClusterPairHistCorrMajMeasure, "Cluster/MaxClusterPairHistCorrMajMeasure");
  787. ccf::ReadItem(xml, item.fClusterHistValleyPercentage, "Cluster/ClusterHistValleyPercentage");
  788. ccf::ReadItem(xml, item.fClusterHistClosePeakPercentage, "Cluster/ClusterHistClosePeakPercentage");
  789. ccf::ReadItem(xml, item.fClusterHistMinPeakPercentage, "Cluster/ClusterHistMinPeakPercentage");
  790. ccf::ReadItem(xml, item.nWaveBasisSize, "WaveBasisSize");
  791. ccf::ReadItem(xml, item.nWaveSampleSize, "WaveSampleSize");
  792. }
  793. // Author & Date: Ehsan Azar 16 April 2012
  794. // Purpose: Read this version of item
  795. // Inputs:
  796. // xml - the xml file in the item group
  797. // item - item for this version
  798. template<>
  799. void ccf::ReadItem(XmlFile * const xml, cbPKT_SS_STATUS & item)
  800. {
  801. ccf::ReadItem(xml, item.chid, "chid");
  802. ccf::ReadItem(xml, item.type, "type");
  803. ccf::ReadItem(xml, item.dlen, "dlen");
  804. ccf::ReadItem(xml, item.cntlUnitStats, "cntlUnitStats");
  805. ccf::ReadItem(xml, item.cntlNumUnits, "cntlNumUnits");
  806. }
  807. // Author & Date: Ehsan Azar 16 April 2012
  808. // Purpose: Read this version of item
  809. // Inputs:
  810. // xml - the xml file in the item group
  811. // item - item for this version
  812. template<>
  813. void ccf::ReadItem(XmlFile * const xml, cbPKT_SYSINFO & item)
  814. {
  815. ccf::ReadItem(xml, item.chid, "chid");
  816. ccf::ReadItem(xml, item.type, "type");
  817. ccf::ReadItem(xml, item.dlen, "dlen");
  818. ccf::ReadItem(xml, item.sysfreq, "sysfreq");
  819. ccf::ReadItem(xml, item.spikelen, "spike/length");
  820. ccf::ReadItem(xml, item.spikepre, "spike/pretrigger");
  821. ccf::ReadItem(xml, item.resetque, "resetque");
  822. ccf::ReadItem(xml, item.runlevel, "runlevel");
  823. ccf::ReadItem(xml, item.runflags, "runflags");
  824. }
  825. // Author & Date: Ehsan Azar 16 April 2012
  826. // Purpose: Enumerate this version of item
  827. // Inputs:
  828. // xml - the xml file in the item group
  829. // item - item for this version
  830. // Outputs:
  831. // Returns the item number (1-based)
  832. template<>
  833. int ccf::ItemNumber(XmlFile * const xml, cbPKT_NTRODEINFO & item)
  834. {
  835. ccf::ReadItem(xml, item.ntrode, "ntrode");
  836. return item.ntrode;
  837. }
  838. // Author & Date: Ehsan Azar 16 April 2012
  839. // Purpose: Read this version of item
  840. // Inputs:
  841. // xml - the xml file in the item group
  842. // item - item for this version
  843. template<>
  844. void ccf::ReadItem(XmlFile * const xml, cbPKT_NTRODEINFO & item)
  845. {
  846. ccf::ReadItem(xml, item.chid, "chid");
  847. ccf::ReadItem(xml, item.type, "type");
  848. ccf::ReadItem(xml, item.dlen, "dlen");
  849. ccf::ReadItem(xml, item.ntrode, "ntrode");
  850. ccf::ReadItem(xml, item.label, cbLEN_STR_LABEL, "label");
  851. ccf::ReadItem(xml, item.ellipses, cbMAXSITEPLOTS, cbMAXUNITS, "ellipses");
  852. ccf::ReadItem(xml, item.nSite, "site");
  853. ccf::ReadItem(xml, item.fs, "featurespace");
  854. ccf::ReadItem(xml, item.nChan, cbMAXSITES, "chan");
  855. }
  856. // Author & Date: Ehsan Azar 11 Sept 2012
  857. // Purpose: Read this version of item
  858. // Inputs:
  859. // xml - the xml file in the item group
  860. // item - item for this version
  861. template<>
  862. void ccf::ReadItem(XmlFile * const xml, cbPKT_LNC & item)
  863. {
  864. ccf::ReadItem(xml, item.chid, "chid");
  865. ccf::ReadItem(xml, item.type, "type");
  866. ccf::ReadItem(xml, item.dlen, "dlen");
  867. ccf::ReadItem(xml, item.lncFreq, "frequency");
  868. ccf::ReadItem(xml, item.lncRefChan, "RefChan/RefChan_item");
  869. ccf::ReadItem(xml, item.lncGlobalMode, "GlobalMode");
  870. }
  871. // Author & Date: Ehsan Azar 11 Sept 2012
  872. // Purpose: Read this version of item
  873. // Inputs:
  874. // xml - the xml file in the item group
  875. // item - item for this version
  876. template<>
  877. void ccf::ReadItem(XmlFile * const xml, cbPKT_FILTINFO & item)
  878. {
  879. ccf::ReadItem(xml, item.chid, "chid");
  880. ccf::ReadItem(xml, item.type, "type");
  881. ccf::ReadItem(xml, item.dlen, "dlen");
  882. ccf::ReadItem(xml, item.proc, "proc");
  883. ccf::ReadItem(xml, item.filt, "filter");
  884. ccf::ReadItem(xml, item.label, cbLEN_STR_LABEL, "label");
  885. ccf::ReadItem(xml, item.hpfreq, "filterdesc/digfilt/hpfreq");
  886. ccf::ReadItem(xml, item.hporder, "filterdesc/digfilt/hporder");
  887. ccf::ReadItem(xml, item.hptype, "filterdesc/digfilt/hptype");
  888. ccf::ReadItem(xml, item.lpfreq, "filterdesc/digfilt/lpfreq");
  889. ccf::ReadItem(xml, item.lporder, "filterdesc/digfilt/lporder");
  890. ccf::ReadItem(xml, item.lptype, "filterdesc/digfilt/lptype");
  891. ccf::ReadItem(xml, item.sos1a1, "filterdesc/digfilt/sos1/a1");
  892. ccf::ReadItem(xml, item.sos1a2, "filterdesc/digfilt/sos1/a2");
  893. ccf::ReadItem(xml, item.sos1b1, "filterdesc/digfilt/sos1/b1");
  894. ccf::ReadItem(xml, item.sos1b2, "filterdesc/digfilt/sos1/b2");
  895. ccf::ReadItem(xml, item.sos2a1, "filterdesc/digfilt/sos2/a1");
  896. ccf::ReadItem(xml, item.sos2a2, "filterdesc/digfilt/sos2/a2");
  897. ccf::ReadItem(xml, item.sos2b1, "filterdesc/digfilt/sos2/b1");
  898. ccf::ReadItem(xml, item.sos2b2, "filterdesc/digfilt/sos2/b2");
  899. ccf::ReadItem(xml, item.gain, "filterdesc/digfilt/gain");
  900. }
  901. // Author & Date: Ehsan Azar 12 Sept 2012
  902. // Purpose: Enumerate this version of item
  903. // Inputs:
  904. // xml - the xml file in the item group
  905. // item - item for this version
  906. // Outputs:
  907. // Returns the item number (1-based)
  908. template<>
  909. int ccf::ItemNumber(XmlFile * const xml, cbPKT_AOUT_WAVEFORM & item)
  910. {
  911. ccf::ReadItem(xml, item.trigNum, "number");
  912. if (item.trigNum < cbMAX_AOUT_TRIGGER)
  913. {
  914. return (item.trigNum + 1);
  915. }
  916. // return zero means invalid
  917. return 0;
  918. }
  919. // Author & Date: Ehsan Azar 11 Sept 2012
  920. // Purpose: Read this version of item
  921. // Inputs:
  922. // xml - the xml file in the item group
  923. // item - item for this version
  924. template<>
  925. void ccf::ReadItem(XmlFile * const xml, cbPKT_AOUT_WAVEFORM & item)
  926. {
  927. ccf::ReadItem(xml, item.chid, "chid");
  928. ccf::ReadItem(xml, item.type, "type");
  929. ccf::ReadItem(xml, item.dlen, "dlen");
  930. ccf::ReadItem(xml, item.chan, "chan");
  931. ccf::ReadItem(xml, item.mode, "wave/mode");
  932. ccf::ReadItem(xml, item.repeats, "repeats");
  933. ccf::ReadItem(xml, item.trig, "trigger/type");
  934. ccf::ReadItem(xml, item.trigChan, "trigger/channel");
  935. ccf::ReadItem(xml, item.trigValue, "trigger/value");
  936. ccf::ReadItem(xml, item.trigNum, "number");
  937. ccf::ReadItem(xml, item.active, "active");
  938. ccf::ReadItem(xml, item.wave, "wave");
  939. }
  940. // Author & Date: Ehsan Azar 16 April 2012
  941. // Purpose: Read this version of item
  942. // Inputs:
  943. // xml - the xml file in the item group
  944. // item - item for this version
  945. template<>
  946. void ccf::ReadItem(XmlFile * const xml, cbSCALING & item)
  947. {
  948. ccf::ReadItem(xml, item.digmin, "digmin");
  949. ccf::ReadItem(xml, item.digmax, "digmax");
  950. ccf::ReadItem(xml, item.anamin, "anamin");
  951. ccf::ReadItem(xml, item.anamax, "anamax");
  952. ccf::ReadItem(xml, item.anagain, "anagain");
  953. ccf::ReadItem(xml, item.anaunit, cbLEN_STR_UNIT, "anaunit");
  954. }
  955. // Author & Date: Ehsan Azar 16 April 2012
  956. // Purpose: Read this version of item
  957. // Inputs:
  958. // xml - the xml file in the item group
  959. // item - item for this version
  960. template<>
  961. void ccf::ReadItem(XmlFile * const xml, cbFILTDESC & item)
  962. {
  963. ccf::ReadItem(xml, item.label, cbLEN_STR_FILT_LABEL, "label");
  964. ccf::ReadItem(xml, item.hpfreq, "hpfreq");
  965. ccf::ReadItem(xml, item.hporder, "hporder");
  966. ccf::ReadItem(xml, item.hptype, "hptype");
  967. ccf::ReadItem(xml, item.lpfreq, "lpfreq");
  968. ccf::ReadItem(xml, item.lporder, "lporder");
  969. ccf::ReadItem(xml, item.lptype, "lptype");
  970. }
  971. // Author & Date: Ehsan Azar 16 April 2012
  972. // Purpose: Read this version of item
  973. // Inputs:
  974. // xml - the xml file in the item group
  975. // item - item for this version
  976. template<>
  977. void ccf::ReadItem(XmlFile * const xml, cbMANUALUNITMAPPING & item)
  978. {
  979. ccf::ReadItem(xml, item.nOverride, "Override");
  980. ccf::ReadItem(xml, item.afOrigin, 3, "center");
  981. ccf::ReadItem(xml, item.afShape, 3, 3, "axes");
  982. ccf::ReadItem(xml, item.aPhi, "Phi");
  983. ccf::ReadItem(xml, item.bValid, "Valid");
  984. }
  985. // Author & Date: Ehsan Azar 16 April 2012
  986. // Purpose: Read this version of item
  987. // Inputs:
  988. // xml - the xml file in the item group
  989. // item - item for this version
  990. template<>
  991. void ccf::ReadItem(XmlFile * const xml, cbHOOP & item)
  992. {
  993. ccf::ReadItem(xml, item.valid, "valid");
  994. ccf::ReadItem(xml, item.time, "time");
  995. ccf::ReadItem(xml, item.min, "min");
  996. ccf::ReadItem(xml, item.max, "max");
  997. }
  998. // Author & Date: Ehsan Azar 16 April 2012
  999. // Purpose: Read this version of item
  1000. // Inputs:
  1001. // xml - the xml file in the item group
  1002. // item - item for this version
  1003. template<>
  1004. void ccf::ReadItem(XmlFile * const xml, cbAdaptControl & item)
  1005. {
  1006. ccf::ReadItem(xml, item.nMode, "mode");
  1007. ccf::ReadItem(xml, item.fTimeOutMinutes, "TimeOutMinutes");
  1008. ccf::ReadItem(xml, item.fElapsedMinutes, "ElapsedMinutes");
  1009. }
  1010. // Author & Date: Ehsan Azar 11 Sept 2012
  1011. // Purpose: Read this version of item
  1012. // Inputs:
  1013. // xml - the xml file in the item group
  1014. // item - item for this version
  1015. template<>
  1016. void ccf::ReadItem(XmlFile * const xml, cbWaveformData & item)
  1017. {
  1018. uint16_t mode = 0;
  1019. ccf::ReadItem(xml, item.offset, "offset");
  1020. ccf::ReadItem(xml, mode, "mode");
  1021. if (mode == cbWAVEFORM_MODE_SINE)
  1022. {
  1023. ccf::ReadItem(xml, item.sineFrequency, "sine/frequency");
  1024. ccf::ReadItem(xml, item.sineAmplitude, "sine/amplitude");
  1025. }
  1026. else if (mode == cbWAVEFORM_MODE_PARAMETERS)
  1027. {
  1028. ccf::ReadItem(xml, item.seqTotal, "parameters/total");
  1029. ccf::ReadItem(xml, item.seq, "parameters/seq");
  1030. ccf::ReadItem(xml, item.phases, "parameters/phases");
  1031. // No need to try to partially read, it will already ignore if some data is missing
  1032. ccf::ReadItem(xml, item.duration, cbMAX_WAVEFORM_PHASES, "parameters/duration");
  1033. ccf::ReadItem(xml, item.amplitude, cbMAX_WAVEFORM_PHASES, "parameters/amplitude");
  1034. }
  1035. }
  1036. // Author & Date: Ehsan Azar 16 April 2012
  1037. // Purpose: Read array of items
  1038. // Inputs:
  1039. // xml - the xml file in the item group
  1040. // item - array of items
  1041. template <typename T>
  1042. void ccf::ReadItem(XmlFile * const xml, T item[], int count)
  1043. {
  1044. QMap<QString, int> mapItemCount;
  1045. int subcount = 0;
  1046. QStringList lst = xml->childKeys();
  1047. for (int i = 0; i < lst.count(); ++i)
  1048. {
  1049. QString strSubKey = lst.at(i);
  1050. subcount = mapItemCount[strSubKey];
  1051. mapItemCount[strSubKey] = subcount + 1;
  1052. if (subcount)
  1053. strSubKey = strSubKey + QString("<%1>").arg(subcount);
  1054. T tmp;
  1055. // Initialize with possible item
  1056. int num = ItemNumber(xml, tmp, strSubKey);
  1057. if (num == 0 && i < count)
  1058. num = i;
  1059. else
  1060. num--; // Make it 0-baed
  1061. if (num < count)
  1062. {
  1063. tmp = item[num];
  1064. ReadItem(xml, tmp, strSubKey);
  1065. item[num] = tmp;
  1066. }
  1067. }
  1068. }
  1069. // Author & Date: Ehsan Azar 16 April 2012
  1070. // Purpose: Read generic version of cstring item
  1071. // Inputs:
  1072. // xml - the xml file in the item group
  1073. // item - cstring item to load
  1074. // count - cstring length
  1075. template<>
  1076. void ccf::ReadItem(XmlFile * const xml, char item[], int count)
  1077. {
  1078. QString var = xml->value().toString();
  1079. strncpy(item, var.toLatin1().constData(), count);
  1080. item[count - 1] = 0;
  1081. }
  1082. // Author & Date: Ehsan Azar 16 April 2012
  1083. // Purpose: Read array of items
  1084. // Inputs:
  1085. // xml - the xml file in the item group
  1086. // item - array of items
  1087. template <typename T>
  1088. void ccf::ReadItem(XmlFile * const xml, T item[], int count, QString strName)
  1089. {
  1090. if (!xml->beginGroup(strName))
  1091. ReadItem(xml, item, count);
  1092. xml->endGroup();
  1093. }
  1094. // Author & Date: Ehsan Azar 16 April 2012
  1095. // Purpose: Read 2D array of items
  1096. // Inputs:
  1097. // xml - the xml file in the item group
  1098. // pItem - array of items
  1099. template <typename T>
  1100. void ccf::ReadItem(XmlFile * const xml, T pItem[], int count1, int count2, QString strName)
  1101. {
  1102. if (!xml->beginGroup(strName))
  1103. {
  1104. QMap<QString, int> mapItemCount;
  1105. int subcount = 0;
  1106. QStringList lst = xml->childKeys();
  1107. count1 = std::min(lst.count(), count1);
  1108. for (int i = 0; i < count1; ++i)
  1109. {
  1110. QString strSubKey = lst.at(i);
  1111. subcount = mapItemCount[strSubKey];
  1112. mapItemCount[strSubKey] = subcount + 1;
  1113. if (subcount)
  1114. strSubKey = strSubKey + QString("<%1>").arg(subcount);
  1115. ReadItem(xml, pItem[i], count2, strSubKey);
  1116. }
  1117. }
  1118. xml->endGroup();
  1119. }
  1120. // Author & Date: Ehsan Azar 16 April 2012
  1121. // Purpose: Read generic version of item
  1122. // Inputs:
  1123. // xml - the xml file in the item group
  1124. // item - item to read
  1125. // strName - item name
  1126. template <typename T>
  1127. void ccf::ReadItem(XmlFile * const xml, T & item, QString strName)
  1128. {
  1129. if (!xml->beginGroup(strName))
  1130. ReadItem(xml, item);
  1131. xml->endGroup();
  1132. }
  1133. // Author & Date: Ehsan Azar 16 April 2012
  1134. // Purpose: Enumerate this version of item
  1135. // Inputs:
  1136. // xml - the xml file in the item group
  1137. // item - item for this version
  1138. // strName - item name to navigaet to
  1139. // Outputs:
  1140. // Returns the item number (1-based)
  1141. template<typename T>
  1142. int ccf::ItemNumber(XmlFile * const xml, T & item, QString strName)
  1143. {
  1144. int res = 0;
  1145. if (!xml->beginGroup(strName))
  1146. res = ItemNumber(xml, item);
  1147. xml->endGroup();
  1148. return res;
  1149. }
  1150. // Author & Date: Ehsan Azar 16 April 2012
  1151. // Purpose: Enumerate this version of item
  1152. // Inputs:
  1153. // xml - the xml file in the item group
  1154. // item - item for this version
  1155. // Outputs:
  1156. // Returns the item number (1-based)
  1157. template<typename T>
  1158. int ccf::ItemNumber(XmlFile * const xml, T & item)
  1159. {
  1160. // Any item that is not specialized cannot be enumerated
  1161. return 0;
  1162. }
  1163. // For link to proceed here we have to mention possible template types if not used in this unit
  1164. template QVariant ccf::GetCCFXmlItem<cbPKT_ADAPTFILTINFO>(cbPKT_ADAPTFILTINFO&, QString);
  1165. template QVariant ccf::GetCCFXmlItem<cbPKT_SYSINFO>(cbPKT_SYSINFO&, QString);
  1166. template QVariant ccf::GetCCFXmlItem<cbPKT_SS_STATUS>(cbPKT_SS_STATUS&, QString);
  1167. template QVariant ccf::GetCCFXmlItem<cbPKT_SS_ARTIF_REJECT>(cbPKT_SS_ARTIF_REJECT&, QString);
  1168. template QVariant ccf::GetCCFXmlItem<cbPKT_SS_DETECT>(cbPKT_SS_DETECT&, QString);
  1169. template QVariant ccf::GetCCFXmlItem<cbPKT_SS_STATISTICS>(cbPKT_SS_STATISTICS&, QString);
  1170. template QVariant ccf::GetCCFXmlItem<cbPKT_LNC>(cbPKT_LNC&, QString);
  1171. template QVariant ccf::GetCCFXmlItem<cbPKT_FILTINFO>(cbPKT_FILTINFO&, QString);
  1172. template QVariant ccf::GetCCFXmlItem<cbPKT_AOUT_WAVEFORM>(cbPKT_AOUT_WAVEFORM&, QString);
  1173. template QVariant ccf::GetCCFXmlItem<cbPKT_CHANINFO>(cbPKT_CHANINFO * const, int, QString);
  1174. template QVariant ccf::GetCCFXmlItem<cbPKT_NTRODEINFO>(cbPKT_NTRODEINFO * const, int, QString);
  1175. template QVariant ccf::GetCCFXmlItem<cbPKT_SS_NOISE_BOUNDARY>(cbPKT_SS_NOISE_BOUNDARY * const, int, QString);
  1176. template QVariant ccf::GetCCFXmlItem<cbPKT_FILTINFO>(cbPKT_FILTINFO * const, int, QString);
  1177. template QVariant ccf::GetCCFXmlItem<cbPKT_AOUT_WAVEFORM[cbMAX_AOUT_TRIGGER]>(cbPKT_AOUT_WAVEFORM (* const)[cbMAX_AOUT_TRIGGER], int, int, QString, QString);
  1178. // For link to proceed here we have to mention possible template types if not used in this unit
  1179. template void ccf::ReadItem<cbPKT_ADAPTFILTINFO>(XmlFile * const, cbPKT_ADAPTFILTINFO &, QString);
  1180. template void ccf::ReadItem<cbPKT_SYSINFO>(XmlFile * const, cbPKT_SYSINFO &, QString);
  1181. template void ccf::ReadItem<cbPKT_SS_STATUS>(XmlFile * const, cbPKT_SS_STATUS &, QString);
  1182. template void ccf::ReadItem<cbPKT_SS_ARTIF_REJECT>(XmlFile * const, cbPKT_SS_ARTIF_REJECT &, QString);
  1183. template void ccf::ReadItem<cbPKT_SS_DETECT>(XmlFile * const, cbPKT_SS_DETECT &, QString);
  1184. template void ccf::ReadItem<cbPKT_SS_STATISTICS>(XmlFile * const, cbPKT_SS_STATISTICS &, QString);
  1185. template void ccf::ReadItem<cbPKT_LNC>(XmlFile * const, cbPKT_LNC &, QString);
  1186. template void ccf::ReadItem<cbPKT_FILTINFO>(XmlFile * const, cbPKT_FILTINFO &, QString);
  1187. template void ccf::ReadItem<cbPKT_AOUT_WAVEFORM>(XmlFile * const, cbPKT_AOUT_WAVEFORM &, QString);
  1188. template void ccf::ReadItem<cbPKT_CHANINFO>(XmlFile * const, cbPKT_CHANINFO * const, int, QString);
  1189. template void ccf::ReadItem<cbPKT_NTRODEINFO>(XmlFile * const, cbPKT_NTRODEINFO * const, int, QString);
  1190. template void ccf::ReadItem<cbPKT_SS_NOISE_BOUNDARY>(XmlFile * const, cbPKT_SS_NOISE_BOUNDARY * const, int, QString);
  1191. template void ccf::ReadItem<cbPKT_FILTINFO>(XmlFile * const, cbPKT_FILTINFO * const, int, QString);
  1192. template void ccf::ReadItem<cbPKT_AOUT_WAVEFORM[cbMAX_AOUT_TRIGGER]>(XmlFile * const, cbPKT_AOUT_WAVEFORM (* const)[cbMAX_AOUT_TRIGGER], int, int, QString);