00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #include "freStatistics.h"
00024 #include "freExceptions.h"
00025
00026
00027 namespace FREE
00028 {
00029
00030
00034
00035 Statistics::
00036 Statistics(): XMLStreamObject(XMLTags::Statistic)
00037 {
00038 Reset();
00039 };
00040
00041 Statistics::
00042 ~Statistics()
00043 {
00044 Reset();
00045 }
00046
00048 void
00049 Statistics::
00050 Reset()
00051 {
00052 m_sDescription = "";
00053 m_smpData = StatisticData::New();
00054 m_smpDictionary = StatisticDictionary::New();
00055 m_Tags.clear();
00056 };
00057
00058 void
00059 Statistics::
00060 SubElementLoadProcessing(const std::string& rsXMLSubTag, const std::string& rsXMLSubElement, const std::string& rsXMLSubData)
00061 {
00062 if (rsXMLSubTag == XMLTags::StatisticData) m_smpData->LoadFromString(rsXMLSubElement);
00063 else if (rsXMLSubTag == XMLTags::StatisticDictionary) m_smpDictionary->LoadFromString(rsXMLSubElement);
00064 else if (rsXMLSubTag == XMLTags::StatisticDescription) m_sDescription = rsXMLSubData;
00065 };
00066
00067 std::string
00068 Statistics::
00069 SaveData(const unsigned int& iDepth, bool& bHasSubElements) const
00070 {
00071 std::string result;
00072 AddSubElement(result,XMLTags::StatisticDescription,m_sDescription,iDepth);
00073
00074 AttributesType attrs;
00075 for (StatisticsTagMapTyp::const_iterator pos = m_Tags.begin(); pos != m_Tags.end(); pos++)
00076 {
00077 attrs[XMLTags::StatisticTagKey] = pos->first;
00078 AddSubElement(result,XMLTags::StatisticTag,pos->second,attrs,iDepth);
00079 }
00080 AddSubElement(result,m_smpDictionary,iDepth);
00081 AddSubElement(result,m_smpData,iDepth);
00082
00083 return result;
00084 };
00085
00086 void
00087 Statistics::
00088 SaveAttributes(AttributesSaveListType& rAttributes) const
00089 {
00090 rAttributes.push_back(AttributesSaveListType::value_type("xmlns:freStat","http://www.uni-heidelberg.de/mi/free/statistics"));
00091 };
00092
00093 }