1 /*---------------------------------------------------------------------------*\
5 * Copyright (C) 2008 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 \*---------------------------------------------------------------------------*/
39 #ifndef _OSGPOINTERSFIELD_H_
40 #define _OSGPOINTERSFIELD_H_
46 #include "OSGConfig.h"
47 #include "OSGPointerSFieldCommon.h"
48 #include "OSGPointerAccessHandler.h"
52 /*---------------------------------------------------------------------------*/
53 /* WeakPointerSField<FieldConfigT> */
54 /*---------------------------------------------------------------------------*/
56 /*! \ingroup GrpBaseFieldContainerFields
57 \ingroup GrpLibOSGBase
60 template <class PtrTypeT
,
61 typename RefCountPolicy
,
64 public PointerSFieldCommon
<PointerAccessHandler
<RefCountPolicy
>,
68 /*========================== PUBLIC =================================*/
72 /*---------------------------------------------------------------------*/
73 /*! \name Public Types */
76 typedef PointerSFieldCommon
<
77 PointerAccessHandler
<RefCountPolicy
>,
78 NamespaceI
> Inherited
;
81 typedef PointerSField Self
;
83 typedef PtrTypeT value_type
;
84 typedef PtrTypeT
const const_value
;
86 typedef value_type StoredType
;
88 typedef FieldTraits
<value_type
,
89 NamespaceI
> SFieldTraits
;
91 typedef FieldDescription
<SFieldTraits
,
92 FieldType::SingleField
,
94 FieldType::PtrField
> Description
;
99 typedef EditFCPtrSFieldHandle
<Self
> EditHandle
;
100 typedef boost::shared_ptr
<EditHandle
> EditHandlePtr
;
102 typedef GetFCPtrSFieldHandle
<Self
> GetHandle
;
103 typedef boost::shared_ptr
<GetHandle
> GetHandlePtr
;
105 // handles for dynamic fields -- XXX TODO
106 // typedef EditPointerSFieldHandle<Self> DynamicEditHandle;
107 // typedef typename EditPointerSFieldHandle<Self>::Ptr DynamicEditHandlePtr;
109 // typedef GetPointerSFieldHandle <Self> DynamicGetHandle;
110 // typedef typename GetPointerSFieldHandle <Self>::Ptr DynamicGetHandlePtr;
114 /*---------------------------------------------------------------------*/
115 /*! \name Constants */
118 static FieldType::Cardinality
const Card
= FieldType::SingleField
;
119 static FieldType::Class
const Class
= FieldType::PtrField
;
122 /*---------------------------------------------------------------------*/
123 /*! \name Class Type */
126 static const FieldType
&getClassType(void);
129 /*---------------------------------------------------------------------*/
130 /*! \name Constructors */
133 PointerSField( void );
134 PointerSField(const Self
&source
);
136 explicit PointerSField( const_value value
);
139 /*---------------------------------------------------------------------*/
140 /*! \name Destructor */
143 ~PointerSField(void);
146 /*---------------------------------------------------------------------*/
150 const_value
getValue( void ) const;
152 void setValue( const_value value
);
153 void setValue(const Self
&source
);
156 /*---------------------------------------------------------------------*/
157 /*! \name FieldDesc creation */
160 static FieldDescriptionBase
*
161 createFieldDescription (const Char8
*szFieldname
,
163 FieldEditMethod fEditMethod
,
164 FieldGetMethod fGetMethod
);
166 static FieldDescriptionBase
*
167 createIdxFieldDescription(const Char8
*szFieldname
,
169 FieldIndexEditMethod fEditMethod
,
170 FieldIndexGetMethod fGetMethod
);
173 /*---------------------------------------------------------------------*/
174 /*! \name Binary IO */
177 void copyFromBin(BinaryDataHandler
&pMem
);
180 /*---------------------------------------------------------------------*/
184 #ifdef OSG_MT_CPTR_ASPECT
185 void syncWith(Self
&source
);
189 /*---------------------------------------------------------------------*/
190 /*! \name Assignment */
193 const Self
&operator = (const Self
&source
);
196 /*========================= PROTECTED ===============================*/
200 /*---------------------------------------------------------------------*/
204 static FieldType _fieldType
;
207 /*========================== PRIVATE ================================*/
214 #include "OSGPointerSField.inl"
216 #endif // _OSGWEAKPOINTERSFIELD_H_