1 /*---------------------------------------------------------------------------*\
5 * Copyright (C) 2003 by the OpenSG Forum *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de *
11 \*---------------------------------------------------------------------------*/
12 /*---------------------------------------------------------------------------*\
15 * This library is free software; you can redistribute it and/or modify it *
16 * under the terms of the GNU Library General Public License as published *
17 * by the Free Software Foundation, version 2. *
19 * This library is distributed in the hope that it will be useful, but *
20 * WITHOUT ANY WARRANTY; without even the implied warranty of *
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
22 * Library General Public License for more details. *
24 * You should have received a copy of the GNU Library General Public *
25 * License along with this library; if not, write to the Free Software *
26 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
28 \*---------------------------------------------------------------------------*/
29 /*---------------------------------------------------------------------------*\
37 \*---------------------------------------------------------------------------*/
41 /*-------------------------------------------------------------------------*/
44 template<class ValueT, Int32 iNamespace> inline
45 SField<ValueT, iNamespace>::SField(void) :
51 template <class ValueT, Int32 iNamespace> inline
52 SField<ValueT, iNamespace>::SField(const SField &obj) :
54 _fieldValue(obj._fieldValue)
58 template <class ValueT, Int32 iNamespace> inline
59 SField<ValueT, iNamespace>::SField(ArgumentType value) :
65 /*-------------------------------------------------------------------------*/
68 template<class ValueT, Int32 iNamespace> inline
69 SField<ValueT, iNamespace>::~SField(void)
73 /*-------------------------------------------------------------------------*/
76 template <class ValueT, Int32 iNamespace> inline
77 typename SField<ValueT, iNamespace>::reference
78 SField<ValueT, iNamespace>::getValue(void)
84 template <class ValueT, Int32 iNamespace> inline
85 typename SField<ValueT, iNamespace>::const_reference
86 SField<ValueT, iNamespace>::getValue(void) const
91 /*-------------------------------------------------------------------------*/
94 template <class ValueT, Int32 iNamespace> inline
95 void SField<ValueT, iNamespace>::setValue(ArgumentType value)
100 template <class ValueT, Int32 iNamespace> inline
101 void SField<ValueT, iNamespace>::setValue(const Self &obj)
103 _fieldValue = obj._fieldValue;
106 template <class ValueT, Int32 iNamespace> inline
107 void SField<ValueT, iNamespace>::setValueFromCString(const Char8 *str)
109 typedef typename boost::mpl::if_c<
110 (SFieldTraits ::Convertible &
111 FieldTraitsBase::FromStringConvertible) != 0,
113 StringConversionError<ValueT, iNamespace> >::type Converter;
115 Converter::getFromCString(_fieldValue, str);
118 template <class ValueT, Int32 iNamespace> inline
119 void SField<ValueT, iNamespace>::pushValueToString (std::string &str) const
121 typedef typename boost::mpl::if_c<
122 (SFieldTraits ::Convertible &
123 FieldTraitsBase::ToStringConvertible) != 0,
125 StringConversionError<ValueT, iNamespace> >::type Converter;
127 Converter::putToString(_fieldValue, str);
130 template <class ValueT, Int32 iNamespace> inline
131 void SField<ValueT, iNamespace>::pushValueFromStream(std::istream &str)
133 typedef typename boost::mpl::if_c<
134 (SFieldTraits ::Convertible &
135 FieldTraitsBase::FromStreamConvertible) != 0,
137 StreamConversionError<ValueT, iNamespace> >::type Converter;
139 Converter::getFromStream(_fieldValue, str);
142 template <class ValueT, Int32 iNamespace> inline
143 void SField<ValueT, iNamespace>::pushValueToStream (OutStream &str) const
145 typedef typename boost::mpl::if_c<
146 (SFieldTraits ::Convertible &
147 FieldTraitsBase::ToStreamConvertible) != 0,
149 StreamConversionError<ValueT, iNamespace> >::type Converter;
151 Converter::putToStream(_fieldValue, str);
154 template <class ValueT, Int32 iNamespace> inline
155 void SField<ValueT, iNamespace>::pushSizeToStream (OutStream &str) const
160 /*-------------------------------------------------------------------------*/
161 /* Binary Interface */
163 template <class ValueTypeT, Int32 iNameSpace> inline
164 SizeT SField<ValueTypeT, iNameSpace>::getBinSize(void) const
166 return SFieldTraits::getBinSize(_fieldValue);
169 template <class ValueTypeT, Int32 iNameSpace> inline
170 void SField<ValueTypeT, iNameSpace>::copyToBin(BinaryDataHandler &pMem) const
172 SFieldTraits::copyToBin( pMem,
176 template <class ValueTypeT, Int32 iNameSpace> inline
177 void SField<ValueTypeT, iNameSpace>::copyFromBin(BinaryDataHandler &pMem)
179 SFieldTraits::copyFromBin( pMem,
183 /*-------------------------------------------------------------------------*/
186 #ifdef OSG_MT_CPTR_ASPECT
187 template <class ValueT, Int32 iNamespace> inline
188 void SField<ValueT, iNamespace>::syncWith(Self &source)
194 /*-------------------------------------------------------------------------*/
197 template <class ValueT, Int32 iNamespace> inline
198 bool SField<ValueT, iNamespace>::operator ==(const SField &source) const
200 return _fieldValue == source._fieldValue;
203 /*-------------------------------------------------------------------------*/
206 template <class ValueT, Int32 iNamespace> inline
207 void SField<ValueT, iNamespace>::operator =(const SField &source)
211 _fieldValue = source._fieldValue;