Hi Gerrit,
Gerrit Voss wrote:
On Fri, 2008-05-30 at 15:32 -0500, Carsten Neumann wrote:
For custom access fields it is the responsibility of the container to
register appropriate functions with the handle (by calling setAddMethod
etc.) in {get,edit}Handle<FieldName>. Some of these functions might not
be available even (hence all the bool return values).
>
I don't like the way to figure out if something is available after the
fact. If you already plan to extend the field description (below)
couldn't we use that to query the handle which functions are available ?
This way the bool return values can go.
well, yes and no. We can add functions to query what is available, but
since EditMFieldHandle<FieldContainerPtrMFieldBase> (as the base class
of the EditFCPtrMFieldHandle<FieldT>) already advertises the pure
virtual functions, something has to happen if they are called. After all
what should happen if the handle's replace is called and it can not do
anything sensible because the field has custom access and no function of
the container was registered to perform a replace ?
As for the function registration. Again, if possible I would like to use
the fcdEdit to name the function and have the Class, as opposed to
Base, implement it.
I've not touched the template files yet, so it is not a problem to make
the name of the function that is passed to setAddFunction and co.
customizable.
But how do you get that function name into the handle, i.e. how can the
handle know that it should call "add<FieldName>" to perform an add ?
All I've done is extend the mechanism that was already used for add/set,
are you saying that was a stop gap and the real solution should be
something different ?
If yes, that is fine, but from the above I can not really understand
what that solution should look like. Could you elaborate please ?
That is how it is done now for the few functions
OpenSG needs internally (e.g. clear) and it removes the need to mess
with the init system and to store the registered functions somewhere.
Sorry, I don't understand this part. Basically the problem boils down to
this:
- there is some container that stores pointers and the user wants extra
control over the pointers stored.
- the user marks the field as custom access in the fcd and the base
class does not contain functions to manipulate the container.
- the edit handle for that field should not change the field directly as
that would bypass the extra control
- the user implements in the class (not the base) some functions to add
pointers to the special field.
- the edit handle somehow has to know that it should call these
functions of the container.
Now there are two options:
1) make the container a template argument of the handle, have the user
mention the names of the functions he implements for access in the fcd
and use this information to generate a specialization of the handle for
that container/field combination.
2a) register the functions to call (bound to a container instance) with
the handle, when it is created.
2b) store the functions to call in the field description and keep a
pointer to the container in the handle to call these functions with.
2a of course is what currently happens with the
setSetMethod/setAddMethod calls in editHandle<FieldName>.
What am I missing here ?
I don't see the need to dynamically alter which access methods are
available, which you can't anyway if you want to use the
field description for the access type (below) as this one is 'static'
for the class.
agreed, this need not be dynamic.
For all access types (std, null-check, custom) get, find and size will
go directly to the field, i.e. read access can not be "intercepted".
This seems to make the most sense given that currently the container
always has at least a get<FieldName> function.
On the implementation side I'll add
// for custom access fields
typedef boost::function<void (FieldContainer *)> AddMethod;
typedef boost::function<void (UInt32) > RemoveMethod;
typedef boost::function<void (UInt32,
FieldContainer *)> InsertMethod;
typedef boost::function<void (UInt32,
FieldContainer *)> ReplaceMethod;
typedef boost::function<void (void) > ClearMethod;
to EditMFieldHandle<FieldContainerPtrMFieldBase> and place the
information on what access type to use in the FieldDescription (maybe as
FieldFlags?).
ok, except FieldFlags is already taken for the MT/Cluster flags so I
would prefer something else, like GenericAccessFlags.
oh, ok, I was not aware that FieldFlags are reserved for these they
certainly have spare bits ATM, but I can find another place/add another
variable to FieldDescription to store this info.
Anyway, for reference I've attached the patch I had done so far, but as
I said above, if that is not the way things should be done I'm fine with
a different approach as well.
Thanks,
Carsten
Index: Source/System/FieldContainer/Fields/Handle/OSGFieldContainerMFieldHandle.h
===================================================================
--- Source/System/FieldContainer/Fields/Handle/OSGFieldContainerMFieldHandle.h (revision 1266)
+++ Source/System/FieldContainer/Fields/Handle/OSGFieldContainerMFieldHandle.h (working copy)
@@ -55,11 +55,7 @@
protected:
typedef EditFieldHandle Inherited;
-
- typedef boost::function<void(FieldContainer * const)> AddMethod;
-
- AddMethod _fAddMethod;
-
+
/*========================== PUBLIC =================================*/
public:
@@ -79,21 +75,25 @@
/*---------------------------------------------------------------------*/
- virtual void add (FieldContainer * const pNewElement);
- virtual void replace(UInt32 const uiIndex,
- FieldContainer * const pNewElement);
+ virtual FieldContainer *get (UInt32 index ) const = 0;
+ virtual UInt32 size (void ) const = 0;
+ virtual Int32 find (FieldContainer *existingFC) const = 0;
+
+ virtual bool add (FieldContainer *newFC ) = 0;
+ virtual bool remove (UInt32 index ) = 0;
+ virtual bool insert (UInt32 index,
+ FieldContainer *newFC ) = 0;
+ virtual bool replace(UInt32 index,
+ FieldContainer *newFC ) = 0;
+ virtual bool clear (void ) = 0;
/*---------------------------------------------------------------------*/
virtual void pushValueToStream(OutStream &str) const;
virtual void pushSizeToStream (OutStream &str) const;
-
+
/*---------------------------------------------------------------------*/
- void setAddMethod(AddMethod fMethod);
-
- /*---------------------------------------------------------------------*/
-
virtual bool equal(Inherited::Ptr rhs) const;
/*---------------------------------------------------------------------*/
@@ -203,12 +203,23 @@
protected:
+ typedef FieldT HandledField;
typedef EditMFieldHandle<FieldContainerPtrMFieldBase> Inherited;
typedef boost::function<void (typename FieldT::const_value)> AddMethod;
+ typedef boost::function<void (UInt32) > RemoveMethod;
+ typedef boost::function<void (UInt32,
+ typename FieldT::const_value)> InsertMethod;
+ typedef boost::function<void (UInt32,
+ typename FieldT::const_value)> ReplaceMethod;
+ typedef boost::function<void (void) > ClearMethod;
- AddMethod _fAddMethod;
+ AddMethod _fAddMethod;
+ RemoveMethod _fRemoveMethod;
+ InsertMethod _fInsertMethod;
+ ReplaceMethod _fReplaceMethod;
+ ClearMethod _fClearMethod;
/*========================== PUBLIC =================================*/
@@ -220,9 +231,17 @@
/*---------------------------------------------------------------------*/
- virtual void add (FieldContainer * const pNewElement);
- virtual void replace(UInt32 const uiIndex,
- FieldContainer * const pNewElement);
+ virtual FieldContainer *get (UInt32 index ) const;
+ virtual UInt32 size (void ) const;
+ virtual Int32 find (FieldContainer *existingFC) const;
+
+ virtual bool add (FieldContainer *newFC );
+ virtual bool remove (UInt32 index );
+ virtual bool insert (UInt32 index,
+ FieldContainer *newFC );
+ virtual bool replace(UInt32 index,
+ FieldContainer *newFC );
+ virtual bool clear (void );
/*---------------------------------------------------------------------*/
@@ -235,7 +254,11 @@
/*---------------------------------------------------------------------*/
- void setAddMethod(AddMethod fMethod);
+ void setAddMethod (AddMethod fMethod);
+ void setRemoveMethod (RemoveMethod fMethod);
+ void setInsertMethod (InsertMethod fMethod);
+ void setReplaceMethod (ReplaceMethod fMethod);
+ void setClearMethod (ClearMethod fMethod);
// virtual bool equal(Ptr rhs);
@@ -254,6 +277,11 @@
const TypePtrVector &ignoreTypes = TypePtrVector(),
const TypeIdVector &shareGroupIds = TypeIdVector (),
const TypeIdVector &ignoreGroupIds = TypeIdVector ()) const;
+
+ /*========================== PRIVATE ================================*/
+ private:
+ HandledField *dcast (void);
+ const HandledField *dcast_const(void) const;
};
OSG_END_NAMESPACE
Index: Source/System/FieldContainer/Fields/Handle/OSGFieldContainerSFieldHandle.inl
===================================================================
--- Source/System/FieldContainer/Fields/Handle/OSGFieldContainerSFieldHandle.inl (revision 1266)
+++ Source/System/FieldContainer/Fields/Handle/OSGFieldContainerSFieldHandle.inl (working copy)
@@ -43,7 +43,6 @@
const EditSFieldHandle &source) :
Inherited (source ),
- _pContainer(source._pContainer),
_fSetMethod(source._fSetMethod)
{
}
@@ -55,7 +54,6 @@
Inherited (pField,
pDescription),
- _pContainer(NULL ),
_fSetMethod(NULL )
{
}
Index: Source/System/FieldContainer/Fields/Handle/OSGFieldContainerSFieldHandle.h
===================================================================
--- Source/System/FieldContainer/Fields/Handle/OSGFieldContainerSFieldHandle.h (revision 1266)
+++ Source/System/FieldContainer/Fields/Handle/OSGFieldContainerSFieldHandle.h (working copy)
@@ -56,12 +56,11 @@
typedef EditFieldHandle Inherited;
- typedef boost::function<void(FieldContainer * const)> SetMethod;
+ typedef boost::function<void (FieldContainer * const)> SetMethod;
/*========================== PUBLIC =================================*/
- FieldContainer *_pContainer;
- SetMethod _fSetMethod;
+ SetMethod _fSetMethod;
public:
Index: Source/System/FieldContainer/Fields/Handle/OSGFieldContainerMFieldHandle.inl
===================================================================
--- Source/System/FieldContainer/Fields/Handle/OSGFieldContainerMFieldHandle.inl (revision 1266)
+++ Source/System/FieldContainer/Fields/Handle/OSGFieldContainerMFieldHandle.inl (working copy)
@@ -42,8 +42,7 @@
EditMFieldHandle<FieldContainerPtrMFieldBase>::EditMFieldHandle(
const EditMFieldHandle &source) :
- Inherited (source ),
- _fAddMethod(source._fAddMethod)
+ Inherited(source)
{
}
@@ -52,9 +51,8 @@
FieldContainerPtrMFieldBase *pField,
const FieldDescriptionBase *pDescription) :
- Inherited (pField,
- pDescription),
- _fAddMethod(NULL )
+ Inherited(pField,
+ pDescription)
{
}
@@ -72,26 +70,6 @@
}
inline
-void EditMFieldHandle<FieldContainerPtrMFieldBase>::add(
- FieldContainer * const pNewElement)
-{
- // for whatever reason VS2003 does not like == NULL
- if(_fAddMethod)
- {
- _fAddMethod(pNewElement);
- }
-}
-
-
-inline
-void EditMFieldHandle<FieldContainerPtrMFieldBase>::replace(
- UInt32 const uiIndex,
- FieldContainer * const pNewElement)
-{
- OSG_ASSERT(false);
-}
-
-inline
void EditMFieldHandle<FieldContainerPtrMFieldBase>::pushValueToStream(
OutStream &str) const
{
@@ -110,13 +88,6 @@
}
inline
-void EditMFieldHandle<FieldContainerPtrMFieldBase>::setAddMethod(
- AddMethod fMethod)
-{
- _fAddMethod = fMethod;
-}
-
-inline
bool EditMFieldHandle<FieldContainerPtrMFieldBase>::equal(
Inherited::Ptr rhs) const
{
@@ -261,7 +232,7 @@
/*---------------------------------------------------------------------*/
-template<class FieldT> inline
+template <class FieldT> inline
GetFCPtrMFieldHandle<FieldT>::GetFCPtrMFieldHandle(
const GetFCPtrMFieldHandle &source) :
@@ -269,7 +240,7 @@
{
}
-template<class FieldT> inline
+template <class FieldT> inline
GetFCPtrMFieldHandle<FieldT>::GetFCPtrMFieldHandle(
const FieldT *pField,
const FieldDescriptionBase *pDescription) :
@@ -278,13 +249,13 @@
{
}
-template<class FieldT> inline
+template <class FieldT> inline
const FieldType &GetFCPtrMFieldHandle<FieldT>::getType(void) const
{
return FieldT::getClassType();
}
-template<class FieldT> inline
+template <class FieldT> inline
void GetFCPtrMFieldHandle<FieldT>::pushValueToStream(OutStream &str) const
{
FWARNING(("illegal pushValueToStream called for %s\n",
@@ -292,7 +263,7 @@
OSG_ASSERT(false);
}
-template<class FieldT> inline
+template <class FieldT> inline
void GetFCPtrMFieldHandle<FieldT>::pushSizeToStream(OutStream &str) const
{
FWARNING(("illegal pushSizeToStream called for %s\n",
@@ -300,13 +271,13 @@
OSG_ASSERT(false);
}
-template<class FieldT> inline
+template <class FieldT> inline
FieldT const *GetFCPtrMFieldHandle<FieldT>::operator ->(void)
{
return static_cast<FieldT const *>(_pField);
}
-template<class FieldT> inline
+template <class FieldT> inline
FieldT const &GetFCPtrMFieldHandle<FieldT>::operator * (void)
{
return *(static_cast<FieldT const *>(_pField));
@@ -315,62 +286,313 @@
/*---------------------------------------------------------------------*/
-template<class FieldT> inline
+template <class FieldT> inline
EditFCPtrMFieldHandle<FieldT>::EditFCPtrMFieldHandle(
const EditFCPtrMFieldHandle &source) :
- Inherited (source ),
- _fAddMethod(source._fAddMethod)
+ Inherited (source ),
+ _fAddMethod (source._fAddMethod ),
+ _fRemoveMethod (source._fRemoveMethod ),
+ _fInsertMethod (source._fInsertMethod ),
+ _fReplaceMethod(source._fReplaceMethod),
+ _fClearMethod (source._fClearMethod )
{
}
-template<class FieldT> inline
+template <class FieldT> inline
EditFCPtrMFieldHandle<FieldT>::EditFCPtrMFieldHandle(
FieldT *pField,
const FieldDescriptionBase *pDescription) :
- Inherited (pField,
- pDescription),
- _fAddMethod(NULL )
+ Inherited (pField,
+ pDescription),
+ _fAddMethod ( ),
+ _fRemoveMethod ( ),
+ _fInsertMethod ( ),
+ _fReplaceMethod( ),
+ _fClearMethod ( )
{
}
-template<class FieldT> inline
+template <class FieldT> inline
const FieldType &EditFCPtrMFieldHandle<FieldT>::getType(void) const
{
return FieldT::getClassType();
}
-template<class FieldT> inline
-void EditFCPtrMFieldHandle<FieldT>::add(FieldContainer * const pNewElement)
+template <class FieldT> inline
+FieldContainer *EditFCPtrMFieldHandle<FieldT>::get(UInt32 index) const
{
- typename FieldT::const_value pVal =
- dynamic_cast<typename FieldT::const_value>(pNewElement);
+ return (*dcast_const())[index];
+}
- if(pNewElement != NULL && pVal == NULL)
- return;
+template <class FieldT> inline
+UInt32 EditFCPtrMFieldHandle<FieldT>::size(void) const
+{
+ return dcast_const()->size();
+}
- // for whatever reason VS2003 does not like == NULL
- if(_fAddMethod)
+template <class FieldT> inline
+Int32 EditFCPtrMFieldHandle<FieldT>::find(FieldContainer *existingFC) const
+{
+ Int32 retVal = -1;
+ typename FieldT::const_value typedExistingFC =
+ dynamic_cast<typename FieldT::const_value>(existingFC);
+
+#if 0
+ if(0x0000 != (_pDescription->getFlags() & Field::CustomAccess) ||
+ 0x0000 != (_pDescription->getFlags() & Field::StdAccess ) )
{
- _fAddMethod(pVal);
+// #endif
+ if(typedExistingFC != NULL || existingFC == NULL)
+ {
+ retVal = dcast_const()->find(typedExistingFC);
+ }
+// #if 0
}
- else
+ else if(0x0000 != (_pDescription->getFlags() & Field::NullCheckAccess))
{
- FFATAL(("EditFCPtrMFieldHandle<FieldT>::add called but "
- "_fAddMethod not set!\n"));
+// #endif
+ retVal = dcast_const()->find(typedExistingFC);
+// #if 0
}
+#endif
+
+ return retVal;
}
-template<class FieldT> inline
-void EditFCPtrMFieldHandle<FieldT>::replace(
- UInt32 const uiIndex,
- FieldContainer * const pNewElement)
+template <class FieldT> inline
+bool EditFCPtrMFieldHandle<FieldT>::add(FieldContainer *newFC)
{
- OSG_ASSERT(false);
+ bool retVal = false;
+ typename FieldT::const_value typedNewFC =
+ dynamic_cast<typename FieldT::const_value>(newFC);
+
+#if 0
+ if(0x000 != (_pDescription->getFlags() & Field::CustomAccess))
+ {
+// #endif
+ if(typedNewFC != NULL || newFC == NULL)
+ {
+ if(_fAddMethod)
+ {
+ _fAddMethod(typedNewVal);
+ retVal = true;
+ }
+ else
+ {
+ FFATAL(("EditFCPtrMFieldHandle<FieldT>::add called, but "
+ "_fAddMethod is not set.\n"));
+ }
+ }
+// #if 0
+ }
+ else if(0x000 != (_pDescription->getFlags() & Field::NullCheckAccess))
+ {
+// #endif
+ if(typedNewFC != NULL)
+ {
+ dcast()->push_back(typedNewFC);
+ retVal = true;
+ }
+// #if 0
+ }
+ else if(0x000 != (_pDescription->getFlags() & Field::StdAccess))
+ {
+// #endif
+ if(typedNewFC != NULL || newFC == NULL)
+ {
+ dcast()->push_back(typedNewFC);
+ retVal = true;
+ }
+// #if 0
+ }
+#endif
+
+ return retVal;
}
-template<class FieldT> inline
+template <class FieldT> inline
+bool EditFCPtrMFieldHandle<FieldT>::remove(UInt32 index)
+{
+ bool retVal = false;
+
+#if 0
+ if(0x000 != (_pDescription->getFlags() & Field::CustomAccess))
+ {
+// #endif
+ if(_fRemoveMethod)
+ {
+ _fRemoveMethod(index);
+ retVal = true;
+ }
+ else
+ {
+ FFATAL(("EditFCPtrMFieldHandle<FieldT>::remove called, but "
+ "_fRemoveMethod is not set.\n"));
+ }
+// #if 0
+ }
+ else if(0x000 != (_pDescription->getFlags() & Field::NullCheckAccess))
+ {
+// #endif
+ dcast()->erase(dcast()->begin_nc() + index);
+ retVal = true;
+// #if 0
+ }
+ else if(0x000 != (_pDescription->getFlags() & Field::StdAccess))
+ {
+// #endif
+ dcast()->erase(dcast()->begin_nc() + index);
+ retVal = true;
+// #if 0
+ }
+#endif
+
+ return retVal;
+}
+
+template <class FieldT> inline
+bool EditFCPtrMFieldHandle<FieldT>::insert(UInt32 index, FieldContainer *newFC)
+{
+ bool retVal = false;
+ typename FieldT::const_value typedNewFC =
+ dynamic_cast<typename FieldT::const_value>(newFC);
+
+#if 0
+ if(0x000 != (_pDescription->getFlags() & Field::CustomAccess))
+ {
+// #endif
+ if(typedNewFC != NULL || newFC == NULL)
+ {
+ if(_fInsertMethod)
+ {
+ _fInsertMethod(index, typedNewFC);
+ retVal = true;
+ }
+ else
+ {
+ FFATAL(("EditFCPtrMFieldHandle<FieldT>::insert called, but "
+ "_fInsertMethod is not set.\n"));
+ }
+// #if 0
+ }
+ else if(0x000 != (_pDescription->getFlags() & Field::NullCheckAccess))
+ {
+// #endif
+ if(typedNewFC != NULL)
+ {
+ dcast()->insert(dcast()->begin() + index, typedNewFC);
+ retVal = true;
+ }
+// #if 0
+ }
+ else if(0x000 != (_pDescription->getFlags() & Field::StdAccess))
+ {
+// #endif
+ if(typedNewFC != NULL || newFC == NULL)
+ {
+ dcast()->insert(dcast()->begin() + index, typedNewFC);
+ retVal = true;
+ }
+// #if 0
+ }
+#endif
+
+ return retVal;
+}
+
+template <class FieldT> inline
+bool EditFCPtrMFieldHandle<FieldT>::replace(UInt32 index, FieldContainer *newFC)
+{
+ bool retVal = false;
+ typename FieldT::const_value typedNewFC =
+ dynamic_cast<typename FieldT::const_value>(newFC);
+
+#if 0
+ if(0x000 != (_pDescription->getFlags() & Field::CustomAccess))
+ {
+// #endif
+ if(typedNewFC != NULL || newFC == NULL)
+ {
+ if(_fReplaceMethod)
+ {
+ _fReplaceMethod(index, typedNewFC);
+ retVal = true;
+ }
+ else
+ {
+ FFATAL(("EditFCPtrMFieldHandle<FieldT>::replace called, but "
+ "_fReplaceMethod is not set.\n"));
+ }
+// #if 0
+ }
+ else if(0x000 != (_pDescription->getFlags() & Field::NullCheckAccess))
+ {
+// #endif
+ if(typedNewFC != NULL)
+ {
+ (*dcast())[index] = typedNewFC;
+ retVal = true;
+ }
+// #if 0
+ }
+ else if(0x000 != (_pDescription->getFlags() & Field::StdAccess))
+ {
+// #endif
+ if(typedNewFC != NULL || newFC == NULL)
+ {
+ (*dcast())[index] = typedNewFC;
+ retVal = true;
+ }
+// #if 0
+ }
+#endif
+
+ return retVal;
+}
+
+template <class FieldT> inline
+bool EditFCPtrMFieldHandle<FieldT>::clear(void)
+{
+ bool retVal = false;
+
+#if 0
+ if(0x000 != (_pDescription->getFlags() & Field::CustomAccess))
+ {
+// #endif
+ if(_fClearMethod)
+ {
+ _fClearMethod();
+ retVal = true;
+ }
+ else
+ {
+ FFATAL(("EditFCPtrMFieldHandle<FieldT>::clear called, but "
+ "_fClearMethod is not set.\n"));
+ }
+// #if 0
+ }
+ else if(0x000 != (_pDescription->getFlags() & Field::NullCheckAccess))
+ {
+// #endif
+ dcast()->clear();
+ retVal = true;
+// #if 0
+ }
+ else if(0x000 != (_pDescription->getFlags() & Field::StdAccess))
+ {
+// #endif
+ dcast()->clear();
+ retVal = true;
+// #if 0
+ }
+#endif
+
+ return retVal;
+}
+
+template <class FieldT> inline
void EditFCPtrMFieldHandle<FieldT>::pushValueToStream(OutStream &str) const
{
FWARNING(("illegal pushValueToStream called for %s\n",
@@ -378,7 +600,7 @@
OSG_ASSERT(false);
}
-template<class FieldT> inline
+template <class FieldT> inline
void EditFCPtrMFieldHandle<FieldT>::pushSizeToStream(OutStream &str) const
{
FWARNING(("illegal pushSizeToStream called for %s\n",
@@ -386,13 +608,37 @@
OSG_ASSERT(false);
}
-template<class FieldT> inline
+template <class FieldT> inline
void EditFCPtrMFieldHandle<FieldT>::setAddMethod(AddMethod fMethod)
{
_fAddMethod = fMethod;
}
-template<class FieldT> inline
+template <class FieldT> inline
+void EditFCPtrMFieldHandle<FieldT>::setRemoveMethod(RemoveMethod fMethod)
+{
+ _fRemoveMethod = fMethod;
+}
+
+template <class FieldT> inline
+void EditFCPtrMFieldHandle<FieldT>::setInsertMethod(InsertMethod fMethod)
+{
+ _fInsertMethod = fMethod;
+}
+
+template <class FieldT> inline
+void EditFCPtrMFieldHandle<FieldT>::setReplaceMethod(ReplaceMethod fMethod)
+{
+ _fReplaceMethod = fMethod;
+}
+
+template <class FieldT> inline
+void EditFCPtrMFieldHandle<FieldT>::setClearMethod(ClearMethod fMethod)
+{
+ _fClearMethod = fMethod;
+}
+
+template <class FieldT> inline
void EditFCPtrMFieldHandle<FieldT>::pushValueFromCString(const Char8 *str)
{
FWARNING(("illegal pushValueFromCString called for %s\n",
@@ -400,7 +646,7 @@
OSG_ASSERT(false);
}
-template<class FieldT> inline
+template <class FieldT> inline
void EditFCPtrMFieldHandle<FieldT>::copyValues(GetFieldHandlePtr source) const
{
FWARNING(("illegal copyValues called for %s\n",
@@ -408,13 +654,13 @@
OSG_ASSERT(false);
}
-template<class FieldT> inline
+template <class FieldT> inline
void EditFCPtrMFieldHandle<FieldT>::shareValues(GetFieldHandlePtr source) const
{
OSG_ASSERT(false);
}
-template<class FieldT> inline
+template <class FieldT> inline
void EditFCPtrMFieldHandle<FieldT>::cloneValues(
GetFieldHandlePtr pSrc,
const TypePtrVector &shareTypes,
@@ -425,5 +671,19 @@
OSG_ASSERT(false);
}
+template <class FieldT> inline
+typename EditFCPtrMFieldHandle<FieldT>::HandledField *
+ EditFCPtrMFieldHandle<FieldT>::dcast(void)
+{
+ return static_cast<HandledField *>(_pField);
+}
+template <class FieldT> inline
+const typename EditFCPtrMFieldHandle<FieldT>::HandledField *
+ EditFCPtrMFieldHandle<FieldT>::dcast_const(void) const
+{
+ return static_cast<const HandledField *>(_pField);
+}
+
+
OSG_END_NAMESPACE
Index: Source/System/FieldContainer/Mixins/OSGDynamicAttachmentMixin.inl
===================================================================
--- Source/System/FieldContainer/Mixins/OSGDynamicAttachmentMixin.inl (revision 1266)
+++ Source/System/FieldContainer/Mixins/OSGDynamicAttachmentMixin.inl (working copy)
@@ -171,8 +171,9 @@
if(pMFHandle != NULL && pMFHandle->isValid() == true)
{
- pMFHandle->setAddMethod(
- boost::bind(&Self::addPointerValue, this, _1, index));
+// XXX FIXME this needs to be reenabled or use the std access code path -cneumann
+// pMFHandle->setAddMethod(
+// boost::bind(&Self::addPointerValue, this, _1, index));
}
}
else
@@ -184,8 +185,9 @@
if(pSFHandle != NULL && pSFHandle->isValid() == true)
{
- pSFHandle->setSetMethod(
- boost::bind(&Self::setPointerValue, this, _1, index));
+// XXX FIXME this needs to be reenabled or use the std access code path -cneumann
+// pSFHandle->setSetMethod(
+// boost::bind(&Self::setPointerValue, this, _1, index));
}
}
}
Index: Source/Base/Field/OSGFieldTraits.h
===================================================================
--- Source/Base/Field/OSGFieldTraits.h (revision 1266)
+++ Source/Base/Field/OSGFieldTraits.h (working copy)
@@ -490,58 +490,63 @@
typedef typename DescT::FieldDescParent Inherited;
typedef typename
- boost::mpl::if_<boost::mpl::bool_<(eFieldCard == FieldType::SingleField)>,
- SField<typename DescT::ValueType,
- DescT::iNamespace>,
- MField<typename DescT::ValueType,
- DescT::iNamespace,
- typename DescT::MFAlloc > >::type HandledVField;
+ boost::mpl::if_c<
+ eFieldCard == FieldType::SingleField,
+ SField<typename DescT::ValueType,
+ DescT::iNamespace>,
+ MField<typename DescT::ValueType,
+ DescT::iNamespace,
+ typename DescT::MFAlloc > >::type HandledVField;
typedef typename
- boost::mpl::if_<boost::mpl::bool_<(eFieldCard == FieldType::SingleField)>,
- PointerSField<typename DescT::ValueType,
- RefCountPolicy,
- DescT::iNamespace>,
- PointerMField<typename DescT::ValueType,
- RefCountPolicy,
- DescT::iNamespace> >::type HandledPField;
+ boost::mpl::if_c<
+ eFieldCard == FieldType::SingleField,
+ PointerSField<typename DescT::ValueType,
+ RefCountPolicy,
+ DescT::iNamespace>,
+ PointerMField<typename DescT::ValueType,
+ RefCountPolicy,
+ DescT::iNamespace> >::type HandledPField;
typedef typename
- boost::mpl::if_<boost::mpl::bool_<(eFieldCard == FieldType::SingleField)>,
- ParentPointerSField<typename DescT::ValueType,
- RefCountPolicy,
- DescT::iNamespace>,
- ParentPointerMField<typename DescT::ValueType,
- RefCountPolicy,
- DescT::iNamespace>
- >::type HandledPPField;
+ boost::mpl::if_c<
+ eFieldCard == FieldType::SingleField,
+ ParentPointerSField<typename DescT::ValueType,
+ RefCountPolicy,
+ DescT::iNamespace>,
+ ParentPointerMField<typename DescT::ValueType,
+ RefCountPolicy,
+ DescT::iNamespace>
+ >::type HandledPPField;
typedef typename
- boost::mpl::if_<boost::mpl::bool_<(eFieldCard == FieldType::SingleField)>,
- ChildPointerSField<typename DescT::ValueType,
- RefCountPolicy,
- DescT::iNamespace>,
- ChildPointerMField<typename DescT::ValueType,
- RefCountPolicy,
- DescT::iNamespace>
- >::type HandledChField;
+ boost::mpl::if_c<
+ eFieldCard == FieldType::SingleField,
+ ChildPointerSField<typename DescT::ValueType,
+ RefCountPolicy,
+ DescT::iNamespace>,
+ ChildPointerMField<typename DescT::ValueType,
+ RefCountPolicy,
+ DescT::iNamespace>
+ >::type HandledChField;
typedef typename
- boost::mpl::if_<boost::mpl::bool_<(eFieldClass == FieldType::ValueField)>,
- HandledVField,
- HandledPField>::type HandledFieldA;
+ boost::mpl::if_c<
+ eFieldClass == FieldType::ValueField,
+ HandledVField,
+ HandledPField >::type HandledFieldA;
typedef typename
- boost::mpl::if_<
- boost::mpl::bool_<(eFieldClass == FieldType::ParentPtrField)>,
- HandledPPField,
- HandledFieldA>::type HandledFieldB;
+ boost::mpl::if_c<
+ eFieldClass == FieldType::ParentPtrField,
+ HandledPPField,
+ HandledFieldA >::type HandledFieldB;
typedef typename
- boost::mpl::if_<
- boost::mpl::bool_<(eFieldClass == FieldType::ChildPtrField)>,
- HandledChField,
- HandledFieldB>::type HandledField;
+ boost::mpl::if_c<
+ eFieldClass == FieldType::ChildPtrField,
+ HandledChField,
+ HandledFieldB >::type HandledField;
typedef typename HandledField::GetHandle GetHandle;
typedef typename HandledField::GetHandlePtr GetHandlePtr;
@@ -608,24 +613,23 @@
};
typedef typename
- boost::mpl::if_<
- boost::mpl::bool_<(
- eFieldClass == FieldType::ChildPtrField ||
- eFieldClass == FieldType::ParentPtrField)>,
- ChildFieldCreateHandler,
- DefaultFieldCreateHandler>::type FieldCreateHandler;
+ boost::mpl::if_c<
+ (eFieldClass == FieldType::ChildPtrField ||
+ eFieldClass == FieldType::ParentPtrField ),
+ ChildFieldCreateHandler,
+ DefaultFieldCreateHandler >::type FieldCreateHandler;
typedef typename
- boost::mpl::if_<
- boost::mpl::bool_<(eFieldClass == FieldType::ParentPtrField)>,
- ParentCreateEditHandler,
- DefaultCreateEditHandler>::type CreateEditHandler;
+ boost::mpl::if_c<
+ eFieldClass == FieldType::ParentPtrField,
+ ParentCreateEditHandler,
+ DefaultCreateEditHandler >::type CreateEditHandler;
typedef typename
- boost::mpl::if_<
- boost::mpl::bool_<(eFieldCard == FieldType::SingleField)>,
- SFieldFunctions,
- MFieldFunctions>::type FieldFunctions;
+ boost::mpl::if_c<
+ eFieldCard == FieldType::SingleField,
+ SFieldFunctions,
+ MFieldFunctions >::type FieldFunctions;
virtual void beginEdit(Field *pField,
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Opensg-core mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-core