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: freAdaptation.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 #include "freAdaptation.h" 00023 00024 namespace FREE 00025 { 00026 namespace Adaptation 00027 { 00028 00032 00033 00034 Adaptation& 00035 Adaptation:: 00036 operator = (const Adaptation& rSetup) 00037 { 00038 if ( this == &rSetup) return *this; 00039 00040 Superclass::operator = (rSetup); 00041 00042 m_sDescription = rSetup.GetDescription(); 00043 m_sID = rSetup.GetID(); 00044 00045 return *this; 00046 }; 00047 00048 void 00049 Adaptation:: 00050 Reset() 00051 { 00052 Superclass::Reset(); 00053 m_sID = ""; 00054 m_sDescription = ""; 00055 }; 00056 00057 Adaptation:: 00058 Adaptation():XMLCollectionBase<AdaptationComponent>(FREE::cXML_Adaptation_Item) 00059 { 00060 m_sID = ""; 00061 m_sDescription = ""; 00062 }; 00063 00064 Adaptation:: 00065 ~Adaptation() 00066 { 00067 Reset(); 00068 }; 00069 00071 void 00072 Adaptation:: 00073 SubElementLoadProcessing(const std::string& rsXMLSubTag, const std::string& rsXMLSubElement, const std::string& rsXMLSubData) 00074 { 00075 if (rsXMLSubTag == cXML_Adaptation_Description) m_sDescription = rsXMLSubData; 00076 else if (rsXMLSubTag == cXML_Component) 00077 { 00078 AdaptationComponent::Pointer smpNewComponent = AdaptationComponent::New(); 00079 smpNewComponent->LoadFromString(rsXMLSubElement); 00080 AddElement(smpNewComponent); 00081 }; 00082 }; 00083 00084 std::string 00085 Adaptation:: 00086 SaveData(const unsigned int& iDepth, bool& bHasSubElements) const 00087 { 00088 std::string result; 00089 00090 AddSubElement(result,cXML_Adaptation_Description,m_sDescription,iDepth); 00091 00092 for (ElementsCountType iPos=0; iPos<Size(); iPos++) 00093 { 00094 AddSubElement(result,m_Elements[iPos],iDepth); 00095 }; 00096 return result; 00097 }; 00098 00099 void 00100 Adaptation:: 00101 AttributesLoadProcessing(const AttributesType& rAttributes) 00102 { 00103 for (AttributesType::const_iterator pos = rAttributes.begin(); pos!= rAttributes.end(); pos++) 00104 { 00105 if (pos->first==cXML_Adaptation_ItemID) m_sID = pos->second; 00106 }; 00107 00108 Superclass::AttributesLoadProcessing(rAttributes); 00109 }; 00110 00111 void 00112 Adaptation:: 00113 SaveAttributes(AttributesSaveListType& rAttributes) const 00114 { 00115 if (m_sID!="") rAttributes.push_back(AttributesType::value_type(cXML_Adaptation_ItemID,m_sID)); 00116 00117 Superclass::SaveAttributes(rAttributes); 00118 }; 00119 00120 }//End of Namespace Adaptation 00121 }//End of Namespace free
1.5.3 written by Dimitri van Heesch,
© 1997-2000