OSGAttachmentContainer.h

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002  *                                OpenSG                                     *
00003  *                                                                           *
00004  *                                                                           *
00005  *           Copyright (C) 2003 by the OpenSG Forum                          *
00006  *                                                                           *
00007  *                            www.opensg.org                                 *
00008  *                                                                           *
00009  *   contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de          *
00010  *                                                                           *
00011 \*---------------------------------------------------------------------------*/
00012 /*---------------------------------------------------------------------------*\
00013  *                                License                                    *
00014  *                                                                           *
00015  * This library is free software; you can redistribute it and/or modify it   *
00016  * under the terms of the GNU Library General Public License as published    *
00017  * by the Free Software Foundation, version 2.                               *
00018  *                                                                           *
00019  * This library is distributed in the hope that it will be useful, but       *
00020  * WITHOUT ANY WARRANTY; without even the implied warranty of                *
00021  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU         *
00022  * Library General Public License for more details.                          *
00023  *                                                                           *
00024  * You should have received a copy of the GNU Library General Public         *
00025  * License along with this library; if not, write to the Free Software       *
00026  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.                 *
00027  *                                                                           *
00028 \*---------------------------------------------------------------------------*/
00029 /*---------------------------------------------------------------------------*\
00030  *                                Changes                                    *
00031  *                                                                           *
00032  *                                                                           *
00033  *                                                                           *
00034  *                                                                           *
00035  *                                                                           *
00036  *                                                                           *
00037 \*---------------------------------------------------------------------------*/
00038 
00039 #ifndef _OSGATTACHMENTCONTAINER_H_
00040 #define _OSGATTACHMENTCONTAINER_H_
00041 #ifdef __sgi
00042 #pragma once
00043 #endif
00044 
00045 #include "OSGFieldContainer.h"
00046 #include "OSGFieldContainerAttachment.h"
00047 #include "OSGAttachmentMapSFields.h"
00048 
00049 OSG_BEGIN_NAMESPACE
00050 
00056 class OSG_SYSTEM_DLLMAPPING AttachmentContainer : public FieldContainer
00057 {
00058     /*==========================  PUBLIC  =================================*/
00059 
00060   public:
00061 
00062     /*---------------------------------------------------------------------*/
00066     typedef FieldContainer                    Inherited;
00067     typedef Inherited::TypeObject             TypeObject;
00068     typedef AttachmentContainer               Self;
00069 
00070     typedef FieldContainerAttachment          AttachmentObj;
00071     typedef FieldContainerAttachmentPtr       AttachmentObjPtr;
00072     typedef SFFieldContainerAttachmentPtrMap  SFAttachmentObjPtrMap;
00073 
00074     typedef SFAttachmentObjPtrMap::StoredType AttachmentObjPtrMap;
00075     typedef AttachmentObjPtrMap::iterator     AttachmentObjPtrMapIt;
00076 
00077     
00078     OSG_GEN_INTERNALPTR(AttachmentContainer);
00079 
00081     /*---------------------------------------------------------------------*/
00085     OSG_ABSTR_FIELD_CONTAINER_DECL;
00086 
00088     /*---------------------------------------------------------------------*/
00092     OSG_RC_FIRST_FIELD_DECL(Attachments);
00093     OSG_RC_LAST_FIELD_DECL (Attachments);
00094 
00096     /*---------------------------------------------------------------------*/
00101     /*---------------------------------------------------------------------*/
00105 #if 0
00106     virtual void pushToField     (      FieldContainerPtrConstArg pNewElement,
00107                                   const UInt32                    uiFieldId  );
00108 
00109     virtual void insertIntoMField(const UInt32                    uiIndex,
00110                                         FieldContainerPtrConstArg pNewElement,
00111                                   const UInt32                    uiFieldId  );
00112 
00113     virtual void replaceInMField (const UInt32                    uiIndex,
00114                                         FieldContainerPtrConstArg pNewElement,
00115                                   const UInt32                    uiFieldId  );
00116 
00117     virtual void replaceInMField (      FieldContainerPtrConstArg pOldElement,
00118                                         FieldContainerPtrConstArg pNewElement,
00119                                   const UInt32                    uiFieldId  );
00120 
00121     virtual void removeFromMField(const UInt32                    uiIndex,
00122                                   const UInt32                    whichField );
00123 
00124     virtual void removeFromMField(      FieldContainerPtrConstArg pElement,
00125                                   const UInt32                    whichField );
00126 
00127     virtual void clearField      (const UInt32                    whichField );
00128 #endif
00129     
00131     /*---------------------------------------------------------------------*/
00135     virtual UInt32 getBinSize (ConstFieldMaskArg   whichField);
00136     virtual void   copyToBin  (BinaryDataHandler  &pMem,
00137                                ConstFieldMaskArg   whichField);
00138     virtual void   copyFromBin(BinaryDataHandler  &pMem,
00139                                ConstFieldMaskArg   whichField);
00140 
00142     /*---------------------------------------------------------------------*/
00146     void             addAttachment (const AttachmentObjPtr   attachmentP,
00147                                           UInt16             binding    = 0);
00148 
00149     void             subAttachment (const AttachmentObjPtr   attachmentP,
00150                                           UInt16             binding    = 0);
00151 
00152     AttachmentObjPtr findAttachment(      UInt32             groupId,
00153                                           UInt16             binding    = 0);
00154 
00155     AttachmentObjPtr findAttachment(const FieldContainerType &type,
00156                                           UInt16              binding    = 0);
00157 
00159     /*---------------------------------------------------------------------*/
00163     const SFAttachmentObjPtrMap *getSFAttachments(void) const;
00164 
00166     /*---------------------------------------------------------------------*/
00171     /*---------------------------------------------------------------------*/
00176     /*---------------------------------------------------------------------*/
00181     /*---------------------------------------------------------------------*/
00186     /*---------------------------------------------------------------------*/
00191     /*---------------------------------------------------------------------*/
00195     virtual void dump(      UInt32    uiIndent = 0,
00196                       const BitVector bvFlags  = 0) const;
00197 
00199     /*=========================  PROTECTED  ===============================*/
00200 
00201   protected:
00202 
00203     /*---------------------------------------------------------------------*/
00207     static TypeObject _type;
00208 
00209     static void   classDescInserter(TypeObject &oType);
00210     static Char8 *getClassname     (void             );
00211 
00213     /*---------------------------------------------------------------------*/
00217     SFAttachmentObjPtrMap _sfAttachments;
00218 
00220     /*---------------------------------------------------------------------*/
00224     AttachmentContainer(void);
00225     AttachmentContainer(const AttachmentContainer &source);
00226 
00227     virtual ~AttachmentContainer(void);
00228 
00230     /*---------------------------------------------------------------------*/
00234 #ifdef OSG_MT_CPTR_ASPECT
00235     void execSync  (      AttachmentContainer *pFrom,
00236                           ConstFieldMaskArg    whichField,
00237                           AspectOffsetStore   &oOffsets,
00238                           ConstFieldMaskArg    syncMode  ,
00239                     const UInt32               uiSyncInfo);
00240 #endif
00241 
00243     /*---------------------------------------------------------------------*/
00247     virtual void resolveLinks(void);
00248 
00250     /*---------------------------------------------------------------------*/
00254     EditFieldHandlePtr editHandleAttachments(void);
00255     GetFieldHandlePtr  getHandleAttachments (void) const;
00256 
00258     /*==========================  PRIVATE  ================================*/
00259 
00260   private:
00261 
00263     void operator =(const AttachmentContainer &source);
00264 };
00265 
00266 OSG_GEN_CONTAINERPTR(AttachmentContainer);
00267 
00268 typedef RefPtr<AttachmentContainerPtr>      AttachmentContainerRefPtr;
00269 
00270 OSG_SYSTEM_DLLMAPPING
00271 void cloneAttachments(
00272           AttachmentContainerPtrConstArg           src,
00273           AttachmentContainerPtrArg                dst,
00274     const std::vector<std::string>                &cloneTypeNames,
00275 
00276     const std::vector<std::string>                &ignoreTypeNames   =
00277               std::vector<std::string>(),
00278 
00279     const std::vector<std::string>                &cloneGroupNames   =
00280               std::vector<std::string>(),
00281 
00282     const std::vector<std::string>                &ignoreGroupNames  =
00283               std::vector<std::string>()                              );
00284 
00285 OSG_SYSTEM_DLLMAPPING
00286 void cloneAttachments(
00287           AttachmentContainerPtrConstArg           src,
00288           AttachmentContainerPtrArg                dst,
00289     const std::vector<UInt16>                     &cloneGroupIds,
00290 
00291     const std::vector<UInt16>                     &ignoreGroupIds    =
00292               std::vector<UInt16>()                                   );
00293 
00294 OSG_SYSTEM_DLLMAPPING
00295 void cloneAttachments(
00296           AttachmentContainerPtrConstArg           src,
00297           AttachmentContainerPtrArg                dst,
00298     const std::string                             &cloneTypesString,
00299 
00300     const std::string                             &ignoreTypesString =
00301               std::string()                                           );
00302 
00303 OSG_SYSTEM_DLLMAPPING
00304 void cloneAttachments(
00305           AttachmentContainerPtrConstArg           src,
00306           AttachmentContainerPtrArg                dst,
00307 
00308     const std::vector<const ReflexiveContainerType *> &cloneTypes    =
00309               std::vector<const ReflexiveContainerType *>(),
00310 
00311     const std::vector<const ReflexiveContainerType *> &ignoreTypes       =
00312               std::vector<const ReflexiveContainerType *>(),
00313 
00314     const std::vector<UInt16>                     &cloneGroupIds     =
00315               std::vector<UInt16>(),
00316 
00317     const std::vector<UInt16>                     &ignoreGroupIds    =
00318               std::vector<UInt16>()                                   );
00319 
00320 OSG_SYSTEM_DLLMAPPING
00321 void deepCloneAttachments(
00322           AttachmentContainerPtrConstArg           src,
00323           AttachmentContainerPtrArg                dst,
00324     const std::vector<std::string>                &cloneTypeNames,
00325 
00326     const std::vector<std::string>                &ignoreTypeNames   =
00327               std::vector<std::string>(),
00328 
00329     const std::vector<std::string>                &cloneGroupNames   =
00330               std::vector<std::string>(),
00331 
00332     const std::vector<std::string>                &ignoreGroupNames  =
00333               std::vector<std::string>()                              );
00334 
00335 OSG_SYSTEM_DLLMAPPING
00336 void deepCloneAttachments(
00337           AttachmentContainerPtrConstArg           src,
00338           AttachmentContainerPtrArg                dst,
00339     const std::vector<UInt16>                     &cloneGroupIds,
00340 
00341     const std::vector<UInt16>                     &ignoreGroupIds    =
00342               std::vector<UInt16>()                                    );
00343 
00344 OSG_SYSTEM_DLLMAPPING
00345 void deepCloneAttachments(
00346           AttachmentContainerPtrConstArg           src,
00347           AttachmentContainerPtrArg                dst,
00348     const std::string                             &cloneTypesString,
00349 
00350     const std::string                             &ignoreTypesString =
00351               std::string()                                           );
00352 
00353 OSG_SYSTEM_DLLMAPPING
00354 void deepCloneAttachments(
00355           AttachmentContainerPtrConstArg           src,
00356           AttachmentContainerPtrArg                dst,
00357 
00358     const std::vector<const ReflexiveContainerType *> &shareTypes    =
00359               std::vector<const ReflexiveContainerType *>(),
00360 
00361     const std::vector<const ReflexiveContainerType *> &ignoreTypes   =
00362               std::vector<const ReflexiveContainerType *>(),
00363 
00364     const std::vector<UInt16>                     &shareGroupIds     =
00365               std::vector<UInt16>(),
00366 
00367     const std::vector<UInt16>                     &ignoreGroupIds    =
00368               std::vector<UInt16>()                                         );
00369 
00370 OSG_END_NAMESPACE
00371 
00372 #include "OSGAttachmentContainer.inl"
00373 
00374 #endif /* _OSGATTACHMENTCONTAINER_H_ */