// *********************************************************************** // Column-refine.cc - implementation of Column: routines // associated with refining a column. // // The following methods are in this file: // Column::setPacking // Column::setSpan // Column::setIndex // Column::setDimension // Column::getPacking // Column::getSpan // Column::getIndex // Column::getDimension // // *********************************************************************** #include "ZMutility/iostream" #include USING( std::string ) #include "HepTuple/HepFileManager.h" #include "HepTuple/Column.h" #include "HepTuple/TupleNameTag.h" ZM_BEGIN_NAMESPACE( zmht ) /* namespace zmht { */ // **************************************** // *** Column::setPacking() // **************************************** bool Column::setPacking(int nbits, float low, float high) { if( _hasBeenStored ) { // It is frozen ! ZMthrow(ZMxHepLockedItem(string("Column ")+name() +string(" can not be modified because it has already been stored"))); return false; } else _attributes.nbits = nbits; _attributes.rangeLo = low; _attributes.rangeHi = high; return true; } /* Column::setPacking() */ // **************************************** // *** Column::setSpan() // **************************************** bool Column::setSpan(int min, int max) { if( _hasBeenStored ) { // It is frozen ! ZMthrow(ZMxHepLockedItem(string("Column ")+name() +string(" can not be modified because it has already been stored"))); return false; } _attributes.indexHi = max; _attributes.indexLo = min; return true; } /* Column::setSpan() */ // **************************************** // *** Column::setIndex() // **************************************** bool Column::setIndex(const string& indextag) { if( _hasBeenStored ) { // It is frozen ! ZMthrow(ZMxHepLockedItem(string("Column ")+name() +string(" can not be modified because it has already been stored"))); return false; } _attributes.index = indextag; return true; } /* Column::setIndex() */ // **************************************** // *** Column::setDimension() // **************************************** bool Column::setDimension(int dim1, int dim2, int dim3, int dim4, int dim5, int dim6, int dim7, int dim8, int dim9, int dim10) { if( _hasBeenStored ) { // It is frozen ! ZMthrow(ZMxHepLockedItem(string("Column ")+name() +string(" can not be modified because it has already been stored"))); return false; } _attributes.extents[0] = dim1; _attributes.extents[1] = dim2; _attributes.extents[2] = dim3; _attributes.extents[3] = dim4; _attributes.extents[4] = dim5; _attributes.extents[5] = dim6; _attributes.extents[6] = dim7; _attributes.extents[7] = dim8; _attributes.extents[8] = dim9; _attributes.extents[9] = dim10; if(dim1<1) { _attributes.ndim = 0; return true; } else if(dim2<1) { _attributes.ndim = 1; return true; } else if(dim3<1) { _attributes.ndim = 2; return true; } else if(dim4<1) { _attributes.ndim = 3; return true; } else if(dim5<1) { _attributes.ndim = 4; return true; } else if(dim6<1) { _attributes.ndim = 5; return true; } else if(dim7<1) { _attributes.ndim = 6; return true; } else if(dim8<1) { _attributes.ndim = 7; return true; } else if(dim9<1) { _attributes.ndim = 8; return true; } else if(dim10<1) { _attributes.ndim = 9; return true; } else { _attributes.ndim = 10; return true; } } /* Column::setDimension() */ // **************************************** // *** Column::getPacking() // **************************************** bool Column::getPacking(int* nbits, float* low, float* high) { *nbits = _attributes.nbits; *low = _attributes.rangeLo; *high = _attributes.rangeHi; return true; } /* Column::getPacking() */ // **************************************** // *** Column::getSpan() // **************************************** bool Column::getSpan(int* min, int* max) { *max = _attributes.indexHi; *min = _attributes.indexLo; return true; } /* Column::getSpan() */ // **************************************** // *** Column::getIndex() // **************************************** string Column::getIndex() { return ( _attributes.index ); } /* Column::getIndex() */ // **************************************** // *** Column::getDimension() // **************************************** int Column::getDimension(int* dims) { int i = 0 ; int k = _attributes.ndim ; for(i=0;i