TTablePoints.h

Go to the documentation of this file.
00001 // @(#)root/table:$Id: TTablePoints.h 20882 2007-11-19 11:31:26Z rdm $
00002 // Author: Valery Fine   14/05/99  (E-mail: fine@bnl.gov)
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010  *************************************************************************/
00011 
00012 #ifndef ROOT_TTablePoints
00013 #define ROOT_TTablePoints
00014 
00015 #include "TPoints3DABC.h"
00016 #include "TTableSorter.h"
00017 #include "TTable.h"
00018 
00019 class TTablePoints : public TPoints3DABC
00020 {
00021 protected:
00022    TTableSorter   *fTableSorter;
00023    const void     *fKey;            // pointer to key value to select rows
00024    Int_t           fFirstRow;       // The first row to take in account
00025    Int_t           fSize;
00026    void           *fRows;           // Pointer the first row of the STAF table
00027 
00028    virtual void SetTablePointer(void *table);
00029    TTablePoints();
00030 public:
00031    TTablePoints(TTableSorter *sorter,const void *key,Option_t *opt="");
00032    TTablePoints(TTableSorter *sorter, Int_t keyIndex,Option_t *opt="");
00033    ~TTablePoints(){}
00034    virtual Int_t     DistancetoPrimitive(Int_t px, Int_t py);
00035    virtual Int_t     GetLastPosition()const;
00036    virtual Float_t   GetX(Int_t idx)  const = 0;
00037    virtual Float_t   GetY(Int_t idx)  const = 0;
00038    virtual Float_t   GetZ(Int_t idx)  const = 0;
00039    virtual void     *GetTable();
00040    virtual Option_t *GetOption()      const { return 0;}
00041    virtual Int_t     Indx(Int_t sortedIndx) const;
00042    virtual Int_t     SetLastPosition(Int_t idx);
00043    virtual void      SetOption(Option_t *){;}
00044    virtual Int_t     SetPoint(Int_t, Float_t, Float_t, Float_t ){return -1;}
00045    virtual Int_t     SetPoints(Int_t , Float_t *, Option_t *){return -1;}
00046    virtual Int_t     Size() const;
00047    ClassDef(TTablePoints,0)  // Defines the TTable as an element of "event" geometry
00048 };
00049 
00050 //____________________________________________________________________________
00051 inline void TTablePoints::SetTablePointer(void *table){ fRows = table;}
00052 
00053 //____________________________________________________________________________
00054 // return the index of the origial row by its index from the sorted table
00055 inline Int_t TTablePoints::Indx(Int_t sortedIndx) const
00056 {return fTableSorter?fTableSorter->GetIndex(fFirstRow+sortedIndx):-1;}
00057 //____________________________________________________________________________
00058 // return the pointer to the original table object
00059 inline void *TTablePoints::GetTable(){
00060    void *ret = 0;
00061    if (fTableSorter) {
00062       TTable *t = fTableSorter->GetTable();
00063       if (t) ret = t->GetArray();
00064    }
00065    return ret;
00066 }
00067 //____________________________________________________________________________
00068 inline Int_t TTablePoints::Size() const { return fSize;}
00069 //____________________________________________________________________________
00070 inline Int_t TTablePoints::GetLastPosition() const {return Size()-1;}
00071 
00072 //____________________________________________________________________________
00073 inline Int_t TTablePoints::SetLastPosition(Int_t idx)
00074 {
00075    Int_t pos = GetLastPosition();
00076    fSize = TMath::Min(pos,idx)+1;
00077    return pos;
00078 }
00079 
00080 #endif
00081 

Generated on Tue Jul 5 14:28:15 2011 for ROOT_528-00b_version by  doxygen 1.5.1