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: freProfileRequirements.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 "freProfileRequirements.h" 00023 00024 namespace FREE 00025 { 00026 namespace CtrlProfile 00027 { 00028 00032 00033 00034 00035 ProfileRequirement* 00036 ProfileRequirements:: 00037 AddRequirement(const IDPath& destination, const IDPath& source) 00038 { 00039 ProfileRequirement::Pointer smpRequ = ProfileRequirement::New(); 00040 smpRequ->SetDestination(destination); 00041 smpRequ->SetSource(source); 00042 00043 AddElement(smpRequ); 00044 return smpRequ.GetPointer(); 00045 }; 00046 00047 ProfileRequirements::RequirementVectorType 00048 ProfileRequirements:: 00049 GetRequirementsByDestination(const IDPath& destination) 00050 { 00051 RequirementVectorType findings; 00052 00053 for (RequirementVectorType::iterator pos = m_Elements.begin(); pos!=m_Elements.end(); pos++) 00054 { 00055 if ((*pos)->GetDestination()==destination) findings.push_back(*pos); 00056 }; 00057 return findings; 00058 }; 00059 00060 ProfileRequirements::RequirementVectorType 00061 ProfileRequirements:: 00062 GetRequirementsBySource(const IDPath& source) 00063 { 00064 RequirementVectorType findings; 00065 00066 for (RequirementVectorType::iterator pos = m_Elements.begin(); pos!=m_Elements.end(); pos++) 00067 { 00068 if ((*pos)->GetSource()==source) findings.push_back(*pos); 00069 }; 00070 return findings; 00071 }; 00072 00073 void 00074 ProfileRequirements:: 00075 DeleteRequirementsByDestination(const IDPath& destination) 00076 { 00077 for (ElementsCountType pos = Size()-1; pos!=-1; pos--) 00078 { 00079 if (m_Elements[pos]->GetDestination() == destination) 00080 { 00081 m_Elements.erase(m_Elements.begin()+pos); 00082 } 00083 } 00084 }; 00085 00086 void 00087 ProfileRequirements:: 00088 DeleteRequirementsBySource(const IDPath& source) 00089 { 00090 for (ElementsCountType pos = Size()-1; pos!=-1; pos--) 00091 { 00092 if (m_Elements[pos]->GetSource() == source) 00093 { 00094 m_Elements.erase(m_Elements.begin()+pos); 00095 } 00096 } 00097 }; 00098 00099 ProfileRequirements:: 00100 ProfileRequirements() 00101 { 00102 Reset(); 00103 SetXMLTag(cXML_CP_Requirements); 00104 }; 00105 00106 ProfileRequirements:: 00107 ProfileRequirements( const ProfileRequirements& rRequirements) 00108 { 00109 SetXMLTag(cXML_CP_Requirements); 00110 *this = rRequirements; 00111 }; 00112 00113 ProfileRequirements& 00114 ProfileRequirements:: 00115 operator = (const ProfileRequirements& rRequirements) 00116 { 00117 if ( this == &rRequirements) return *this; 00118 00119 this->LoadFromString(rRequirements.SaveToString()); 00120 return *this; 00121 }; 00122 00123 ProfileRequirements:: 00124 ~ProfileRequirements() 00125 { 00126 Reset(); 00127 }; 00128 00129 void 00130 ProfileRequirements:: 00131 SubElementLoadProcessing(const std::string& rsXMLSubTag, const std::string& rsXMLSubElement, const std::string& rsXMLSubData) 00132 { 00133 if (rsXMLSubTag==cXML_CP_ProfileOption) 00134 { 00135 ProfileRequirement* smpNewComponent = ProfileRequirement::New(); 00136 00137 try 00138 { 00139 smpNewComponent->LoadFromString(rsXMLSubElement); 00140 } 00141 catchAllNPassMacro("Unknown error occured while loading subcomponent definition to a collection."); 00142 00143 AddElement(smpNewComponent); 00144 } 00145 else if (rsXMLSubTag!=cXML_Text) throwExceptionMacro("Unknown xml tag, unable to load value. Incorrect Tag: " << rsXMLSubTag); 00146 }; 00147 00148 }//end of namespace FREE 00149 }//end of namespace CtrlProfile
1.5.3 written by Dimitri van Heesch,
© 1997-2000