freStatistics.cxx

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   F.R.E.E. - flexible registration evaluation engine
00004   Version:   v.1.0.0
00005   Date:      $Date: 2006/09/01 12:00:00 $
00006   Module:    $RCSfile: freStatistics.cxx,v $
00007   Language:  C++
00008 
00009 
00010 
00011   Copyright (c) 2007 Ralf o Floca (Department of Medical Informatics,
00012   Institute for Medical Biometry and Informatics, University of Heidelberg,
00013   Germany). All rights reserved.
00014   See FREECopyright.txt or http://www.mi.med.uni-hd.de/free/copyright.htm
00015   for details.
00016 
00017      This software is distributed WITHOUT ANY WARRANTY; without even 
00018      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00019      PURPOSE.  See the above copyright notices for more information.
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 } //end of namespace FREE

Generated at Sat Oct 13 17:41:44 2007 for f.r.e.e. - Flexible Registration and Evaluation Engine by doxygen 1.5.3 written by Dimitri van Heesch, © 1997-2000