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 * Mark Elendt 00008 * Side Effects Software Inc. 00009 * 20 Maud St. 00010 * Toronto, Ontario, M5V 2M5 00011 * Canada 00012 * 416-366-4607 00013 * 00014 * NAME: Geometry Library (C++) 00015 * 00016 * COMMENTS: 00017 * This contains the class definition for GB_AttributeElem which is 00018 * an entity that contains attributes. 00019 */ 00020 00021 #ifndef __GB_AttributeElem_h__ 00022 #define __GB_AttributeElem_h__ 00023 00024 #include "GB_API.h" 00025 #include <stdlib.h> 00026 #include "GB_AttributeData.h" 00027 00028 class GB_AttributeDict; 00029 00030 class GB_API GB_AttributeElem 00031 { 00032 public: 00033 void copyAttribData(const GB_AttributeElem *src, int sz) 00034 { 00035 if (sz && myAttribData.getData()) 00036 memcpy(myAttribData.getData(), 00037 src->myAttribData.getData(), 00038 (unsigned)sz); 00039 } 00040 00041 // given matching attribute dictionaries, copy the attribute data. 00042 // this allows for different sized attributes as long as the destination 00043 // attributes are at least as big as the source attributes. 00044 void copyAttribData(const GB_AttributeElem *src, 00045 const GB_AttributeDict &src_dict, 00046 const GB_AttributeDict &dest_dict); 00047 00048 /// Operations to work on an individual attribute. The handle is passed in 00049 /// and a pointer to the data is returned. 00050 template<typename T> 00051 T *castAttribData(int n) 00052 { return (T *)myAttribData[(unsigned)n]; } 00053 template<typename T> 00054 const T *castAttribData(int n) const 00055 { return (const T *)myAttribData[(unsigned)n]; } 00056 00057 /// Operations defined on the entire set of attributes 00058 /// Some of these operations only apply to floating point data (e.g. 00059 /// scaleData()). These methods take two GB_Details, the srcgeo is used to 00060 /// find the attributes available on the source geometry. The *mygeo* 00061 /// parameter is used to define my attributes. 00062 00063 /// getAttribData has been deprecated in favor of the template 00064 /// castAttribData function which preserves const-ness and eliminates 00065 /// the need for C-style casting of the return value. 00066 void SYS_DEPRECATED *getAttribData(int n) const 00067 { return myAttribData[(unsigned)n]; } 00068 00069 // For H9.1, we move the getAttrib() methods into the private section and 00070 // provide access to existing classes through friends. 00071 const GB_AttributeData &getAttrib() const { return myAttribData; } 00072 GB_AttributeData &getAttrib() { return myAttribData; } 00073 00074 protected: 00075 private: 00076 GB_AttributeData myAttribData; 00077 }; 00078 00079 #endif
1.5.9