#ifndef ROOT_THaArrayString
#define ROOT_THaArrayString

//////////////////////////////////////////////////////////////////////////
//
// THaArrayString
//
//////////////////////////////////////////////////////////////////////////

#include "TString.h"

class THaArrayString {
  
public:
  enum EStatus { kOK, kBadsyntax, kIllegalchars, kToolarge,  kToolong, 
		 kNotinit };

  THaArrayString() : fNdim(0), fDim(NULL), fLen(-1), fStatus(kNotinit) {}
  THaArrayString( const char* string ) 
    : fName(string), fDim(NULL), fLen(-1)   { Parse(); }
  THaArrayString( const THaArrayString& );
  THaArrayString& operator=( const THaArrayString& );
  THaArrayString& operator=( const char* rhs )
  { Parse( rhs ); return *this; }
  virtual ~THaArrayString()           { delete [] fDim; }

  operator const char*() const { return fName.Data(); }

  const Int_t*    GetDim()  const { return fDim; }
  Int_t           GetLen()  const { return fLen; }
  const char*     GetName() const { return fName.Data(); }
  Byte_t          GetNdim() const { return fNdim; }
  ULong_t         Hash()    const { return fName.Hash(); }
  Bool_t          IsArray() const { return (fNdim > 0); }
  Bool_t          IsError() const { return (fStatus != kOK); }
  virtual Int_t   Parse( const char* string="" );
  virtual void    Print( Option_t* opt="" );
  EStatus         Status()  const { return fStatus; }

protected:

  TString  fName;            //Variable name
  Byte_t   fNdim;            //Number of array dimensions (0=scalar)
  Int_t*   fDim;             //Dimensions, if any (NULL for scalar)
  Int_t    fLen;             //Length of array (product of all dimensions)
  EStatus  fStatus;          //Status of Parse()

  ClassDef(THaArrayString,0) //Parser for variable names with support for arrays
};

#endif


Last change: Sat Nov 7 21:26:42 2009
Last generated: 2009-11-07 21:26

This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.