72 #ifndef STDBTABLEDESCRIPTOR_HH
73 #define STDBTABLEDESCRIPTOR_HH
76 #include "StTableDescriptorI.h"
78 #include "StDbBuffer.h"
83 StTypeE type = Stchar;
85 unsigned int size = 0;
86 unsigned int offset = 0;
87 unsigned int dimensionlen[4];
95 unsigned int mnumElements = 0;
96 unsigned int mtableSize = 0;
97 int offsetToNextEmptyByte = 0;
98 int offsetToLast4Bytes = 0;
99 StTypeE lastType = Stchar;
102 unsigned int mAlign[Stmaxtype];
112 bool misValid =
false;
113 bool mhasDouble =
false;
114 unsigned int maxAlign = 0;
117 virtual void reSize();
118 virtual void fillSizeAndOffset(
char* length,
int elementNum);
119 virtual void fillLengths(
char* length,
int elementNum);
120 virtual StTypeE getType(
char* type);
121 virtual unsigned int getSize(StTypeE type);
122 virtual unsigned int getAlign(StTypeE type);
130 virtual void fillElement(
StDbBuffer* buff,
int tableID);
134 virtual unsigned int getNumElements()
const;
135 virtual unsigned int getTotalSizeInBytes()
const;
136 virtual char* getElementName(
int elementNum)
const;
137 virtual unsigned int getElementOffset(
int elementNum)
const;
138 virtual unsigned int getElementSize(
int elementNum)
const;
139 virtual StTypeE getElementType(
int elementNum)
const;
140 virtual unsigned int* getElementDimensions(
int elementNum)
const;
141 virtual unsigned int getElementLength(
int elementNum)
const;
142 virtual unsigned int getElementNumDimensions(
int elementNum)
const;
143 virtual unsigned int getElementIndexLength(
int elementNum,
int dimensionNum)
const;
146 int getSchemaID()
const;
147 int getStructID()
const;
148 void setSchemaID(
int id);
149 void setStructID(
int id);
150 bool IsValid()
const;
151 int getCurrentInternalSize();
153 void endRowPadding();
154 void storeRowSize(
int rowSize);
155 unsigned int getMaxAlign();
160 StDbTableDescriptor::getNumElements()
const {
return mnumElements;}
163 StDbTableDescriptor::getTotalSizeInBytes()
const {
return mtableSize;}
166 StDbTableDescriptor::getElementName(
int elementNum)
const {
167 char* retVal =
new char[strlen(mcols[elementNum].name)+1];
168 strcpy(retVal,mcols[elementNum].name);
173 StDbTableDescriptor::getElementOffset(
int elementNum)
const {
174 return mcols[elementNum].offset;
177 inline unsigned int StDbTableDescriptor::getElementSize(
int elementNum)
const{
178 return mcols[elementNum].size;
181 inline StTypeE StDbTableDescriptor::getElementType(
int elementNum)
const {
182 return mcols[elementNum].type;
186 StDbTableDescriptor::getElementDimensions(
int elementNum)
const {
187 return &mcols[elementNum].dimensionlen[0];
193 StDbTableDescriptor::getElementLength(
int elementNum)
const {
197 int k= (int)(
sizeof(mcols[elementNum].dimensionlen)/
sizeof(j));
198 for(j=0;j<k;j++)retVal *= mcols[elementNum].dimensionlen[j];
205 StDbTableDescriptor::getElementNumDimensions(
int elementNum)
const {
208 int k= (int)(
sizeof(mcols[elementNum].dimensionlen)/
sizeof(j));
210 if(mcols[elementNum].dimensionlen[j]>1)retVal=j+1;
216 StDbTableDescriptor::getElementIndexLength(
int elementNum,
int dimensionNum)
const {
217 return mcols[elementNum].dimensionlen[dimensionNum];
220 inline unsigned int StDbTableDescriptor::getSize(StTypeE type){
return mycsize[type];}
221 inline unsigned int StDbTableDescriptor::getAlign(StTypeE type){
return mAlign[type];}
222 inline int StDbTableDescriptor::getSchemaID()
const {
return mschemaID; }
223 inline int StDbTableDescriptor::getStructID()
const {
return mstructID; }
224 inline void StDbTableDescriptor::setSchemaID(
int id) { mschemaID=id; }
225 inline void StDbTableDescriptor::setStructID(
int id) { mstructID=id; }
226 inline bool StDbTableDescriptor::IsValid()
const {
return misValid; }
227 inline int StDbTableDescriptor::getCurrentInternalSize() {
return mMax; };
228 inline void StDbTableDescriptor::storeRowSize(
int rowSize) { rowSizeTT = rowSize; }
229 inline int StDbTableDescriptor::getTrowSize() {
return rowSizeTT; };
230 inline unsigned int StDbTableDescriptor::getMaxAlign() {
return maxAlign; };