#ifndef HEPTUPLENAMETAG_H #define HEPTUPLENAMETAG_H // ---------------------------------------------------------------------- // // NameTag.h - class declaration for the nameTag of a column. // // This simple structure is used to parse a column name for a ntuple // that can be of the form "block_name::column_name" or "column_name" // The block name is an alpha numerical string whithout any white space. // The column name is as defined by HBook. // isValid is false if the name tag parsed was not correctly formed. #ifndef ZMENVIRONMENT_H #include "ZMutility/ZMenvironment.h" #endif #include ZM_BEGIN_NAMESPACE( zmht ) /* namespace zmht { */ class TupleNameTag { public: static const std::string NameTagDelimiter; static const std::string IndicesStart; static const std::string IndicesDelimiter; static const std::string IndicesStop; // The following to are reference for efficiency reason. // The lifetime of this address is the same as the object. const std::string& block() const; const std::string& column() const; std::string tag() const; std::string indices() const; int* indicesArray(int *size) const; virtual bool isValid() const; /* TupleNameTag(const std::string& tag,bool withIndices = false); */ TupleNameTag(const TupleNameTag &copied); virtual ~TupleNameTag(); TupleNameTag(); // Constructor used by sub-class. void init( std::string tag,bool withIndices, TupleNameTag& tagtoset ); // function that actually set the block and column // name to there proper values. // ALL sub-class need to call this function in their // constructor. This is to be able to use correctly // the two following virtual function. protected: virtual bool isValidBlockName(const std::string& name) const; virtual bool isValidColumnName(const std::string& name) const; // return true if it is a syntaxically correct block/column name // return false otherwise; // The implementation in this class just verify that there is no // white space virtual bool setIndices(const std::string& index, TupleNameTag& tag ); // return false if index does not contain a valid set of indices (in between // parantheses and comma delimited) // set the TupleNameTag data members for indices. std::string _block; std::string _column; std::string _indices; int *_indicesArray; int _indicesSize; bool _allowIndices; }; ZM_END_NAMESPACE( zmht ) /* } // namespace zmht */ #endif // HEPTUPLENAMETAG_H