-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathSSTInfoData.cpp
757 lines (633 loc) · 20.4 KB
/
SSTInfoData.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
////////////////////////////////////////////////////////////////////////
// Copyright 2009-2018 NTESS. Under the terms
// of Contract DE-NA0003525 with NTESS, the U.S.
// Government retains certain rights in this software.
//
// Copyright (c) 2009-2018, NTESS
// All rights reserved.
//
// Portions are copyright of other developers:
// See the file CONTRIBUTORS.TXT in the top level directory
// the distribution for more information.
//
// This file is part of the SST software package. For license
// information, see the LICENSE file in the top level directory of the
// distribution.
////////////////////////////////////////////////////////////////////////
#include "SSTInfoData.h"
//////////////////////////////////////////////////////////////////////
SSTInfoDataParam::SSTInfoDataParam(QString ParamName, QString DefaultValue /*=""*/)
{
m_ParamName = ParamName;
m_ParamDesc.clear();
m_ParamDefaultValue = DefaultValue;
}
SSTInfoDataParam::~SSTInfoDataParam()
{
}
void SSTInfoDataParam::SaveData(QDataStream& DataStreamOut)
{
// Serialize and Save the General Information
DataStreamOut << m_ParamName;
DataStreamOut << m_ParamDesc;
DataStreamOut << m_ParamDefaultValue;
}
SSTInfoDataParam::SSTInfoDataParam(QDataStream& DataStreamIn)
{
// Serialiation: Load The General Information
DataStreamIn >> m_ParamName;
DataStreamIn >> m_ParamDesc;
DataStreamIn >> m_ParamDefaultValue;
}
//////////////////////////////////////////////////////////////////////
SSTInfoDataPort::SSTInfoDataPort(QString PortName)
{
m_PortName = PortName;
m_PortDesc.clear();
m_PortValidEvents.clear();
}
SSTInfoDataPort::~SSTInfoDataPort()
{
}
void SSTInfoDataPort::SaveData(QDataStream& DataStreamOut)
{
// Serialize and Save the General Information
DataStreamOut << m_PortName;
DataStreamOut << m_PortDesc;
DataStreamOut << m_PortValidEvents;
}
SSTInfoDataPort::SSTInfoDataPort(QDataStream& DataStreamIn)
{
// Serialiation: Load The General Information
DataStreamIn >> m_PortName;
DataStreamIn >> m_PortDesc;
DataStreamIn >> m_PortValidEvents;
}
//////////////////////////////////////////////////////////////////////
SSTInfoDataComponent::SSTInfoDataComponent(QString ParentElementName, QString ComponentName, SSTInfoDataComponent::ComponentType Type, int NumAllowedInstances /*=-1*/)
{
m_ParentElementName = ParentElementName;
m_ComponentName = ComponentName;
m_ComponentDesc.clear();
m_ComponentType = Type;
m_ParamNameList.clear();
m_PortNameList.clear();
// Set the default number of allowed instances of this component, -1 means unlimited
m_AllowedNumberOfInstances = NumAllowedInstances;
}
SSTInfoDataComponent::~SSTInfoDataComponent()
{
int x;
int count;
// Remove all Parameters to prevent memory leaks
count = m_ParamNameList.count();
for (x = 0; x < count; x++)
{
delete m_ParamNameList.at(0);
m_ParamNameList.removeAt(0);
}
m_ParamNameList.clear();
// Remove all Ports to prevent memory leaks
count = m_PortNameList.count();
for (x = 0; x < count; x++)
{
delete m_PortNameList.at(0);
m_PortNameList.removeAt(0);
}
m_PortNameList.clear();
}
QString SSTInfoDataComponent::GetComponentTypeName(ComponentType Type)
{
QString rtnString;
switch (Type) {
case SSTInfoDataComponent::COMP_UNCATEGORIZED: rtnString = SSTINFO_COMPONENTTYPESTR_UNCATEGORIZED; break;
case SSTInfoDataComponent::COMP_PROCESSOR: rtnString = SSTINFO_COMPONENTTYPESTR_PROCESSOR; break;
case SSTInfoDataComponent::COMP_MEMORY: rtnString = SSTINFO_COMPONENTTYPESTR_MEMORY; break;
case SSTInfoDataComponent::COMP_NETWORK: rtnString = SSTINFO_COMPONENTTYPESTR_NETWORK; break;
case SSTInfoDataComponent::COMP_SYSTEM: rtnString = SSTINFO_COMPONENTTYPESTR_SYSTEM; break;
case SSTInfoDataComponent::COMP_SSTSTARTUPCONFIGURATION: rtnString = SSTINFO_COMPONENTTYPESTR_SSTCONFIG; break;
default: rtnString = SSTINFO_COMPONENTTYPESTR_UNDEFINED; break;
}
return rtnString;
}
void SSTInfoDataComponent::AddParam(SSTInfoDataParam* NewParam)
{
m_ParamNameList.append(NewParam);
}
void SSTInfoDataComponent::AddParam(QString NewParamName, QString DefaultValue, QString Desc/*="*/)
{
SSTInfoDataParam* NewParam = new SSTInfoDataParam(NewParamName, DefaultValue);
NewParam->SetParamDesc(Desc);
m_ParamNameList.append(NewParam);
}
void SSTInfoDataComponent::AddParam(QString NewParamName)
{
SSTInfoDataParam* NewParam = new SSTInfoDataParam(NewParamName);
m_ParamNameList.append(NewParam);
}
void SSTInfoDataComponent::AddPort(SSTInfoDataPort* NewPort)
{
m_PortNameList.append(NewPort);
}
void SSTInfoDataComponent::AddPort(QString NewPortName)
{
SSTInfoDataPort* NewPort = new SSTInfoDataPort(NewPortName);
m_PortNameList.append(NewPort);
}
void SSTInfoDataComponent::SaveData(QDataStream& DataStreamOut)
{
int x;
// Serialize and Save the General Information
DataStreamOut << m_ParentElementName;
DataStreamOut << m_ComponentName;
DataStreamOut << m_ComponentDesc;
DataStreamOut << (qint32)m_ComponentType;
DataStreamOut << (qint32)m_AllowedNumberOfInstances;
// Serialize and Save the Counts
DataStreamOut << (qint32)m_ParamNameList.count();
DataStreamOut << (qint32)m_PortNameList.count();
// Serialize and Save all the Parameters
for (x = 0; x < m_ParamNameList.count(); x++)
{
m_ParamNameList.at(x)->SaveData(DataStreamOut);
}
// Serialize and Save all the Ports
for (x = 0; x < m_PortNameList.count(); x++)
{
m_PortNameList.at(x)->SaveData(DataStreamOut);
}
}
SSTInfoDataComponent::SSTInfoDataComponent(QDataStream& DataStreamIn)
{
int x;
int ParamCount;
int PortCount;
qint32 nComponentType;
// Serialiation: Load The General Information
DataStreamIn >> m_ParentElementName;
DataStreamIn >> m_ComponentName;
DataStreamIn >> m_ComponentDesc;
DataStreamIn >> nComponentType; // Read Enum in as an Int
m_ComponentType = (ComponentType)nComponentType; // Cast it to the Enum
DataStreamIn >> m_AllowedNumberOfInstances;
// Load the Counts
DataStreamIn >> ParamCount;
DataStreamIn >> PortCount;
// Load all the Parameters
for (x = 0; x < ParamCount; x++)
{
SSTInfoDataParam* newParam = new SSTInfoDataParam(DataStreamIn);
AddParam(newParam);
}
// Load all the Ports
for (x = 0; x < PortCount; x++)
{
SSTInfoDataPort* newPort = new SSTInfoDataPort(DataStreamIn);
AddPort(newPort);
}
}
//////////////////////////////////////////////////////////////////////
SSTInfoDataIntrospector::SSTInfoDataIntrospector(QString ParentElementName, QString IntrospectorName)
{
m_ParentElementName = ParentElementName;
m_IntrospectorName = IntrospectorName;
m_IntrospectorDesc.clear();
m_ParamNameList.clear();
}
SSTInfoDataIntrospector::~SSTInfoDataIntrospector()
{
int x;
int count;
// Remove all Parameters to prevent memory leaks
count = m_ParamNameList.count();
for (x = 0; x < count; x++)
{
delete m_ParamNameList.at(0);
m_ParamNameList.removeAt(0);
}
m_ParamNameList.clear();
}
void SSTInfoDataIntrospector::AddParam(SSTInfoDataParam* NewParam)
{
m_ParamNameList.append(NewParam);
}
void SSTInfoDataIntrospector::AddParam(QString NewParamName, QString DefaultValue, QString Desc/*="*/)
{
SSTInfoDataParam* NewParam = new SSTInfoDataParam(NewParamName, DefaultValue);
NewParam->SetParamDesc(Desc);
m_ParamNameList.append(NewParam);
}
void SSTInfoDataIntrospector::AddParam(QString NewParamName)
{
SSTInfoDataParam* NewParam = new SSTInfoDataParam(NewParamName);
m_ParamNameList.append(NewParam);
}
void SSTInfoDataIntrospector::SaveData(QDataStream& DataStreamOut)
{
int x;
// Serialize and Save the General Information
DataStreamOut << m_ParentElementName;
DataStreamOut << m_IntrospectorName;
DataStreamOut << m_IntrospectorDesc;
// Serialize and Save the Counts
DataStreamOut << (qint32)m_ParamNameList.count();
// Serialize and Save all the Parameters
for (x = 0; x < m_ParamNameList.count(); x++)
{
m_ParamNameList.at(x)->SaveData(DataStreamOut);
}
}
SSTInfoDataIntrospector::SSTInfoDataIntrospector(QDataStream& DataStreamIn)
{
int x;
int ParamCount;
// Serialiation: Load The General Information
DataStreamIn >> m_ParentElementName;
DataStreamIn >> m_IntrospectorName;
DataStreamIn >> m_IntrospectorDesc;
// Load the Counts
DataStreamIn >> ParamCount;
// Load all the Parameters
for (x = 0; x < ParamCount; x++)
{
SSTInfoDataParam* newParam = new SSTInfoDataParam(DataStreamIn);
AddParam(newParam);
}
}
//////////////////////////////////////////////////////////////////////
SSTInfoDataEvent::SSTInfoDataEvent(QString ParentElementName, QString EventName)
{
m_ParentElementName = ParentElementName;
m_EventName = EventName;
m_EventDesc.clear();
}
SSTInfoDataEvent::~SSTInfoDataEvent()
{
}
void SSTInfoDataEvent::SaveData(QDataStream& DataStreamOut)
{
// Serialize and Save the General Information
DataStreamOut << m_ParentElementName;
DataStreamOut << m_EventName;
DataStreamOut << m_EventDesc;
}
SSTInfoDataEvent::SSTInfoDataEvent(QDataStream& DataStreamIn)
{
// Serialiation: Load The General Information
DataStreamIn >> m_ParentElementName;
DataStreamIn >> m_EventName;
DataStreamIn >> m_EventDesc;
}
//////////////////////////////////////////////////////////////////////
SSTInfoDataModule::SSTInfoDataModule(QString ParentElementName, QString ModuleName)
{
m_ParentElementName = ParentElementName;
m_ModuleName = ModuleName;
m_ModuleDesc.clear();
}
SSTInfoDataModule::~SSTInfoDataModule()
{
int x;
int count;
// Remove all Parameters to prevent memory leaks
count = m_ParamNameList.count();
for (x = 0; x < count; x++)
{
delete m_ParamNameList.at(0);
m_ParamNameList.removeAt(0);
}
m_ParamNameList.clear();
}
void SSTInfoDataModule::AddParam(SSTInfoDataParam* NewParam)
{
m_ParamNameList.append(NewParam);
}
void SSTInfoDataModule::AddParam(QString NewParamName, QString DefaultValue, QString Desc /*="*/)
{
SSTInfoDataParam* NewParam = new SSTInfoDataParam(NewParamName, DefaultValue);
NewParam->SetParamDesc(Desc);
m_ParamNameList.append(NewParam);
}
void SSTInfoDataModule::AddParam(QString NewParamName)
{
SSTInfoDataParam* NewParam = new SSTInfoDataParam(NewParamName);
m_ParamNameList.append(NewParam);
}
void SSTInfoDataModule::SaveData(QDataStream& DataStreamOut)
{
int x;
// Serialize and Save the General Information
DataStreamOut << m_ParentElementName;
DataStreamOut << m_ModuleName;
DataStreamOut << m_ModuleDesc;
// Serialize and Save the Counts
DataStreamOut << (qint32)m_ParamNameList.count();
// Serialize and Save all the Parameters
for (x = 0; x < m_ParamNameList.count(); x++)
{
m_ParamNameList.at(x)->SaveData(DataStreamOut);
}
}
SSTInfoDataModule::SSTInfoDataModule(QDataStream& DataStreamIn)
{
int x;
int ParamCount;
// Serialiation: Load The General Information
DataStreamIn >> m_ParentElementName;
DataStreamIn >> m_ModuleName;
DataStreamIn >> m_ModuleDesc;
// Load the Counts
DataStreamIn >> ParamCount;
// Load all the Parameters
for (x = 0; x < ParamCount; x++)
{
SSTInfoDataParam* newParam = new SSTInfoDataParam(DataStreamIn);
AddParam(newParam);
}
}
//////////////////////////////////////////////////////////////////////
SSTInfoDataPartitioner::SSTInfoDataPartitioner(QString ParentElementName, QString PartitionerName)
{
m_ParentElementName = ParentElementName;
m_PartitionerName = PartitionerName;
m_PartitionerDesc.clear();
}
SSTInfoDataPartitioner::~SSTInfoDataPartitioner()
{
}
void SSTInfoDataPartitioner::SaveData(QDataStream& DataStreamOut)
{
// Serialize and Save the General Information
DataStreamOut << m_ParentElementName;
DataStreamOut << m_PartitionerName;
DataStreamOut << m_PartitionerDesc;
}
SSTInfoDataPartitioner::SSTInfoDataPartitioner(QDataStream& DataStreamIn)
{
// Serialiation: Load The General Information
DataStreamIn >> m_ParentElementName;
DataStreamIn >> m_PartitionerName;
DataStreamIn >> m_PartitionerDesc;
}
//////////////////////////////////////////////////////////////////////
SSTInfoDataGenerator::SSTInfoDataGenerator(QString ParentElementName, QString GeneratorName)
{
m_ParentElementName = ParentElementName;
m_GeneratorName = GeneratorName;
m_GeneratorDesc.clear();
}
SSTInfoDataGenerator::~SSTInfoDataGenerator()
{
}
void SSTInfoDataGenerator::SaveData(QDataStream& DataStreamOut)
{
// Serialize and Save the General Information
DataStreamOut << m_ParentElementName;
DataStreamOut << m_GeneratorName;
DataStreamOut << m_GeneratorDesc;
}
SSTInfoDataGenerator::SSTInfoDataGenerator(QDataStream& DataStreamIn)
{
// Serialiation: Load The General Information
DataStreamIn >> m_ParentElementName;
DataStreamIn >> m_GeneratorName;
DataStreamIn >> m_GeneratorDesc;
}
//////////////////////////////////////////////////////////////////////
SSTInfoDataElement::SSTInfoDataElement(QString ElementName)
{
m_ElementName = ElementName;
m_ElementDesc.clear();
m_ComponentList.clear();
m_IntrospectorList.clear();
m_EventList.clear();
m_ModuleList.clear();
m_PartitionerList.clear();
m_GeneratorList.clear();
}
SSTInfoDataElement::~SSTInfoDataElement()
{
int x;
int count;
// Remove all Components to prevent memory leaks
count = m_ComponentList.count();
for (x = 0; x < count; x++)
{
delete m_ComponentList.at(0);
m_ComponentList.removeAt(0);
}
m_ComponentList.clear();
// Remove all Introspectors to prevent memory leaks
count = m_IntrospectorList.count();
for (x = 0; x < count; x++)
{
delete m_IntrospectorList.at(0);
m_IntrospectorList.removeAt(0);
}
m_IntrospectorList.clear();
// Remove all Events to prevent memory leaks
count = m_EventList.count();
for (x = 0; x < count; x++)
{
delete m_EventList.at(0);
m_EventList.removeAt(0);
}
m_EventList.clear();
// Remove all Modules to prevent memory leaks
count = m_ModuleList.count();
for (x = 0; x < count; x++)
{
delete m_ModuleList.at(0);
m_ModuleList.removeAt(0);
}
m_ModuleList.clear();
// Remove all Partitioners to prevent memory leaks
count = m_PartitionerList.count();
for (x = 0; x < count; x++)
{
delete m_PartitionerList.at(0);
m_PartitionerList.removeAt(0);
}
m_PartitionerList.clear();
// Remove all Generators to prevent memory leaks
count = m_GeneratorList.count();
for (x = 0; x < count; x++)
{
delete m_GeneratorList.at(0);
m_GeneratorList.removeAt(0);
}
m_GeneratorList.clear();
}
void SSTInfoDataElement::AddComponent(SSTInfoDataComponent* NewComponent)
{
m_ComponentList.append(NewComponent);
}
void SSTInfoDataElement::AddIntrospector(SSTInfoDataIntrospector* NewIntrospector)
{
m_IntrospectorList.append(NewIntrospector);
}
void SSTInfoDataElement::AddEvent(SSTInfoDataEvent* NewEvent)
{
m_EventList.append(NewEvent);
}
void SSTInfoDataElement::AddModule(SSTInfoDataModule* NewModule)
{
m_ModuleList.append(NewModule);
}
void SSTInfoDataElement::AddPartitioner(SSTInfoDataPartitioner* NewPartitioner)
{
m_PartitionerList.append(NewPartitioner);
}
void SSTInfoDataElement::AddGenerator(SSTInfoDataGenerator* NewGenerator)
{
m_GeneratorList.append(NewGenerator);
}
void SSTInfoDataElement::SaveData(QDataStream& DataStreamOut)
{
int x;
// Serialize and Save the General Information
DataStreamOut << m_ElementName;
DataStreamOut << m_ElementDesc;
// Serialize and Save the Counts
DataStreamOut << (qint32)m_ComponentList.count();
DataStreamOut << (qint32)m_IntrospectorList.count();
DataStreamOut << (qint32)m_EventList.count();
DataStreamOut << (qint32)m_ModuleList.count();
DataStreamOut << (qint32)m_PartitionerList.count();
DataStreamOut << (qint32)m_GeneratorList.count();
// Serialize and Save all the Components
for (x = 0; x < m_ComponentList.count(); x++)
{
m_ComponentList.at(x)->SaveData(DataStreamOut);
}
// Serialize and Save all the Introspectors
for (x = 0; x < m_IntrospectorList.count(); x++)
{
m_IntrospectorList.at(x)->SaveData(DataStreamOut);
}
// Serialize and Save all the Events
for (x = 0; x < m_EventList.count(); x++)
{
m_EventList.at(x)->SaveData(DataStreamOut);
}
// Serialize and Save all the Modules
for (x = 0; x < m_ModuleList.count(); x++)
{
m_ModuleList.at(x)->SaveData(DataStreamOut);
}
// Serialize and Save all the Partitioners
for (x = 0; x < m_PartitionerList.count(); x++)
{
m_PartitionerList.at(x)->SaveData(DataStreamOut);
}
// Serialize and Save all the Generators
for (x = 0; x < m_GeneratorList.count(); x++)
{
m_GeneratorList.at(x)->SaveData(DataStreamOut);
}
}
SSTInfoDataElement::SSTInfoDataElement(QDataStream& DataStreamIn)
{
int x;
int ComponentCount;
int IntrospectorCount;
int EventCount;
int ModuleCount;
int PartitionerCount;
int GeneratorCount;
// Serialiation: Load The General Information
DataStreamIn >> m_ElementName;
DataStreamIn >> m_ElementDesc;
// Load the Counts
DataStreamIn >> ComponentCount;
DataStreamIn >> IntrospectorCount;
DataStreamIn >> EventCount;
DataStreamIn >> ModuleCount;
DataStreamIn >> PartitionerCount;
DataStreamIn >> GeneratorCount;
// Load all the Components
for (x = 0; x < ComponentCount; x++)
{
SSTInfoDataComponent* newComponent = new SSTInfoDataComponent(DataStreamIn);
AddComponent(newComponent);
}
// Load all the Introspectors
for (x = 0; x < IntrospectorCount; x++)
{
SSTInfoDataIntrospector* newIntrospector = new SSTInfoDataIntrospector(DataStreamIn);
AddIntrospector(newIntrospector);
}
// Load all the Events
for (x = 0; x < EventCount; x++)
{
SSTInfoDataEvent* newEvent = new SSTInfoDataEvent(DataStreamIn);
AddEvent(newEvent);
}
// Load all the Modules
for (x = 0; x < ModuleCount; x++)
{
SSTInfoDataModule* newModule = new SSTInfoDataModule(DataStreamIn);
AddModule(newModule);
}
// Load all the Partitioners
for (x = 0; x < PartitionerCount; x++)
{
SSTInfoDataPartitioner* newPartitioner = new SSTInfoDataPartitioner(DataStreamIn);
AddPartitioner(newPartitioner);
}
// Load all the Generators
for (x = 0; x < GeneratorCount; x++)
{
SSTInfoDataGenerator* newGenerator = new SSTInfoDataGenerator(DataStreamIn);
AddGenerator(newGenerator);
}
}
//////////////////////////////////////////////////////////////////////
SSTInfoData::SSTInfoData()
{
m_ElementList.clear();
m_SSTInfoVersion.clear();
}
SSTInfoData::~SSTInfoData()
{
int x;
int count;
// Remove all Elements to prevent memory leaks
count = m_ElementList.count();
for (x = 0; x < count; x++)
{
delete m_ElementList.at(0);
m_ElementList.removeAt(0);
}
m_ElementList.clear();
}
void SSTInfoData::AddElement(SSTInfoDataElement* NewElement)
{
m_ElementList.append(NewElement);
}
void SSTInfoData::SaveData(QDataStream& DataStreamOut)
{
int x;
// Serialize and Save the Counts
DataStreamOut << m_SSTInfoVersion;
DataStreamOut << (qint32)m_ElementList.count();
// Serialize and Save all the Elements
for (x = 0; x < m_ElementList.count(); x++)
{
m_ElementList.at(x)->SaveData(DataStreamOut);
}
}
SSTInfoData::SSTInfoData(QDataStream& DataStreamIn)
{
int x;
int ElementCount;
// Serialize: Load the Counts
DataStreamIn >> m_SSTInfoVersion;
DataStreamIn >> ElementCount;
// Load all the Parameters
for (x = 0; x < ElementCount; x++)
{
SSTInfoDataElement* newElement = new SSTInfoDataElement(DataStreamIn);
AddElement(newElement);
}
}