00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef __freStatisticEntry_h
00022 #define __freStatisticEntry_h
00023
00024 #include "freTimeStampedObject.h"
00025 #include "freStatisticValue.h"
00026 #include "freStatisticEntryDefinition.h"
00027
00028 #include "itkLightObject.h"
00029
00030 namespace FREE
00031 {
00032 freXMLTagMacro(StatisticEntry, "freStat:Entry");
00033 freXMLTagMacro(StatisticEntryRef, "freStat:RefID");
00034 freXMLTagMacro(StatisticEntryID, "freStat:ID");
00035
00036
00037 class StatisticData;
00038
00048 class StatisticEntry: public TimeStampedObject, public itk::LightObject
00049 {
00050 public:
00051 typedef StatisticEntry Self;
00052 typedef itk::LightObject Superclass;
00053 typedef itk::SmartPointer<Self> Pointer;
00054 typedef itk::SmartPointer<const Self> ConstPointer;
00055
00056 typedef unsigned long IDType;
00057 static const IDType cUndefinedID;
00058
00059 itkTypeMacro(StatisticEntry, TimeStampedObject);
00060
00061 static Pointer New(const IDType& id, clock_t& stampOffset, StatisticData* pData)
00062 {
00063 Pointer smartPtr = new StatisticEntry(id, stampOffset, pData);
00064 smartPtr->UnRegister();
00065
00066 return smartPtr;
00067 }
00068
00069 typedef StatisticEntryDefinition::IDType ReferenceIDType;
00070 static const ReferenceIDType cUndefinedRef;
00071
00072 typedef std::vector<StatisticValue> ValuesType;
00073 typedef std::vector<Pointer> EntriesType;
00074
00076 StatisticEntry& operator = (const StatisticEntry& entry);
00077
00082 StatisticEntry::Pointer CreateChildEntry();
00089 StatisticEntry::Pointer PostCreateChildEntry();
00090
00092 void CloseEntry();
00093
00094 virtual ~StatisticEntry();
00095
00097 virtual void Reset();
00098
00099 void SetID (const IDType& id) {m_ID = id;};
00100 IDType GetID () const { return m_ID; };
00101
00102 void SetRefID (const ReferenceIDType& id) {m_RefID = id;};
00103 ReferenceIDType GetRefID () const { return m_RefID; };
00104
00105 const ValuesType& GetValues() const {return m_Values;};
00106 ValuesType& GetValues() {return m_Values;};
00107
00108 const EntriesType& GetEntries() const {return m_Entries;};
00109 EntriesType& GetEntries() {return m_Entries;};
00110
00111 StatisticValue& AddValue(const std::string& sValue, const StatisticValue::ReferenceIDType& refID);
00112
00113 protected:
00115 StatisticEntry(const IDType& id, clock_t& stampOffset, StatisticData* pData);
00116
00119 IDType m_ID;
00120
00122 ReferenceIDType m_RefID;
00123
00126 StatisticData* m_pData;
00127
00129 ValuesType m_Values;
00130
00131 EntriesType m_Entries;
00132
00133 virtual void SubElementLoadProcessing(const std::string& rsXMLSubTag, const std::string& rsXMLSubElement, const std::string& rsXMLSubData);
00134 virtual std::string SaveData(const unsigned int& iDepth, bool& bHasSubElements) const;
00135 virtual void AttributesLoadProcessing(const AttributesType& rAttributes);
00136 virtual void SaveAttributes(AttributesSaveListType& rAttributes) const;
00137 };
00138
00139 }
00140
00141 #endif