freProfileSubComponent.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: freProfileSubComponent.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 "freProfileSubComponent.h"
00023 
00024 #include "freConvert.h"
00025 
00026 namespace FREE
00027 {
00028 namespace CtrlProfile
00029 {
00033 
00034 
00035 SubComponent&
00036 SubComponent::
00037 operator = (const SubComponent& rSubComponent)
00038 {
00039   if (this == &rSubComponent) return *this;
00040 
00041         m_sComponentID = rSubComponent.GetComponentID();
00042         m_iRequired = rSubComponent.GetIsRequired();
00043         m_sControllerID = rSubComponent.GetControllerID();
00044   m_bInternal = rSubComponent.GetInternal();
00045         m_bTemplate = rSubComponent.GetIsTemplate();
00046 
00047   return *this;
00048 };
00049 
00050 SubComponent::
00051 SubComponent() : XMLStreamObject(FREE::cXML_CP_SubComponent)
00052 {
00053   Reset();
00054 };
00055 
00056 SubComponent::
00057 ~SubComponent()
00058 {
00059 };
00060 
00061 void
00062 SubComponent::
00063 Reset()
00064 {
00065   XMLStreamObject::Reset();
00066 
00067         m_sComponentID = "";
00068   m_iRequired = 1;
00069         m_sControllerID = csUndefinedController;
00070   m_bInternal = false;
00071   m_bTemplate = false;
00072 };
00073 
00074 void
00075 SubComponent::
00076 AttributesLoadProcessing(const AttributesType& rAttributes)
00077 {
00078   for (AttributesType::const_iterator pos = rAttributes.begin(); pos!= rAttributes.end(); pos++)
00079   {
00080     if (pos->first==cXML_CP_SubCompID) m_sComponentID = pos->second;
00081     else if (pos->first==cXML_CP_SubCompCtrlID) m_sControllerID = pos->second;
00082         else if (pos->first==cXML_CP_SubCompInternal) m_bInternal = ::FREE::Convert::ToBool(pos->second);
00083                 else if (pos->first==cXML_CP_SubCompRequired) m_iRequired = Convert::ToInt(pos->second);
00084     else if (pos->first==cXML_CP_Template) m_bTemplate = ::FREE::Convert::ToBool(pos->second);
00085   };
00086 };
00087 
00088 void
00089 SubComponent::
00090 SaveAttributes(AttributesSaveListType& rAttributes) const
00091 {
00092   rAttributes.push_back(AttributesType::value_type(cXML_CP_SubCompID,m_sComponentID));
00093 
00094         if (m_iRequired!=1) rAttributes.push_back(AttributesType::value_type(cXML_CP_SubCompRequired,Convert::ToStr(m_iRequired)));
00095         if (m_sControllerID.size()!=0) rAttributes.push_back(AttributesType::value_type(cXML_CP_SubCompCtrlID,m_sControllerID));
00096         if (m_bInternal) rAttributes.push_back(AttributesType::value_type(cXML_CP_SubCompInternal,"true"));
00097         if (m_bTemplate) rAttributes.push_back(AttributesType::value_type(cXML_CP_Template,"true"));
00098 }; 
00099 
00100 void
00101 SubComponent::
00102 SubElementLoadProcessing(const std::string& rsXMLSubTag, const std::string& rsXMLSubElement, const std::string& rsXMLSubData)
00103 {
00104   if (rsXMLSubTag==cXML_CP_SubCompDescription)
00105   {
00106     m_sDescription = rsXMLSubData;
00107   }
00108 };
00109 
00110 std::string
00111 SubComponent::
00112 SaveData(const unsigned int& iDepth, bool& bHasSubElements) const
00113 {
00114   std::string sResult;
00115 
00116   if (m_sDescription!="") AddSubElement(sResult,cXML_CP_SubCompDescription,m_sDescription,iDepth);
00117 
00118   return sResult;
00119 };
00120 
00121 }//end of namespace FREE
00122 }//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