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: freProfileMedia.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 "freProfileMedia.h" 00023 #include "freConvert.h" 00024 namespace FREE 00025 { 00026 namespace CtrlProfile 00027 { 00031 00032 00033 00034 const Media::DimensionType Media::DT_AllDimensions = cMDDAny; 00035 00036 Media& 00037 Media:: 00038 operator = (const Media& rMedia) 00039 { 00040 if (this == &rMedia) return *this; 00041 00042 m_Access = rMedia.GetAccess(); 00043 m_Dimension = rMedia.GetDimension(); 00044 m_MediaType = rMedia.GetDataType(); 00045 m_bInternal = rMedia.GetInternal(); 00046 m_bTemplate = rMedia.GetIsTemplate(); 00047 m_iGroup = rMedia.GetGroup(); 00048 00049 return *this; 00050 }; 00051 00052 Media:: 00053 Media() : XMLStreamObject(FREE::cXML_CP_Media) 00054 { 00055 Reset(); 00056 }; 00057 00058 Media:: 00059 ~Media() 00060 { 00061 }; 00062 00063 void 00064 Media:: 00065 Reset() 00066 { 00067 XMLStreamObject::Reset(); 00068 00069 m_Access = DAAny; 00070 m_Dimension = DT_AllDimensions; 00071 m_MediaType = ""; 00072 m_bInternal = false; 00073 m_bTemplate = false; 00074 m_iGroup = 1; 00075 }; 00076 00077 void 00078 Media:: 00079 AttributesLoadProcessing(const AttributesType& rAttributes) 00080 { 00081 for (AttributesType::const_iterator pos = rAttributes.begin(); pos!= rAttributes.end(); pos++) 00082 { 00083 if (pos->first==cXML_CP_MediaAccess) m_Access = Convert::ToDataAccessType(pos->second); 00084 else if (pos->first==cXML_CP_MediaName) m_Name = pos->second; 00085 else if (pos->first==cXML_CP_MediaDim) m_Dimension = Convert::ToInt(pos->second); 00086 else if (pos->first==cXML_CP_MediaType) m_MediaType = pos->second; 00087 else if (pos->first==cXML_CP_MediaInternal) m_bInternal = ::FREE::Convert::ToBool(pos->second); 00088 else if (pos->first==cXML_CP_Template) m_bTemplate = ::FREE::Convert::ToBool(pos->second); 00089 else if (pos->first==cXML_CP_Group) m_iGroup = ::FREE::Convert::ToInt(pos->second); 00090 }; 00091 }; 00092 00093 void 00094 Media:: 00095 SaveAttributes(AttributesSaveListType& rAttributes) const 00096 { 00097 rAttributes.push_back(AttributesType::value_type(cXML_CP_MediaName,m_Name)); 00098 rAttributes.push_back(AttributesType::value_type(cXML_CP_MediaType,m_MediaType)); 00099 00100 if (m_Access!=DAAny) rAttributes.push_back(AttributesType::value_type(cXML_CP_MediaAccess,Convert::ToStr(m_Access))); 00101 if (m_Dimension!=DT_AllDimensions) rAttributes.push_back(AttributesType::value_type(cXML_CP_MediaDim,Convert::ToStr(m_Dimension))); 00102 if (m_bInternal) rAttributes.push_back(AttributesType::value_type(cXML_CP_MediaInternal,"true")); 00103 if (m_iGroup) rAttributes.push_back(AttributesType::value_type(cXML_CP_Group,::FREE::Convert::ToStr(m_iGroup))); 00104 if (m_bTemplate) rAttributes.push_back(AttributesType::value_type(cXML_CP_Template,"true")); 00105 }; 00106 00107 }//end of namespace FREE 00108 }//end of namespace CtrlProfile
1.5.3 written by Dimitri van Heesch,
© 1997-2000