// // File : T3PixelList.hh // // Purpose: Declaration of the class T3PixelList. // // $Id: T3PixelList.hh 11539 2010-09-30 14:31:54Z mathes $ // /** @file T3PixelList.hh * Declaration of the class T3PixelList. * @author P. Privitera & P. Facal, INFN Rome */ #ifndef _T3PixelList_hh_ #define _T3PixelList_hh_ #include /** This class implements a list of pixels made up of T3PixelSel objects. */ class T3PixelList { public: /** A typedef for the iterator over the T3PixelSel vector. */ typedef std::vector::iterator T3PixelListIterator; /** Constructor for the class T3PixelList. * The length of the list is set to 0. */ T3PixelList() { } /** Destructor of the class T3PixelList. * Before the deletion of the list, all its elements are deleted. */ virtual ~T3PixelList() { T3PixelListIterator iter; for (iter = fT3List.begin(); iter != fT3List.end(); ) { delete *iter; iter = fT3List.erase(iter); } } /** Add a new pixel (object T3PixelSel) to the list. */ void AddT3Pixel(T3PixelSel *pix) { fT3List.push_back(pix); } /** Remove a pixel (object T3PixelSel) from the list. */ void DeleteT3Pixel(unsigned int); /** Get the number of pixels (objects T3PixelSel) currently hold in the * list. */ int GetT3Pixels() { return fT3List.size(); } /** Return a pointer to the T3PixelSel object at the specified position * in the list. This pointer must not be deleted. */ T3PixelSel* GetPixel(unsigned int pix) { if ( !fT3List.empty() && pix < fT3List.size() ) return fT3List[pix]; else { FD_CERR << "T3PixelSel::GetPixel() - the index " << pix << " is out-of-bounds !" << std::endl; } return NULL; } /** Print the contents of this object to the specified stream. */ virtual void Show(FILE *str=stdout); /** Print the contents of this object to the specified stream. */ virtual void Show(std::ostream& ostr=std::cout); #ifdef USE_UBA_EXTENSION /** Set the number of pixels with no pulse observed. */ void SetNullPixels(int npix) { fNullPixels = npix; } /** Get the number of pixels with no observed pulse. */ int GetNullPixels() const { return fNullPixels; } #endif // USE_UBA_EXTENSION private: std::vector fT3List; #ifdef USE_UBA_EXTENSION int fNullPixels; #endif // USE_UBA_EXTENSION }; #endif // _T3PixelList_hh_