00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef SST_INFO_H
00014 #define SST_INFO_H
00015
00016 namespace SST {
00017
00018
00019 #define CFG_OUTPUTHUMAN 0x00000001
00020 #define CFG_OUTPUTXML 0x00000002
00021
00022
00023
00024
00025
00026
00027
00028 class SSTInfoConfig {
00029 public:
00030
00031 SSTInfoConfig();
00032 ~SSTInfoConfig();
00033
00034
00035
00036
00037
00038 int parseCmdLine(int argc, char* argv[]);
00039
00040
00041 std::vector<std::string>* getElementsToProcessArray() {return &m_elementsToProcess;}
00042
00043
00044 std::vector<std::string>* getFilteredElementNamesArray() {return &m_filteredElementNames;}
00045
00046
00047 std::vector<std::string>* getFilteredElementComponentNamesArray() {return &m_filteredElementComponentNames;}
00048
00049
00050 unsigned int getOptionBits() {return m_optionBits;}
00051
00052
00053 std::string& getXMLFilePath() {return m_XMLFilePath;}
00054
00055 private:
00056 void outputUsage();
00057 void outputVersion();
00058
00059 private:
00060 char* m_AppName;
00061 boost::program_options::options_description* m_configDesc;
00062 boost::program_options::options_description* m_hiddenDesc;
00063 boost::program_options::positional_options_description* m_posDesc;
00064 boost::program_options::variables_map* m_vm;
00065
00066 std::vector<std::string> m_elementsToProcess;
00067 std::vector<std::string> m_filteredElementNames;
00068 std::vector<std::string> m_filteredElementComponentNames;
00069 unsigned int m_optionBits;
00070 std::string m_XMLFilePath;
00071 };
00072
00073
00074
00075
00076
00077
00078
00079 class SSTInfoElement_ParamInfo {
00080 public:
00081
00082
00083
00084 SSTInfoElement_ParamInfo(const ElementInfoParam* elparam)
00085 {
00086
00087 m_elparam = elparam;
00088 }
00089
00090
00091 const char* getName() {return m_elparam->name;}
00092
00093
00094 const char* getDesc() {return m_elparam->description;}
00095
00096
00097 const char* getDefault() {return (m_elparam->defaultValue) ? m_elparam->defaultValue : "REQUIRED";}
00098
00099
00100
00101
00102 void outputParameterInfo(int Index);
00103
00104
00105
00106
00107
00108 void generateParameterInfoXMLData(int Index, TiXmlNode* XMLParentElement);
00109
00110 private:
00111 const ElementInfoParam* m_elparam;
00112 };
00113
00114 void PopulateParams(const ElementInfoParam* ptrParams, std::vector<SSTInfoElement_ParamInfo*>* ptrParamArray)
00115 {
00116
00117 if (NULL != ptrParams) {
00118 while (NULL != ptrParams->name) {
00119
00120 SSTInfoElement_ParamInfo* ptrParamInfo = new SSTInfoElement_ParamInfo(ptrParams);
00121 ptrParamArray->push_back(ptrParamInfo);
00122
00123
00124 ptrParams++;
00125 }
00126 }
00127 }
00128
00129
00130
00131
00132
00133
00134
00135 class SSTInfoElement_PortInfo {
00136 public:
00137
00138
00139
00140 SSTInfoElement_PortInfo(const ElementInfoPort* elport)
00141 {
00142
00143 m_numValidEvents = 0;
00144 m_elport = elport;
00145
00146 analyzeValidEventsArray();
00147 }
00148
00149
00150 const char* getName() {return m_elport->name;}
00151
00152
00153 const char* getDesc() {return m_elport->description;}
00154
00155
00156 const char** getValidEvents() {return m_elport->validEvents;}
00157
00158
00159 int getNumberOfValidEvents() {return m_numValidEvents;}
00160
00161
00162
00163
00164 const char* getValidEvent(unsigned int index);
00165
00166
00167
00168
00169 void outputPortInfo(int Index);
00170
00171
00172
00173
00174
00175 void generatePortInfoXMLData(int Index, TiXmlNode* XMLParentElement);
00176
00177 private:
00178 void analyzeValidEventsArray();
00179
00180 const ElementInfoPort* m_elport;
00181 unsigned int m_numValidEvents;
00182 };
00183
00184 void PopulatePorts(const ElementInfoPort* ptrPorts, std::vector<SSTInfoElement_PortInfo*>* ptrPortArray)
00185 {
00186
00187 if (NULL != ptrPorts) {
00188 while (NULL != ptrPorts->name) {
00189
00190 SSTInfoElement_PortInfo* ptrPortInfo = new SSTInfoElement_PortInfo(ptrPorts);
00191 ptrPortArray->push_back(ptrPortInfo);
00192
00193
00194 ptrPorts++;
00195 }
00196 }
00197 }
00198
00199
00200
00201
00202
00203
00204
00205 class SSTInfoElement_StatisticInfo {
00206 public:
00207
00208
00209
00210 SSTInfoElement_StatisticInfo(const ElementInfoStatistic* elstat)
00211 {
00212
00213 m_elstat = elstat;
00214 }
00215
00216
00217 const char* getName() {return m_elstat->name;}
00218
00219
00220 const char* getDesc() {return m_elstat->description;}
00221
00222
00223 const char* getUnits() {return m_elstat->units;}
00224
00225
00226 const uint8_t getEnableLevel() {return m_elstat->enableLevel;}
00227
00228
00229
00230
00231 void outputStatisticInfo(int Index);
00232
00233
00234
00235
00236
00237 void generateStatisticXMLData(int Index, TiXmlNode* XMLParentElement);
00238
00239 private:
00240 const ElementInfoStatistic* m_elstat;
00241 };
00242
00243 void PopulateStatistic(const ElementInfoStatistic* ptrStats, std::vector<SSTInfoElement_StatisticInfo*>* ptrStatArray)
00244 {
00245
00246 if (NULL != ptrStats) {
00247 while (NULL != ptrStats->name) {
00248
00249 SSTInfoElement_StatisticInfo* ptrStatInfo = new SSTInfoElement_StatisticInfo(ptrStats);
00250 ptrStatArray->push_back(ptrStatInfo);
00251
00252
00253 ptrStats++;
00254 }
00255 }
00256 }
00257
00258
00259
00260
00261
00262
00263
00264 class SSTInfoElement_ComponentInfo {
00265 public:
00266
00267
00268
00269 SSTInfoElement_ComponentInfo(const ElementInfoComponent* elc)
00270 {
00271 const ElementInfoParam* ptrParams;
00272 const ElementInfoPort* ptrPorts;
00273 const ElementInfoStatistic* ptrStats;
00274
00275
00276 m_elc = elc;
00277
00278 ptrParams = elc->params;
00279 PopulateParams(ptrParams, &m_ParamArray);
00280
00281 ptrPorts = elc->ports;
00282 PopulatePorts(ptrPorts, &m_PortArray);
00283
00284 buildCategoryString();
00285
00286 ptrStats = elc->stats;
00287 PopulateStatistic(ptrStats, &m_StatisticArray);
00288 }
00289
00290
00291 const char* getName() {return m_elc->name;}
00292
00293
00294 const char* getDesc() {return m_elc->description;}
00295
00296
00297
00298
00299 SSTInfoElement_ParamInfo* getParamInfo(int index) {return m_ParamArray[index];}
00300
00301
00302
00303
00304 SSTInfoElement_PortInfo* getPortInfo(int index) {return m_PortArray[index];}
00305
00306
00307
00308
00309 SSTInfoElement_StatisticInfo* getStatisticInfo(int index) {return m_StatisticArray[index];}
00310
00311
00312 uint32_t getCategoryValue() {return m_elc->category;}
00313
00314
00315 const char* getCategoryString() {return m_CategoryString.c_str();}
00316
00317
00318
00319
00320 void outputComponentInfo(int Index);
00321
00322
00323
00324
00325
00326 void generateComponentInfoXMLData(int Index, TiXmlNode* XMLParentElement);
00327
00328 private:
00329 void buildCategoryString();
00330
00331 const ElementInfoComponent* m_elc;
00332 std::vector<SSTInfoElement_ParamInfo*> m_ParamArray;
00333 std::vector<SSTInfoElement_PortInfo*> m_PortArray;
00334 std::vector<SSTInfoElement_StatisticInfo*> m_StatisticArray;
00335 std::string m_CategoryString;
00336 };
00337
00338
00339
00340
00341
00342
00343
00344 class SSTInfoElement_IntrospectorInfo {
00345 public:
00346
00347
00348
00349 SSTInfoElement_IntrospectorInfo(const ElementInfoIntrospector* eli)
00350 {
00351 const ElementInfoParam* ptrParams;
00352
00353
00354 m_eli = eli;
00355
00356 ptrParams = eli->params;
00357 PopulateParams(ptrParams, &m_ParamArray);
00358 }
00359
00360
00361 const char* getName() {return m_eli->name;}
00362
00363
00364 const char* getDesc() {return m_eli->description;}
00365
00366
00367
00368
00369 SSTInfoElement_ParamInfo* getParamInfo(int index) {return m_ParamArray[index];}
00370
00371
00372
00373
00374 void outputIntrospectorInfo(int Index);
00375
00376
00377
00378
00379
00380 void generateIntrospectorInfoXMLData(int Index, TiXmlNode* XMLParentElement);
00381
00382 private:
00383 const ElementInfoIntrospector* m_eli;
00384 std::vector<SSTInfoElement_ParamInfo*> m_ParamArray;
00385 };
00386
00387
00388
00389
00390
00391
00392
00393 class SSTInfoElement_EventInfo {
00394 public:
00395
00396
00397
00398 SSTInfoElement_EventInfo(const ElementInfoEvent* ele)
00399 {
00400
00401 m_ele = ele;
00402 }
00403
00404
00405 const char* getName() {return m_ele->name;}
00406
00407
00408 const char* getDesc() {return m_ele->description;}
00409
00410
00411
00412
00413 void outputEventInfo(int Index);
00414
00415
00416
00417
00418
00419 void generateEventInfoXMLData(int Index, TiXmlNode* XMLParentElement);
00420
00421 private:
00422 const ElementInfoEvent* m_ele;
00423 };
00424
00425
00426
00427
00428
00429
00430
00431 class SSTInfoElement_ModuleInfo {
00432 public:
00433
00434
00435
00436 SSTInfoElement_ModuleInfo(const ElementInfoModule* elm)
00437 {
00438 const ElementInfoParam* ptrParams;
00439
00440
00441 m_elm = elm;
00442
00443 ptrParams = elm->params;
00444 PopulateParams(ptrParams, &m_ParamArray);
00445 }
00446
00447
00448 const char* getName() {return m_elm->name;}
00449
00450
00451 const char* getDesc() {return m_elm->description;}
00452
00453
00454 const char* getProvides() { return m_elm->provides;}
00455
00456
00457
00458
00459 SSTInfoElement_ParamInfo* getParamInfo(int index) {return m_ParamArray[index];}
00460
00461
00462
00463
00464 void outputModuleInfo(int Index);
00465
00466
00467
00468
00469
00470 void generateModuleInfoXMLData(int Index, TiXmlNode* XMLParentElement);
00471
00472 private:
00473 const ElementInfoModule* m_elm;
00474 std::vector<SSTInfoElement_ParamInfo*> m_ParamArray;
00475 };
00476
00477
00478
00479
00480
00481
00482
00483 class SSTInfoElement_SubComponentInfo {
00484 public:
00485
00486
00487
00488 SSTInfoElement_SubComponentInfo(const ElementInfoSubComponent* elsc)
00489 {
00490 const ElementInfoParam* ptrParams;
00491 const ElementInfoStatistic* ptrStats;
00492
00493
00494 m_elsc = elsc;
00495
00496 ptrParams = elsc->params;
00497 PopulateParams(ptrParams, &m_ParamArray);
00498
00499 ptrStats = elsc->stats;
00500 PopulateStatistic(ptrStats, &m_StatisticArray);
00501 }
00502
00503
00504 const char* getName() {return m_elsc->name;}
00505
00506
00507 const char* getDesc() {return m_elsc->description;}
00508
00509
00510
00511
00512 SSTInfoElement_ParamInfo* getParamInfo(int index) {return m_ParamArray[index];}
00513
00514
00515
00516
00517 SSTInfoElement_StatisticInfo* getStatisticInfo(int index) {return m_StatisticArray[index];}
00518
00519
00520
00521
00522 void outputSubComponentInfo(int Index);
00523
00524
00525
00526
00527
00528 void generateSubComponentInfoXMLData(int Index, TiXmlNode* XMLParentElement);
00529
00530 private:
00531 const ElementInfoSubComponent* m_elsc;
00532 std::vector<SSTInfoElement_ParamInfo*> m_ParamArray;
00533 std::vector<SSTInfoElement_StatisticInfo*> m_StatisticArray;
00534 };
00535
00536
00537
00538
00539
00540
00541
00542 class SSTInfoElement_PartitionerInfo {
00543 public:
00544
00545
00546
00547 SSTInfoElement_PartitionerInfo(const ElementInfoPartitioner* elp)
00548 {
00549
00550 m_elp = elp;
00551 }
00552
00553
00554 const char* getName() {return m_elp->name;}
00555
00556
00557 const char* getDesc() {return m_elp->description;}
00558
00559
00560
00561
00562 void outputPartitionerInfo(int Index);
00563
00564
00565
00566
00567
00568 void generatePartitionerInfoXMLData(int Index, TiXmlNode* XMLParentElement);
00569
00570 private:
00571 const ElementInfoPartitioner* m_elp;
00572 };
00573
00574
00575
00576
00577
00578
00579
00580 class SSTInfoElement_GeneratorInfo {
00581 public:
00582
00583
00584
00585 SSTInfoElement_GeneratorInfo(const ElementInfoGenerator* elg)
00586 {
00587
00588 m_elg = elg;
00589 }
00590
00591
00592 const char* getName() {return m_elg->name;}
00593
00594
00595 const char* getDesc() {return m_elg->description;}
00596
00597
00598
00599
00600 void outputGeneratorInfo(int Index);
00601
00602
00603
00604
00605
00606 void generateGeneratorInfoXMLData(int Index, TiXmlNode* XMLParentElement);
00607
00608 private:
00609 const ElementInfoGenerator* m_elg;
00610 };
00611
00612
00613
00614
00615
00616
00617
00618
00619 class SSTInfoElement_LibraryInfo {
00620
00621 public:
00622
00623
00624
00625 SSTInfoElement_LibraryInfo(const ElementLibraryInfo* eli)
00626 {
00627 m_eli = eli;
00628 populateLibraryInfo();
00629 }
00630
00631
00632 std::string getLibraryName() {if (m_eli && m_eli->name) return m_eli->name; else return ""; }
00633
00634
00635 std::string getLibraryDescription() {if (m_eli && m_eli->description) return m_eli->description; else return ""; }
00636
00637
00638 int getNumberOfLibraryComponents() {return m_ComponentArray.size();}
00639
00640
00641 int getNumberOfLibraryIntrospectors() {return m_IntrospectorArray.size();}
00642
00643
00644 int getNumberOfLibraryEvents() {return m_EventArray.size();}
00645
00646
00647 int getNumberOfLibraryModules() {return m_ModuleArray.size();}
00648
00649
00650 int getNumberOfLibrarySubComponents() {return m_SubComponentArray.size();}
00651
00652
00653 int getNumberOfLibraryPartitioners() {return m_PartitionerArray.size();}
00654
00655
00656 int getNumberOfLibraryGenerators() {return m_GeneratorArray.size();}
00657
00658
00659 const ElementLibraryInfo* getLibraryInfo() {return m_eli;}
00660
00661
00662
00663
00664 SSTInfoElement_ComponentInfo* getInfoComponent(int Index) {return m_ComponentArray[Index];}
00665
00666
00667
00668
00669 SSTInfoElement_IntrospectorInfo* getInfoIntrospector(int Index) {return m_IntrospectorArray[Index];}
00670
00671
00672
00673
00674 SSTInfoElement_EventInfo* getInfoEvent(int Index) {return m_EventArray[Index];}
00675
00676
00677
00678
00679 SSTInfoElement_ModuleInfo* getInfoModule(int Index) {return m_ModuleArray[Index];}
00680
00681
00682
00683
00684 SSTInfoElement_SubComponentInfo* getInfoSubComponent(int Index) {return m_SubComponentArray[Index];}
00685
00686
00687
00688
00689 SSTInfoElement_PartitionerInfo* getInfoPartitioner(int Index) {return m_PartitionerArray[Index];}
00690
00691
00692
00693
00694 SSTInfoElement_GeneratorInfo* getInfoGenerator(int Index) {return m_GeneratorArray[Index];}
00695
00696
00697
00698
00699 void outputLibraryInfo(int LibIndex);
00700
00701
00702
00703
00704
00705 void generateLibraryInfoXMLData(int LibIndex, TiXmlNode* XMLParentElement);
00706
00707 private:
00708 void populateLibraryInfo();
00709 void addInfoComponent(const ElementInfoComponent* eic) {m_ComponentArray.push_back(new SSTInfoElement_ComponentInfo(eic));}
00710 void addInfoIntrospector(const ElementInfoIntrospector* eii) {m_IntrospectorArray.push_back(new SSTInfoElement_IntrospectorInfo(eii));}
00711 void addInfoEvent(const ElementInfoEvent* eie) {m_EventArray.push_back(new SSTInfoElement_EventInfo(eie));}
00712 void addInfoModule(const ElementInfoModule* eim) {m_ModuleArray.push_back(new SSTInfoElement_ModuleInfo(eim));}
00713 void addInfoSubComponent(const ElementInfoSubComponent* eisc) {m_SubComponentArray.push_back(new SSTInfoElement_SubComponentInfo(eisc));}
00714 void addInfoPartitioner(const ElementInfoPartitioner* eip) {m_PartitionerArray.push_back(new SSTInfoElement_PartitionerInfo(eip));}
00715 void addInfoGenerator(const ElementInfoGenerator* eig) {m_GeneratorArray.push_back(new SSTInfoElement_GeneratorInfo(eig));}
00716
00717 const ElementLibraryInfo* m_eli;
00718 std::vector<SSTInfoElement_ComponentInfo*> m_ComponentArray;
00719 std::vector<SSTInfoElement_IntrospectorInfo*> m_IntrospectorArray;
00720 std::vector<SSTInfoElement_EventInfo*> m_EventArray;
00721 std::vector<SSTInfoElement_ModuleInfo*> m_ModuleArray;
00722 std::vector<SSTInfoElement_SubComponentInfo*> m_SubComponentArray;
00723 std::vector<SSTInfoElement_PartitionerInfo*> m_PartitionerArray;
00724 std::vector<SSTInfoElement_GeneratorInfo*> m_GeneratorArray;
00725
00726 };
00727
00728 }
00729
00730 #endif // SST_INFO_H