#ifndef HEPCOLUMNT_H #define HEPCOLUMNT_H // ---------------------------------------------------------------------- // // ColumnT.h - class declaration for a ColumnT of an Ntuple // // This class implement the type dependent operation for a Column ZM_BEGIN_NAMESPACE( zmht ) /* namespace zmht { */ template class ColumnT : public Column { public: typedef T (*inputFunction)(); typedef void (*outputFunction)(T); // ************************ // // ***** Constructors ***** // // ***** Destructors ***** // // ************************ // ColumnT( Block* block, ColumnAttribs attrib); ColumnT( Block* block, const std::string& tag); // The two previous constructor assume that the ColumnData_t given // (directly or through attrib is equivalent to the class T virtual ~ColumnT(); // ********************* // // ***** Modifiers ***** // // ********************* // bool setDefaultValue(T defVal); bool setDesignatedVariable(T* variable); bool setDesignatedFunction( inputFunction ); bool setDesignatedMethod(ZMuseMethod* methodUser ); // designated variable and designated function are mutually exclusive // if you set one, the other return to 0. bool setDestinationVariable(T* variable); bool setDestinationFunction( outputFunction ); bool setDestinationMethod(ZMsetMethod* methodUser ); // designated variable and designated function are mutually exclusive // if you set one, the other return to 0. // ****************************** // // ***** Capture functions ***** // // ****************************** // virtual bool captureDesignatedValues(); //virtual ColumnData_t Type(); //using Column::checkType; //virtual bool checkType(T val); bool captureValue(T newVal); // capture newVal. ZMthrow an exception (or return false) if // the column has already been captured (and not yet stored) bool captureValues(const T newVal[],int indexVal = 0); // capture the array of newVal. ZMthrow an exception (or return false) if // the column has already been captured (and not yet stored) or is not // a array of columns. if an indexval is supplied, only that number of // values for the slowest-varying dimension are captured. virtual void* copyFromMem(const void* addr); // this copy the content of addr into the Column value // and return (addr + sizeofElem()) // ************************** // // ***** Read Functions ***** // // ************************** // virtual bool read(const void * addr); // copy the value pointed to by addr to the designated variable/ // function/method. WARNING This CAN NOT check if the value is of // the proper type. The addr MUST point to an array of the proper size // if the column is an array. virtual bool read(); // copy the value of the column addr to the designated variable/ // function/method. // ********************* // // ***** Accessors ***** // // ********************* // virtual void* getValueAddr(); // return the address of the value of the column. virtual void setToDefault(); // reset the column to the default value (if any!) virtual Column* duplicate(Block* newBlock); // return an exact duplicate of this without any value, virtual std::string::size_type sizeofElem() const; // return the size of the content of the column virtual std::string::size_type sizeofSingleElem() const; // return the size of a single element of the column (same as above // except in the case of array) virtual void* copyToMem(void* addr); // this copy the content of the column at the location indicated by // addr and return (addr + sizeofElem()) virtual bool copyToMem(void* addr, const std::string& indices); // this copy the content of the cell of a column array // to the location indicated by addr and true unless the column // was not an array or the indices are not understood. private: T value; T* valuesArray; }; ZM_END_NAMESPACE( zmht ) /* } // namespace zmht */ #endif // HEPCOLUMNT_H