136 #include "StDbNode.hh"
137 #include "StDbTime.h"
139 #include "StTableDescriptorI.h"
141 #include "StDbStoreInfo.hh"
158 unsigned int mprodTime;
189 unsigned int* mtimeVals;
191 virtual void ReadElement(
char*& ptr,
char* name,
int length, StTypeE type,
StDbBuffer* buff);
192 virtual void WriteElement(
char* ptr,
char* name,
int length, StTypeE type,
StDbBuffer* buff);
193 virtual void PassOutElement(
char* ptr,
char* name,
int length, StTypeE type,
typeAcceptor* accept);
194 virtual void PassInElement(
char* ptr,
char* name,
int length, StTypeE type,
typeAcceptor* accept);
195 virtual void getElementSpecs(
int elementNum,
char*& c,
char*& name,
unsigned int& length,StTypeE& type);
198 bool createMemory(
int nrows);
199 char* duplicateData();
201 void printNoDataReturned(
const char* elementName);
207 StDbTable(
const char* tableName,
int schemaID);
210 virtual ~
StDbTable(){
if(melementID)
delete [] melementID;
211 if(mdescriptor)
delete mdescriptor;
213 if(mdataTable)
delete [] mdataTable;
214 if(mstructName)
delete [] mstructName;
215 if(melementName)
delete [] melementName;
216 if(mtimeVals)
delete [] mtimeVals;
217 if(mflavor)
delete [] mflavor;
220 virtual bool IsTable()
const;
221 virtual void setNodeInfo(
StDbNode* node);
222 virtual unsigned int getTableSize()
const;
223 virtual char* getCstructName();
224 virtual char* printCstructName();
225 virtual void setCstructName(
const char* name);
226 virtual void setDataTable(
const char* name);
227 virtual char* getDataTable();
228 virtual char* printDataTable();
233 virtual char* getFlavor();
234 virtual char* printFlavor();
235 virtual void setFlavor(
const char* flavor);
236 virtual bool defaultFlavor()
const;
237 virtual void setDefaultFlavor();
239 virtual unsigned int getProdTime();
240 virtual void setProdTime(
unsigned int ptime);
242 virtual unsigned int getEndTime()
const ;
243 virtual char* getEndDateTime();
244 virtual void setEndTime(
unsigned int time);
245 virtual void setEndTime(
const char* time);
247 virtual unsigned int getBeginTime()
const ;
248 virtual char* getBeginDateTime();
249 virtual void setBeginTime(
unsigned int time) ;
250 virtual void setBeginTime(
const char* time);
252 virtual unsigned int getEndStoreTime()
const;
253 virtual char* getEndStoreDateTime();
254 virtual void setEndStoreTime(
unsigned int time);
255 virtual void setEndStoreTime(
const char* time);
257 virtual int* getElementID(
int& nrows);
258 virtual int getRowID(
int rowNumber)
const ;
259 virtual char* getElementName();
260 virtual char* printElementName();
261 virtual void setElementName(
const char* ename);
262 virtual void setElementID(
int* elements,
int nrows);
264 virtual void setBaseLine(
bool baseLine);
265 virtual void setIndexed(
bool indexed);
266 virtual void setBinary(
bool abinary);
267 virtual bool IsBaseLine()
const;
268 virtual bool IsIndexed()
const;
269 virtual bool IsBinary()
const;
271 virtual int getSchemaID()
const ;
272 virtual void setSchemaID(
int id) ;
275 virtual void addWrittenRows(
int* dataID,
int numRows,
bool canRollBack=
false);
276 virtual int* getWrittenRows(
int& numRows);
277 virtual void commitData();
278 virtual void clearStoreInfo();
279 virtual unsigned int* getTimeValues();
280 virtual unsigned int getMaxTime();
281 virtual void setTimeValues(
unsigned int* timeValues);
289 virtual bool hasDescriptor()
const;
290 void checkDescriptor();
295 virtual char* GetTable();
296 virtual void* GetTableCpy();
297 virtual void SetTable(
char*
data,
int nrows,
int* idList=0);
298 virtual void AddRows(
char*
data,
int nrows);
300 virtual int GetNRows()
const;
301 virtual void setRowNumber(
int row=0);
302 virtual bool hasData()
const;
303 virtual void* getDataValue(
const char* name,
int rowNumber=0);
306 virtual int getRowLimit()
const;
307 virtual void setRowLimit(
int nrows);
308 virtual void addNRows(
int newRows);
311 virtual void addNElements(
int* elements,
int newRows);
312 virtual void resizeNumRows(
int nrows);
313 virtual void resizeElementID(
int numRows);
316 virtual void StreamAccessor(
typeAcceptor* accept,
bool isReading);
317 virtual void dbStreamer(
typeAcceptor* accept,
bool isReading);
318 virtual void StreamAccessor(
StDbBufferI* buff,
bool isReading);
319 virtual void dbStreamer(
StDbBufferI* buff,
bool isReading);
321 virtual void dbTableStreamer(
StDbBufferI* buff,
const char* name,
bool isReading);
327 inline bool StDbTable::IsTable()
const {
return true; };
328 inline unsigned int StDbTable::getTableSize()
const {
329 if(
mhasDescriptor && !mdescriptor->getTrowSize())
return mdescriptor->getTotalSizeInBytes();
333 inline char* StDbTable::printCstructName() {
return mstructName; }
334 inline char* StDbTable::printDataTable() {
return mdataTable; }
335 inline char* StDbTable::printFlavor() {
return mflavor; }
336 inline bool StDbTable::defaultFlavor()
const {
return mdefaultFlavor;}
337 inline void StDbTable::setProdTime(
unsigned int ptime) { mprodTime=ptime; }
338 inline unsigned int StDbTable::getProdTime() {
return mprodTime; }
339 inline unsigned int StDbTable::getEndTime()
const {
return mendTime.munixTime; }
340 inline char* StDbTable::getEndDateTime() {
return mendTime.mdateTime; }
341 inline void StDbTable::setEndTime(
unsigned int time){ mendTime.munixTime=time;}
342 inline void StDbTable::setEndTime(
const char* time){mendTime.setDateTime(time);}
343 inline unsigned int StDbTable::getBeginTime()
const {
return mbeginTime.munixTime; }
344 inline char* StDbTable::getBeginDateTime() {
return mbeginTime.mdateTime; }
345 inline void StDbTable::setBeginTime(
unsigned int time){
mbeginTime.munixTime = time; }
346 inline void StDbTable::setBeginTime(
const char* time){
mbeginTime.setDateTime(time); }
347 inline unsigned int StDbTable::getEndStoreTime()
const {
return mendStoreTime.munixTime; }
348 inline char* StDbTable::getEndStoreDateTime() {
return mendStoreTime.mdateTime; }
349 inline void StDbTable::setEndStoreTime(
unsigned int time) {mendStoreTime.munixTime = time; }
350 inline void StDbTable::setEndStoreTime(
const char* time){ mendStoreTime.setDateTime(time); }
351 inline int* StDbTable::getElementID(
int& nrows) { nrows = mrows;
return melementID; }
353 inline int StDbTable::getRowID(
int rowNumber)
const {
354 if(rowNumber<mrows)
return melementID[rowNumber];
357 inline unsigned int* StDbTable::getTimeValues(){
return mtimeVals; }
358 inline void StDbTable::setTimeValues(
unsigned int* timeValues){
359 if(mtimeVals)
delete [] mtimeVals;
360 mtimeVals=timeValues;
362 inline unsigned int StDbTable::getMaxTime() {
363 unsigned int retVal=0;
364 for(
int i=0; i<mrows;i++)if(mtimeVals[i]>retVal)retVal=mtimeVals[i];
367 inline char* StDbTable::printElementName() {
return melementName; }
368 inline int StDbTable::getSchemaID()
const {
return mschemaID; }
369 inline void StDbTable::setSchemaID(
int id) {mschemaID = id; }
371 inline bool StDbTable::hasDescriptor()
const {
return mhasDescriptor; }
373 inline int StDbTable::GetNRows()
const {
return mrows; }
374 inline void StDbTable::setRowLimit(
int nrows) { mrowsRequested=nrows; };
375 inline int StDbTable::getRowLimit()
const {
return mrowsRequested; };
376 inline void StDbTable::setRowNumber(
int row){
if(row < mrows)mrowNumber = row;}
377 inline bool StDbTable::hasData()
const {
return mhasData; };
378 inline void StDbTable::setBinary(
bool abinary) { mIsBinary=abinary; }
379 inline void StDbTable::setBaseLine(
bool baseLine) { mIsBaseLine=baseLine; }
380 inline void StDbTable::setIndexed(
bool indexed) { mIsIndexed=indexed; }
381 inline bool StDbTable::IsBinary()
const {
return mIsBinary; }
382 inline bool StDbTable::IsBaseLine()
const {
return mIsBaseLine; }
383 inline bool StDbTable::IsIndexed()
const {
return mIsIndexed; }
StDbStoreInfo mstoredData
for rolling back stores
virtual void SetTable(char *data, int nrows, int *idList=0)
calloc'd version of data for StRoot
bool mhasDescriptor
c-struct descriptor information
StDbTime mbeginTime
validity interval
char * mdata
data & num of rows