Carsten Neumann wrote:
> Carsten Neumann wrote:
>>      Hi,
>>
>> attached patch removes the member functions fixParents and freeParents
>> (which is unused ?) from Geometry. Callers are fixed by forwarding to
>> the appropriate GeometryBase functions.
>> I'll wait a couple of days for comments in case there were more subtle
>> reasons for doing things this way.
>> If applied, should I change the ES Geometry as well ?
>>
>>      Thanks,
>>              Carsten
> 
> sorry, now with attachment.

and now with a stupid typo fixed :-/
Index: Source/System/NodeCores/Drawables/Geometry/Base/WS/OSGGeometry.cpp
===================================================================
--- Source/System/NodeCores/Drawables/Geometry/Base/WS/OSGGeometry.cpp	(revision 533)
+++ Source/System/NodeCores/Drawables/Geometry/Base/WS/OSGGeometry.cpp	(working copy)
@@ -136,18 +136,6 @@
 {
 }
 
-// This shoudl go into Attachment
-void Geometry::freeParent(FieldContainerAttachmentPtr value,
-                          FieldContainerPtr           obj)
-{
-    if(value != NullFC)
-    {
-        value->subParent(obj);
-
-        subRef(value);
-    }
-}
-
 Geometry::~Geometry(void)
 {
     UInt16 i;
Index: Source/System/NodeCores/Drawables/Geometry/Base/WS/OSGGeometry.inl
===================================================================
--- Source/System/NodeCores/Drawables/Geometry/Base/WS/OSGGeometry.inl	(revision 533)
+++ Source/System/NodeCores/Drawables/Geometry/Base/WS/OSGGeometry.inl	(working copy)
@@ -57,27 +57,6 @@
 
 /*------------------------------ access -----------------------------------*/
 
-// Helper function
-// This should go into Attachment...
-inline
-void Geometry::fixParents(FieldContainerAttachmentPtrConstArg oldvalue,
-                          FieldContainerAttachmentPtrConstArg newvalue,
-                          FieldContainerPtr                   obj,
-                          UInt32                              fieldId)
-{
-    if(oldvalue != NullFC)
-    {
-        oldvalue->subParent(obj);
-
-        subRef(oldvalue);
-    }
-
-    if(newvalue != NullFC)
-    {
-        newvalue->addParent(obj, fieldId);
-    }
-}
-
 //--------------------------
 // Property Access
 //--------------------------
@@ -171,31 +150,13 @@
 inline
 void Geometry::setTypes(GeoIntegralPropertyPtrConstArg value)
 {
-    addRef(value);
-
-    fixParents(_sfTypes.getValue(),
-               value,
-               Inherited::constructPtr<Geometry>(this),
-               TypesFieldId);
-
-    editSField(TypesFieldMask);
-
-    _sfTypes.setValue(value);
+    Inherited::setTypes(value);
 }
 
 inline
 void Geometry::setLengths(GeoIntegralPropertyPtrConstArg value)
 {
-    addRef(value);
-
-    fixParents(_sfLengths.getValue(),
-               value,
-               Inherited::constructPtr<Geometry>(this),
-               LengthsFieldId);
-
-    editSField(LengthsFieldMask);
-
-    _sfLengths.setValue(value);
+    Inherited::setLengths(value);
 }
 
 inline
@@ -278,8 +239,6 @@
 inline
 void Geometry::setProperty(GeoVectorPropertyPtrConstArg value, UInt16 index)
 {
-    addRef(value);
-
     editMField(PropertiesFieldMask, _mfProperties);
 
     while(_mfProperties.size() <= index)
@@ -287,12 +246,7 @@
         _mfProperties.push_back(NullFC);
     }
 
-    fixParents(_mfProperties[index],
-                value,
-                Inherited::constructPtr<Geometry>(this),
-                PropertiesFieldId);
-
-    _mfProperties[index] = value;
+    replaceInProperties(index, value);
 }
 
 /*! Return the vertext property data stored at index. */
@@ -312,8 +266,6 @@
 inline
 void Geometry::setIndex(GeoIntegralPropertyPtrConstArg value, UInt16 index)
 {
-    addRef(value);
-
     editMField(PropIndicesFieldMask, _mfPropIndices);
 
     while(_mfPropIndices.size() <= index)
@@ -321,12 +273,7 @@
         _mfPropIndices.push_back(NullFC);
     }
 
-    fixParents(_mfPropIndices[index],
-                value,
-                Inherited::constructPtr<Geometry>(this),
-                PropIndicesFieldId);
-
-    _mfPropIndices[index] = value;
+    replaceInPropIndices(index, value);
 }
 
 /*! Return the list of indices currently being used for the vertex attributes
Index: Source/System/NodeCores/Drawables/Geometry/Base/WS/OSGGeometry.h
===================================================================
--- Source/System/NodeCores/Drawables/Geometry/Base/WS/OSGGeometry.h	(revision 533)
+++ Source/System/NodeCores/Drawables/Geometry/Base/WS/OSGGeometry.h	(working copy)
@@ -308,16 +308,7 @@
     friend struct PtrConstructionFunctions;
 
     static PumpGroupStorage _pumps;
-
-    inline
-    void fixParents(FieldContainerAttachmentPtrConstArg oldvalue,
-                    FieldContainerAttachmentPtrConstArg newvalue,
-                    FieldContainerPtr                   obj,
-                    UInt32                              fieldId);
-
-    void freeParent(FieldContainerAttachmentPtr  value,
-                    FieldContainerPtr            obj);
-
+    
     // prohibit default functions (move to 'public' if you need one)
     void operator =(const Geometry &source);
 };
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Opensg-core mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-core

Reply via email to