Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

OSGNodeImpl.h

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002  *                                OpenSG                                     *
00003  *                                                                           *
00004  *                                                                           *
00005  *                     Copyright 2000-2002 by OpenSG Forum                   *
00006  *                                                                           *
00007  *   contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de          *
00008  *                                                                           *
00009 \*---------------------------------------------------------------------------*/
00010 /*---------------------------------------------------------------------------*\
00011  *                                License                                    *
00012  *                                                                           *
00013  * This library is free software; you can redistribute it and/or modify it   *
00014  * under the terms of the GNU Library General Public License as published    *
00015  * by the Free Software Foundation, version 2.                               *
00016  *                                                                           *
00017  * This library is distributed in the hope that it will be useful, but       *
00018  * WITHOUT ANY WARRANTY; without even the implied warranty of                *
00019  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU         *
00020  * Library General Public License for more details.                          *
00021  *                                                                           *
00022  * You should have received a copy of the GNU Library General Public         *
00023  * License along with this library; if not, write to the Free Software       *
00024  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.                 *
00025  *                                                                           *
00026 \*---------------------------------------------------------------------------*/
00027 /*---------------------------------------------------------------------------*\
00028  *                                Changes                                    *
00029  *                                                                           *
00030  *                                                                           *
00031  *                                                                           *
00032  *                                                                           *
00033  *                                                                           *
00034  *                                                                           *
00035 \*---------------------------------------------------------------------------*/
00036 
00037 #ifndef _OSGNODEIMPL_H_
00038 #define _OSGNODEIMPL_H_
00039 #ifdef __sgi
00040 #pragma once
00041 #endif
00042 
00043 #ifdef OSG_DOC_FILES_IN_MODULE
00044 
00047 #endif
00048 
00049 #include <string>
00050 #include <vector>
00051 
00052 #include <OSGSystemDef.h>
00053 #include <OSGBaseTypes.h>
00054 #include <OSGMatrix.h>
00055 #include <OSGFieldContainer.h>
00056 #include <OSGSFSysTypes.h>
00057 #include <OSGSFBaseTypes.h>
00058 
00059 #include <OSGAttachmentContainer.h>
00060 #include <OSGSFNodeCorePtr.h>
00061 #include <OSGSFNodePtrImpl.h>
00062 #include <OSGSFNodePtrDepImpl.h>
00063 #include <OSGMFNodePtrImpl.h>
00064 #include <OSGMFNodePtrDepImpl.h>
00065 
00066 OSG_BEGIN_NAMESPACE
00067 
00068 class NodeCore;
00069 class BinaryDataHandler;
00070 class FieldDescription;
00071 
00075 class OSG_SYSTEMLIB_DLLMAPPING Node : public AttachmentContainer 
00076 {
00077     /*=========================  PROTECTED  ===============================*/
00078 
00079   protected:
00080 
00081     typedef AttachmentContainer Inherited;
00082 
00083     /*==========================  PUBLIC  =================================*/
00084 
00085   public:
00086 
00087     enum 
00088     { 
00089         VolumeFieldId      = Inherited::NextFieldId, 
00090         TravMaskFieldId    = VolumeFieldId         + 1,
00091         ParentFieldId      = TravMaskFieldId       + 1,
00092         ChildrenFieldId    = ParentFieldId         + 1,
00093         CoreFieldId        = ChildrenFieldId       + 1,
00094         NextFieldId        = CoreFieldId           + 1
00095     };
00096 
00097     static const BitVector VolumeFieldMask;
00098     static const BitVector TravMaskFieldMask;
00099     static const BitVector ParentFieldMask;
00100     static const BitVector ChildrenFieldMask;
00101     static const BitVector CoreFieldMask;
00102 
00103     typedef NodePtr Ptr;
00104 
00105     /*---------------------------------------------------------------------*/
00109     OSG_FIELD_CONTAINER_DECL(NodePtr)
00110 
00111     
00112     /*---------------------------------------------------------------------*/
00116     NodeCorePtr getCore(      void             );
00117     NodeCorePtr getCore(      void             ) const;
00118 
00119     void        setCore(const NodeCorePtr &core);
00120 
00122     /*---------------------------------------------------------------------*/
00126     NodePtr getParent(void);
00127 
00129     /*---------------------------------------------------------------------*/
00133     UInt32  getNChildren  (void                     ) const;
00134     
00135     void    addChild      (const NodePtr &childP    );
00136 
00137     void    insertChild   (      UInt32   childIndex, 
00138                            const NodePtr &childP    );
00139 
00140     void    replaceChild  (      UInt32   childIndex,    
00141                            const NodePtr &childP    );
00142 
00143     bool    replaceChildBy(const NodePtr &childP, 
00144                            const NodePtr &newChildP );
00145 
00146     Int32   findChild     (const NodePtr &childP    ) const;
00147 
00148     void    subChild      (const NodePtr &childP    );
00149     void    subChild      (      UInt32   childIndex);
00150 
00151     NodePtr getChild      (      UInt32   childIndex);
00152 
00154     /*---------------------------------------------------------------------*/
00158     bool   getActive  (void      ) const;
00159 
00160     void   setActive  (bool   val);
00161 
00162     void   setTravMask(UInt32 val);
00163     UInt32 getTravMask(void      ) const;
00164 
00166     /*---------------------------------------------------------------------*/
00170     NodePtr clone(void);
00171 
00173     /*---------------------------------------------------------------------*/
00177     SFDynamicVolume *getSFVolume  (void);
00178     SFUInt32        *getSFTravMask(void);
00179     SFNodePtr       *getSFParent  (void);
00180     SFNodeCorePtr   *getSFCore    (void);
00181     MFNodePtr       *getMFChildren(void);
00182 
00184     /*---------------------------------------------------------------------*/
00188     Matrix getToWorld(void          );
00189     
00190     void   getToWorld(Matrix &result);
00191     
00193     /*---------------------------------------------------------------------*/
00197            DynamicVolume &getVolume       (bool update          );
00198     
00199     const  DynamicVolume &getVolume       (void                 ) const;
00200     
00201            void           getWorldVolume  (DynamicVolume &result);
00202     
00203            void           updateVolume    (void                 );
00204 
00205            void           invalidateVolume(void                 );
00206 
00208     /*---------------------------------------------------------------------*/
00212     virtual void changed(BitVector  whichField, 
00213                          UInt32     origin    );
00214 
00216     /*---------------------------------------------------------------------*/
00220     virtual UInt32  getBinSize (const BitVector         &whichField);
00221 
00222     virtual void    copyToBin  (      BinaryDataHandler &pMem, 
00223                                 const BitVector         &whichField);
00224     virtual void    copyFromBin(      BinaryDataHandler &pMem, 
00225                                 const BitVector         &whichField);
00226     
00228     /*---------------------------------------------------------------------*/
00232     virtual void dump(      UInt32    uiIndent = 0, 
00233                       const BitVector bvFlags  = 0) const;
00234 
00236     /*=========================  PROTECTED  ===============================*/
00237 
00238   protected:
00239 
00240     friend class FieldContainer;
00241     friend class FieldContainerType;
00242 
00243     /*---------------------------------------------------------------------*/
00247     static       FieldDescription   *_desc[];
00248     static       FieldContainerType  _type;
00249 
00250     static const NodePtr              NullNode;
00251 
00253     /*---------------------------------------------------------------------*/
00257     SFDynamicVolume _sfVolume;
00258     
00259     SFUInt32        _sfTravMask;
00260     
00261     SFNodePtr       _sfParent;
00262     MFNodePtr       _mfChildren;
00263 
00264     SFNodeCorePtr   _sfCore;
00265 
00267     /*---------------------------------------------------------------------*/
00271     Node(void);
00272     Node(const Node &source);
00273 
00275     /*---------------------------------------------------------------------*/
00279     virtual ~Node (void);
00280 
00282     /*---------------------------------------------------------------------*/
00286     void setParent(const NodePtr &parent);
00287 
00288     void onCreate (const Node    *source = NULL);
00289 
00290 #if defined(OSG_FIXED_MFIELDSYNC)
00291     virtual void onDestroyAspect(UInt32 uiId, UInt32 uiAspect);
00292 #endif
00293 
00295     /*---------------------------------------------------------------------*/
00299 #if !defined(OSG_FIXED_MFIELDSYNC)
00300     virtual void executeSync    (      FieldContainer &other,
00301                                  const BitVector      &whichField);
00302 
00303             void executeSyncImpl(      Node           *pOther,
00304                                  const BitVector      &whichField);
00305 #else
00306     virtual void executeSync       (      FieldContainer &other,
00307                                     const BitVector      &whichField,
00308                                     const SyncInfo       &sInfo     );
00309 
00310             void executeSyncImpl   (      Node           *pOther,
00311                                     const BitVector      &whichField,
00312                                     const SyncInfo       &sInfo     );
00313 
00314     virtual void execBeginEdit     (const BitVector &whichField, 
00315                                           UInt32     uiAspect,
00316                                           UInt32     uiContainerSize);
00317 
00318             void execBeginEditImpl (const BitVector &whichField, 
00319                                           UInt32     uiAspect,
00320                                           UInt32     uiContainerSize);
00321 #endif
00322 
00324     /*---------------------------------------------------------------------*/
00328     NodePtr getPtr(void) const;
00329 
00331     /*==========================  PRIVATE  ================================*/
00332 
00333   private:
00334 
00335     /* prohibit default function (move to 'public' if needed) */
00336     void operator =(const Node &source);
00337 };
00338 
00339 
00343 OSG_SYSTEMLIB_DLLMAPPING
00344 NodePtr cloneTree(const NodePtr &pRootNode);
00345 
00346 OSG_SYSTEMLIB_DLLMAPPING
00347 FieldContainerPtr deepClone(const FieldContainerPtr &src,
00348                             const std::vector<std::string> &share);
00349 
00350 OSG_SYSTEMLIB_DLLMAPPING
00351 FieldContainerPtr deepClone(const FieldContainerPtr &src,
00352                             const std::vector<UInt16> &shareGroupIds);
00353 
00354 OSG_SYSTEMLIB_DLLMAPPING
00355 FieldContainerPtr deepClone(const FieldContainerPtr &src,
00356                             const std::string &shareString = "");
00357 
00358 OSG_SYSTEMLIB_DLLMAPPING
00359 void deepCloneAttachments(const NodePtr &src, NodePtr &dst,
00360                           const std::vector<std::string> &share);
00361 
00362 OSG_SYSTEMLIB_DLLMAPPING
00363 void deepCloneAttachments(const NodePtr &src, NodePtr &dst,
00364                           const std::vector<UInt16> &shareGroupIds);
00365 
00366 OSG_SYSTEMLIB_DLLMAPPING
00367 void deepCloneAttachments(const NodePtr &src, NodePtr &dst,
00368                           const std::string &shareString = "");
00369                       
00370 OSG_SYSTEMLIB_DLLMAPPING
00371 NodePtr deepCloneTree(const NodePtr &src,
00372                       const std::vector<std::string> &share);
00373 
00374 OSG_SYSTEMLIB_DLLMAPPING
00375 NodePtr deepCloneTree(const NodePtr &src,
00376                       const std::vector<UInt16> &shareGroupIds);
00377 
00378 OSG_SYSTEMLIB_DLLMAPPING
00379 NodePtr deepCloneTree(const NodePtr &src,
00380                       const std::string &shareString = "");
00381 
00382 OSG_END_NAMESPACE
00383 
00384 #define OSGNODE_HEADER_CVSID "@(#)$Id: $"
00385 
00386 #endif /* _OSGNODEIMPL_H_ */

Generated on Thu Aug 25 04:07:57 2005 for OpenSG by  doxygen 1.4.3