freProfileSubComponents.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: freProfileSubComponents.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 "freProfileSubComponents.h"
00023 
00024 namespace FREE
00025 {
00026 namespace CtrlProfile
00027 {
00028 
00032 
00033 
00034 SubComponent*
00035 ProfileSubComponents::
00036 AddSubComponent(const std::string& sComponentID,        const unsigned int& iRequired, const std::string& sControllerID, const std::string& sDescription)
00037 {
00038   SubComponent::Pointer smpComponent = GetElement(sComponentID);
00039 
00040         if (smpComponent.IsNull())
00041         {
00042     smpComponent = SubComponent::New();
00043         AddElement(smpComponent);
00044         };
00045 
00046         smpComponent->SetComponentID(sComponentID);
00047         smpComponent->SetIsRequired(iRequired);
00048   smpComponent->SetDescription(sDescription);
00049         smpComponent->SetControllerID(sControllerID);
00050 
00051         return smpComponent.GetPointer();
00052 };
00053 
00054 bool
00055 ProfileSubComponents::
00056 SubComponentExists(const std::string& sComponentID) const
00057 {
00058   return GetElementIndex(sComponentID)!=-1;
00059 };
00060 
00061 ProfileSubComponents::
00062 ProfileSubComponents()
00063 {
00064   Reset();
00065         SetXMLTag(cXML_CP_SubComponents);
00066 };
00067 
00068 ProfileSubComponents::
00069 ProfileSubComponents( const ProfileSubComponents& rSubComponents)
00070 {
00071         SetXMLTag(cXML_CP_SubComponents);
00072   *this = rSubComponents;
00073 };
00074 
00075 ProfileSubComponents::
00076 ~ProfileSubComponents()
00077 {
00078   Reset();
00079 };
00080 
00081 void
00082 ProfileSubComponents::
00083 SubElementLoadProcessing(const std::string& rsXMLSubTag, const std::string& rsXMLSubElement, const std::string& rsXMLSubData)
00084 {
00085   if (rsXMLSubTag==cXML_CP_SubComponent)
00086   {
00087     SubComponent::Pointer smpNewComponent = SubComponent::New();
00088 
00089     try
00090     {
00091       smpNewComponent->LoadFromString(rsXMLSubElement);
00092     }
00093     catchAllNPassMacro("Unknown error occured while loading subcomponent definition to a collection.");
00094 
00095     AddElement(smpNewComponent);
00096   }
00097   else if (rsXMLSubTag!=cXML_Text) throwExceptionMacro("Unknown xml tag, unable to load value. Incorrect Tag: " << rsXMLSubTag);
00098 };
00099 
00100 }//end of namespace FREE
00101 }//end of namespace CtrlProfile

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