#ifndef HEPCOLUMNATTRIBS_H #define HEPCOLUMNATTRIBS_H #include "ZMutility/iostream" // ---------------------------------------------------------------------- // // ColumnAttribs.h - class declaration for ColumnAttribs // // This class is use to contain the information regardin an Ntuple Column ZM_BEGIN_NAMESPACE( zmht ) /* namespace zmht { */ //This enum defines the types-of-column enum ColumnData_t { Int1_ct, Int2_ct, Int4_ct, Int8_ct, Uint1_ct, Uint2_ct, Uint4_ct, Uint8_ct, Float4_ct, Float8_ct, Float16_ct, Bool_ct, Bool2_ct, Bool4_ct, //compatible to Logical*2, *4 in HBOOK Ptr_ct, // pointer type ... expect an address of an object the manager can // understand. (TObject* for ROOT) Char_ct, Char4_ct, Char8_ct, Char12_ct, Char16_ct, Char20_ct, Char24_ct, Char28_ct, Char32_ct, ColumnData_t_End }; //This global array contains definition concerning the object types: struct TypeInfo { char* shortcut; std::string::size_type memSize; std::string::size_type diskSize; }; // Char32_ct+1 correspond to the size of the ColumcData_t enums extern TypeInfo TypeInformation[]; typedef void(*genericFunction)(); const int MAX_DIM = 10; struct ColumnAttribs { // ************************************ // // ****** Column Information ********* // // ************************************ // std::string tag; // . .. . Must be unique across entire Ntuple ColumnData_t type; // . . Int2_ct, Int4_ct, Float4_ct, ... void* variable; // . . . . Designated variable genericFunction function;// Designated function void* getMethod; // pointer to use ZMuseMethod for Designated Method void* destination; // . . . . Destination variable genericFunction destFunction; // Destination function void* setMethod; // pointer to use ZMsetMethod for Designated Method void* defaultVal; // . . . Value assigned to uncaptured data int nbits; // . . . . . . Packing - number of bits. 0 = no packing float rangeLo; // . . . . Packing - minimum value in range float rangeHi; // . . . . Packing - maximum value in range int indexLo; // . . . . . Span of index variable - minimum int indexHi; // . . . . . Span of index variable - maximum int ndim; // . . . . . . . Number of dimensions in array of columns int extents[MAX_DIM]; // . Array containing extents in each of ndims // dimensions std::string index; // . . Column tag to use as index for first dimension bool isIndex; // . . . . . True if another column uses it as an index. // ************************************ // // ****** Constructor/Destructor ****** // // ************************************ // ColumnAttribs(const std::string& tagName); ColumnAttribs(const std::string& tagName,ColumnData_t colType); ColumnAttribs(const ColumnAttribs& oldVersion); ColumnAttribs& operator= (const ColumnAttribs& CA); ~ColumnAttribs(); // ************************************ // // ****** Composite Information ******* // // ************************************ // int sumDim() const; // return the sum of all dimensions in extsnts std::string format() const; // return the chform for the current column bool copyDefaultValue(void *valP,ColumnData_t t); // ******************************* // // ****** Type Information ******* // // ******************************* // bool checkType(ColumnData_t t); // return true if the type t is acceptable for the current ColumnAttribs bool setDefaultValue(Int1 val); bool setDefaultValue(Int2 val); bool setDefaultValue(Int4 val); #ifdef Int8 bool setDefaultValue(Int8 val); #endif bool setDefaultValue(UInt1 val); bool setDefaultValue(UInt2 val); bool setDefaultValue(UInt4 val); #ifdef Uint8 bool setDefaultValue(UInt8 val); #endif bool setDefaultValue(Float4 val); bool setDefaultValue(Float8 val); #ifdef Float16 bool setDefaultValue(Float16 val); #endif bool setDefaultValue(bool val); bool setDefaultValue(void* val); // Those are public but are for debug purpose only void print(std::ostream& o) const; friend std::ostream& operator << (std::ostream& o, const ColumnAttribs& ca) { ca.print(o); return o; } }; /* ColumnAttribs */ ZM_END_NAMESPACE( zmht ) /* } // namespace zmht */ #include "HepTuple/ColumnAttribs.icc" #endif // HEPCOLUMNATTRIBS_H