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: freComponentSetupCollection.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 "freComponentSetupCollection.h" 00023 00024 #include "freConvert.h" 00025 00026 namespace FREE 00027 { 00031 00032 00033 ComponentSetupCollection:: 00034 ComponentSetupCollection(ComponentSetup* pParent):Superclass() 00035 { 00036 m_pParent = pParent; 00037 SetXMLTag(cXML_Components); 00038 }; 00039 00040 ComponentSetupCollection:: 00041 ComponentSetupCollection( const ComponentSetupCollection& rCollection ):Superclass() 00042 { 00043 SetXMLTag(cXML_Components); 00044 *this = rCollection; 00045 }; 00046 00047 ComponentSetupCollection:: 00048 ~ComponentSetupCollection() 00049 { 00050 Reset(); 00051 }; 00052 00053 ComponentSetupCollection& 00054 ComponentSetupCollection:: 00055 operator = (const ComponentSetupCollection& rCollection) 00056 { 00057 if ( this == &rCollection) return *this; 00058 00059 Superclass::operator = (rCollection); 00060 00061 return *this; 00062 }; 00063 00064 ComponentSetupCollection::ComponentsCountType 00065 ComponentSetupCollection:: 00066 AddElement(const ComponentID& compID) 00067 { 00068 ComponentType::Pointer smpNewComponent = ComponentType::New(m_pParent,compID); 00069 m_Elements.push_back(smpNewComponent); 00070 return m_Elements.size()-1; 00071 }; 00072 00073 ComponentSetupCollection::ComponentsCountType 00074 ComponentSetupCollection:: 00075 AddElement(const ComponentType& rComponent) 00076 { 00077 ComponentType::Pointer smpNewComponent = ComponentType::New(m_pParent); 00078 *(smpNewComponent.GetPointer()) = rComponent; 00079 m_Elements.push_back(smpNewComponent); 00080 return m_Elements.size()-1; 00081 }; 00082 00083 void 00084 ComponentSetupCollection:: 00085 SubElementLoadProcessing(const std::string& rsXMLSubTag, const std::string& rsXMLSubElement, const std::string& rsXMLSubData) 00086 { 00087 if (rsXMLSubTag==cXML_Component) 00088 { 00089 ComponentType::Pointer smpNewComponent = ComponentType::New(m_pParent); 00090 00091 try 00092 { 00093 smpNewComponent->LoadFromString(rsXMLSubElement); 00094 } 00095 catchAllNPassMacro("Error while loading setup component."); 00096 00097 m_Elements.push_back(smpNewComponent); 00098 } 00099 else if (rsXMLSubTag!=cXML_Text) throwExceptionMacro("Unknown xml tag, unable to load value. Incorrect Tag: "<<rsXMLSubTag); 00100 }; 00101 00102 }//end of namespace FREE
1.5.3 written by Dimitri van Heesch,
© 1997-2000