00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __GEO_AttribDict_h__
00021 #define __GEO_AttribDict_h__
00022
00023 #include "GEO_API.h"
00024 #include <GB/GB_Attribute.h>
00025
00026 class GB_Vertex;
00027 class GEO_Point;
00028 class GEO_PointList;
00029 class GEO_PrimList;
00030 class GEO_Primitive;
00031 class GEO_Vertex;
00032
00033 class GEO_VertexAttribDict;
00034
00035
00036 class GEO_API GEO_PointAttribDict : public GB_AttributeDict {
00037 public:
00038 GEO_PointAttribDict(GEO_PointList &pointList);
00039 virtual ~GEO_PointAttribDict();
00040
00041 virtual void sortAs(const GB_AttributeDict &table);
00042
00043
00044
00045
00046
00047
00048 GB_AttributeRef append(const char *n, int s, GB_AttribType type,
00049 const void *defValue);
00050 GB_AttributeRef append(const char *n, int s,
00051 GB_AttribType type,
00052 GB_AttribTypeInfo type_info,
00053 const void *defValue);
00054 GB_AttributeRef appendClone(const GB_Attribute *src);
00055
00056 void destroy(const char *name, int size,GB_AttribType type);
00057
00058 void destroy(const char *name, GB_AttribType type);
00059 GB_AttributeRef grow(const char *n, int oldsize, GB_AttribType type,
00060 unsigned int addedsize);
00061
00062
00063 void fillPoint(GEO_Point &pt) const;
00064 void setVertexDict(GEO_VertexAttribDict *vd)
00065 {
00066 vtxDict = vd;
00067 }
00068
00069
00070
00071 void destroyIndex(const char *name, const char *label);
00072
00073 void cleanIndex(const char *name);
00074
00075 void collapseIndex();
00076
00077 void resetIndex();
00078
00079 private:
00080 void resizeAttribData(int new_size);
00081 template<typename T> friend void
00082 geoCopyAttribDict(T *me, const GB_AttributeDict &src);
00083
00084 private:
00085 GEO_PointList &ptList;
00086 GEO_VertexAttribDict *vtxDict;
00087 };
00088
00089
00090 class GEO_API GEO_VertexAttribDict : public GB_AttributeDict {
00091 public:
00092 GEO_VertexAttribDict(GEO_PrimList &primList);
00093 virtual ~GEO_VertexAttribDict();
00094
00095 virtual void sortAs(const GB_AttributeDict &table);
00096 GB_AttributeRef append(const char *n, int s, GB_AttribType type,
00097 const void *defValue);
00098 GB_AttributeRef append(const char *n, int s, GB_AttribType type,
00099 GB_AttribTypeInfo type_info,
00100 const void *defValue);
00101 GB_AttributeRef appendClone(const GB_Attribute *src);
00102 void destroy(const char *name, int size,GB_AttribType type);
00103
00104 void destroy(const char *name, GB_AttribType type);
00105 GB_AttributeRef grow(const char *n, int oldsize, GB_AttribType type,
00106 unsigned int addedsize);
00107
00108
00109 void promoteAttrib(const char *n, int s, GB_AttribType type);
00110
00111
00112 void demoteAttrib(const char *n, int s, GB_AttribType type);
00113 void fillVertex(GEO_Vertex &vtx) const;
00114 void setPointDict(GEO_PointAttribDict *pd) { ptDict = pd; }
00115
00116
00117
00118 void destroyIndex(const char *name, const char *label);
00119
00120 void cleanIndex(const char *name);
00121
00122 void collapseIndex();
00123
00124 void resetIndex();
00125
00126 private:
00127 void resizeAttribData(int new_size);
00128 template<typename T> friend void
00129 geoCopyAttribDict(T *me, const GB_AttributeDict &src);
00130
00131
00132 static int translateVtxAttrib(GB_Vertex &v, void *data);
00133 static int promoteVtxAttrib(GB_Vertex &v, void *data);
00134 static int demoteVtxAttrib(GB_Vertex &v, void *data);
00135 static int geoVertexAttribSizeUpdate(GB_Vertex &v, void *data);
00136
00137 private:
00138 GEO_PrimList &prList;
00139 GEO_PointAttribDict *ptDict;
00140 };
00141
00142
00143 class GEO_API GEO_PrimAttribDict : public GB_AttributeDict {
00144 public:
00145 GEO_PrimAttribDict(GEO_PrimList &primList);
00146 virtual ~GEO_PrimAttribDict();
00147
00148 virtual void sortAs(const GB_AttributeDict &table);
00149 GB_AttributeRef append(const char *n, int s, GB_AttribType type,
00150 const void *defValue);
00151 GB_AttributeRef append(const char *n, int s, GB_AttribType type,
00152 GB_AttribTypeInfo type_info,
00153 const void *defValue);
00154 GB_AttributeRef appendClone(const GB_Attribute *src);
00155 void destroy(const char *name, int size,GB_AttribType type);
00156
00157 void destroy(const char *name, GB_AttribType type);
00158 GB_AttributeRef grow(const char *n, int oldsize, GB_AttribType type,
00159 unsigned int addedsize);
00160
00161
00162 void fillPrimitive(GEO_Primitive &pr) const;
00163
00164
00165 void destroyIndex(const char *name, const char *label);
00166
00167 void cleanIndex(const char *name);
00168
00169 void collapseIndex();
00170
00171 void resetIndex();
00172
00173 private:
00174 void resizeAttribData(int new_size);
00175 template<typename T> friend void
00176 geoCopyAttribDict(T *me, const GB_AttributeDict &src);
00177
00178 private:
00179 GEO_PrimList &prList;
00180 };
00181
00182 #endif
00183