00001 /* 00002 * PROPRIETARY INFORMATION. This software is proprietary to 00003 * Side Effects Software Inc., and is not to be reproduced, 00004 * transmitted, or disclosed in any way without written permission. 00005 * 00006 * Produced by: 00007 * Ondrej Kos 00008 * Side Effects Software, Inc. 00009 * 477 Richmond Street West 00010 * Toronto, Ontario 00011 * Canada M5V 3E7 00012 * 416-504-9876 00013 * 00014 * NAME: GB_AttributeListHandle.h (C++) 00015 * 00016 * COMMENTS: Used to abstract the interface of dealing with multiple 00017 * attributes, and more efficient than dealing with lists of 00018 * GB_AttributeHandle(s). 00019 * 00020 */ 00021 #ifndef __GB_AttributeListHandle_h__ 00022 #define __GB_AttributeListHandle_h__ 00023 00024 #include "GB_API.h" 00025 #include <SYS/SYS_Types.h> 00026 #include <UT/UT_PtrArray.h> 00027 #include <UT/UT_SymbolTable.h> 00028 00029 #include "GB_AttributeDefines.h" 00030 #include "GB_AttributeHandleBase.h" 00031 #include "GB_AttributeData.h" 00032 00033 class UT_Vector3; 00034 class GB_Detail; 00035 class GB_Attribute; 00036 class GB_AttributeDict; 00037 class GB_AttributeElem; 00038 class GB_AttributeHandle; 00039 class GEO_AttributeHandle; 00040 00041 class GB_API GB_AttributeListHandle : public GB_AttributeHandleBase 00042 { 00043 public: 00044 00045 /// Creates an empty attribute handle. 00046 GB_AttributeListHandle(); 00047 virtual ~GB_AttributeListHandle(); 00048 00049 // The operator= does not copy references to the element, only to the 00050 // detail and the attribute offsets. No data stored in the original handle 00051 // will be copied either. 00052 GB_AttributeListHandle &operator=(const GB_AttributeListHandle &gah); 00053 00054 int entries() const { return myAttribs.entries(); } 00055 bool isEmpty() const { return entries() == 0; } 00056 00057 /// Invalidates the handle (gets rid of references to elements and details) 00058 virtual void invalidate(); 00059 00060 protected: 00061 // Add an attribute to the attribute list & name map 00062 bool appendAttribute(GB_AttributeHandle *h); 00063 bool removeAttribute(int i); 00064 bool removeAttribute(const char *name); 00065 00066 GB_AttributeHandle *getEntry(int i) const; 00067 GB_AttributeHandle *getEntry(const char *name) const; 00068 00069 /// Removes the attributes 00070 void clearAttributes(); 00071 00072 private: 00073 UT_PtrArray<GB_AttributeHandle *> myAttribs; 00074 UT_SymbolTable myNameMap; 00075 }; 00076 00077 #endif
1.5.9