]> git.uio.no Git - u/mrichter/AliRoot.git/blob - RALICE/AliObjMatrix.h
04-mar-2004 NvE Functionality of AliObjMatrix extended to provide the number of refer...
[u/mrichter/AliRoot.git] / RALICE / AliObjMatrix.h
1 #ifndef ALIOBJMATRIX_H
2 #define ALIOBJMATRIX_H
3 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4  * See cxx source for full Copyright notice                               */
5
6 // $Id$
7
8 #include "TObject.h"
9 #include "TObjArray.h"
10 #include "TRefArray.h"
11 #include "TArrayI.h"
12
13 class AliObjMatrix : public TObject
14 {
15  public:
16   AliObjMatrix();                                             // Default constructor
17   virtual ~AliObjMatrix();                                    // Default destructor
18   virtual void Reset();                                       // Reset the whole matrix structure
19   virtual void SetOwner(Int_t own=1);                         // Set the owner flag for the stored objects
20   virtual Int_t GetOwner();                                   // Provide the owner flag for the stored objects
21   virtual void SetSwapMode(Int_t swap=1);                     // Set the swap mode flag for this matrix
22   virtual Int_t GetSwapMode();                                // Provide the swap mode flag for this matrix
23   virtual void EnterObject(Int_t row,Int_t col,TObject* obj); // Enter an object into the matrix
24   void RemoveObject(Int_t row,Int_t col);                     // Remove object at (row,col) from the matrix
25   void RemoveObject(TObject* obj,Int_t row=0,Int_t col=0);    // Remove an object from the matrix
26   virtual TObject* GetObject(Int_t row,Int_t col);            // Provide an object from the matrix
27   virtual Int_t GetMaxRow();                                  // Provide the maximum row number index
28   virtual Int_t GetMaxColumn();                               // Provide the maximum column number index
29   virtual Int_t GetNobjects();                                // Provide the number of stored objects
30   virtual TObject* GetObject(Int_t j);                        // Provide pointer to the j-th object
31   virtual TObjArray* GetObjects();                            // Provide pointers of all stored onjects
32   Int_t GetNrefs(TObject* obj);                               // Provide # of stored references to this object
33   Int_t GetIndices(TObject* obj,TArrayI& rows,TArrayI& cols); // Provide all (row,col) indices of this object
34   Int_t GetIndices(TObject* obj,Int_t row,TArrayI& cols);     // Provide column indices in a specific row
35   Int_t GetIndices(TObject* obj,TArrayI& rows,Int_t col);     // Provide row indices in a specific column
36  
37  protected:
38   TObjArray* fRows;    // Pointers to the various arrays representing the matrix rows
39   Int_t fOwn;          // Flag to indicate whether the objects are owned by the matrix structure
40   Int_t fSwap;         // Flag to indicate swapped mode for internal matrix storage
41   Int_t fMaxrow;       // The maximum row number index
42   Int_t fMaxcol;       // The maximum column number index
43   TObjArray* fObjects; // Linear reference array for fast looping over the stored objects
44  
45  ClassDef(AliObjMatrix,3) // Handling of a matrix structure of objects.
46 };
47 #endif