library: libTable #include "TDataSetIter.h"

# TDataSetIter

class description - source file - inheritance tree (.pdf)

## class TDataSetIter : public TObject

| Inheritance Chart:

`TObject`

<-

`TDataSetIter`

<-

`TVolumeViewIter` |

        protected:

          TDataSet* GetNullSet()
          TDataSet* NextDataSet(TIter& next)
          TDataSet* NextDataSet(Int_t nDataSet)

        public:

                            TDataSetIter(TDataSet* l = 0, Int_t depth = 1, Bool_t dir = kIterForward)
                            TDataSetIter(TDataSet* l, Bool_t dir)
                            TDataSetIter(const TDataSetIter&)
                    virtual ~TDataSetIter()
          virtual TDataSet* Add(TDataSet* set)
          virtual TDataSet* Add(TDataSet* set, const Char_t* path)
          virtual TDataSet* Add(TDataSet* set, TDataSet* dataset)
          virtual TDataSet* Cd(const Char_t* dirname)
          virtual TDataSet* Cd(TDataSet* ds)
             static TClass* Class()
          virtual TDataSet* Cwd() const
              virtual Int_t Df() const
          virtual TDataSet* Dir(Char_t* dirname)
              virtual Int_t Du() const
          virtual TDataSet* Find(const Char_t* path, TDataSet* rootset = 0, Bool_t mkdir = kFALSE, Bool_t titleFlag = kFALSE)
          virtual TDataSet* FindByName(const Char_t* name, const Char_t* path = "", Option_t* opt = "")
          virtual TDataSet* FindByPath(const Char_t* path, TDataSet* rootset = 0, Bool_t mkdir = kFALSE)
          virtual TDataSet* FindByPointer(TDataSet* set, const Char_t* path = "0", Option_t* opt = "")
          virtual TDataSet* FindByTitle(const Char_t* title, const Char_t* path = "", Option_t* opt = "")
          virtual TDataSet* FindDataSet(const Char_t* name, const Char_t* path = "", Option_t* opt = "")
          virtual TDataSet* FindDataSet(TDataSet* set, const Char_t* path, Option_t* opt = "")
           virtual TObject* FindObject(const Char_t* name) const
           virtual TObject* FindObject(const TObject* obj) const
              virtual Int_t Flag(UInt_t flag = TDataSet::kMark, TDataSet::EBitOpt reset = TDataSet::kSet)
              virtual Int_t Flag(const Char_t* path, UInt_t flag = TDataSet::kMark, TDataSet::EBitOpt reset = TDataSet::kSet)
              virtual Int_t Flag(TDataSet* dataset, UInt_t flag = TDataSet::kMark, TDataSet::EBitOpt reset = TDataSet::kSet)
              virtual Int_t GetDepth() const
          virtual Option_t* GetOption() const
            virtual TClass* IsA() const
          virtual TDataSet* Ls(const Char_t* dirname = "", Option_t* opt = "") const
          virtual TDataSet* Ls(const Char_t* dirname, Int_t depth) const
               virtual void ls(Option_t* dirname = "") const
          virtual TDataSet* ls(TString dirname, Option_t* opt = "") const
          virtual TDataSet* ls(const Char_t* dirname, Int_t depth) const
          virtual TDataSet* Md(const Char_t* dirname)
          virtual TDataSet* Mkdir(const Char_t* dirname)
          virtual TDataSet* Next(TDataSet::EDataSetPass mode = TDataSet::kContinue)
          virtual TDataSet* Next(const Char_t* path, TDataSet* rootset = 0, Bool_t mkdir = kFALSE)
             virtual Bool_t Notify()
               virtual void Notify(TDataSet* dataset)
          virtual TDataSet* operator()(TDataSet::EDataSetPass mode = TDataSet::kContinue)
          virtual TDataSet* operator()(const Char_t* path)
          virtual TDataSet* operator*() const
              TDataSetIter& operator=(const TDataSetIter&)
          virtual TDataSet* operator[](const Char_t* path)
            virtual TString Path(const Char_t* path)
            virtual TString Path()
          virtual TDataSet* Pwd(Option_t* opt = "") const
          virtual TDataSet* Rd(const Char_t* dirname, Option_t* option = "")
               virtual void Reset(TDataSet* l = 0, Int_t depth = 0)
          virtual TDataSet* Rmdir(TDataSet* dataset, Option_t* option = "")
          virtual TDataSet* Rmdir(const Char_t* dirname, Option_t* option = "")
               virtual void ShowMembers(TMemberInspector& insp, char* parent)
          virtual TDataSet* Shunt(TDataSet* set)
          virtual TDataSet* Shunt(TDataSet* set, const Char_t* path)
          virtual TDataSet* Shunt(TDataSet* set, TDataSet* dataset)
               virtual void Streamer(TBuffer& b)
                       void StreamerNVirtual(TBuffer& b)

### Data Members

        protected:

                    TIter* fNext            "standard" ROOT iterator for containers
                    TIter* fNextSet[100]    the list of the TList iterators to bypass the whole dataset
                     Int_t fDepth           the current depth of the passing
                     Int_t fMaxDepth        the max depth of the passing (=1 by default)
                 TDataSet* fDataSet         Pointer to the last selected TDataSet
                 TDataSet* fRootDataSet     Pointer to the root TDataSet
                 TDataSet* fWorkingDataSet  Pointer to the working TDataSet
          static TDataSet* fNullDataSet

## Class Description

     TDataSetIter

     TDataSetIter is a class iterator to navigate TDataSet objects
     via 4 internal pointers :

      1. fRootDataSet    - "root" dataset
      2. fWorkingDataSet - Working dataset
      3. fDataSet        - the last selected TDataSet
      4. fNext           - TIter for the the list of the "root" dataset

TDataSetIter(TDataSet *link, Bool_t dir)

TDataSetIter(TDataSet *link, Int_t depth, Bool_t dir)

~TDataSetIter()

TDataSet* Add(TDataSet *set, TDataSet *dataset)

     Add - adds the set to the dataset defined with the second parameters

     TDataSet dataset != 0 - Add the set to the TDataSet *dataset

                         = 0 - (by default) to the current TDataSet defined
                              with fWorkingDataSet data member

      returns  the pointer to set is success or ZERO poiner
      =======

      Note: If this TDataSetIter is empty (i.e. Cwd() returns 0), the "set"
            becomes the "root" dataset of this iterator                        //

TDataSet* Add(TDataSet *dataset, const Char_t *path)

     Add

     Char_t path != 0 - Add a TDataSet dataset to the TDataSet dataset
                        defined with "path"
                  = 0 - (by default) to the current TDataSet defined
                         with fWorkingDataSet data member

      returns the dataset is success or ZERO pointer
      =======

TDataSet* Cd(const Char_t *dirname)

     TDataSet *TDataSetIter::Cd(const Char_t *dirname)

     Change the current working directory to dirname

     Returns the pointer to the new "working" TDataSet
     =======   0,  if the new directory doesn't exist.

     Remark:  The name = ".." has a special meaning.
     ------   TDataSetIter::Cd("..") returns the parent set
              But one still can not use ".." as a legal part
              of the full path

TDataSet* Cd(TDataSet *ds)

     TDataSet *TDataSetIter::Cd(const TDataSet *ds)

     Make:  Cwd() = ds;
     Look for the first occurence of the "ds" pointer for the current
     TDataSet in respect of the Cwd() if any

     Change the current working directory to ds if present

     Returns the pointer to the new "working" TDataSet (i.e. ds)
     =======   0,  if the new directory doesn't exist.

TDataSet* Dir(Char_t *dirname)

     Print the names of the TDataSet objects for the datatset named with "dirname"
     apart of TDataSet::Ls()  this method prints one level only

Int_t Du() const

     summarize dataset usage by Herb Ward proposal

TDataSet* FindByName(const Char_t *name,const Char_t *path,Option_t *opt)

TDataSet* FindByTitle(const Char_t *title,const Char_t *path,Option_t *opt)

TDataSet* FindDataSet(const Char_t *name,const Char_t *path,Option_t *opt)

     FindDataSet looks for the object with the name supplied across dataset.

     name        - the "base" name title (with no path) of the TDataSet (see: opt = -t)
     path        - path to start the search from (the current dataset "by default")
     opt = "-i"  - case insensitive search
           "-t"  - first <name> parameter defines the object "title" rather the object "name"

     Note: If the name provided is not unique
           the first found is returned.

TDataSet* FindDataSet(TDataSet *set,const Char_t *path,Option_t *opt)

     Check whether the object does belong the TDataSet defined with "path"
     opt = "-l"  - check the "reference" links only
           "-s"  - check the "structural" links only
                 = "by default" - checks all links

TObject* FindObject(const Char_t *name) const

     This method is not recommended.
     It is done to back TObject::FindObject method only.
     One is recommnened to use FindByName method instead.

TObject* FindObject(const TObject *dataset) const

     This method is not recommended.
     It is done to back TObject::FindObject method only.
     One is recommended to use FindByName method instead.

TDataSet* FindByPointer(TDataSet *set,const Char_t *path,Option_t *)

     Check whether the object does belong the TDataSet defined with "path"
     opt = "-l"  - check the "reference" links only
           "-s"  - check the "structural" links only
                 = "by default" - checks all links

Int_t Flag(const Char_t *path,UInt_t flag,TDataSet::EBitOpt reset)

Int_t Flag(TDataSet *dataset,UInt_t flag,TDataSet::EBitOpt reset)

TDataSet* Ls(const Char_t *dirname,Option_t *opt) const

       Ls(const Char_t *dirname,Option_t)

       Prints the list of the TDataSet defined with dirname

       dirname     = 0   - prints the current dataset
       dirname[0]  = '/' - print TDataSet defined with dirname
       dirname[0] != '/' - prints DataSet with respect of the current class

TDataSet* Ls(const Char_t *dirname,Int_t depth) const

       Ls(const Char_t *dirname,Int_t depth)

       Prints the list of the TDataSet defined with dirname
       Returns the dataset defined by "path" or Cwd();

       dirname     = 0   - prints the current dataset
       dirname[0]  = '/' - print TDataSet defined with dirname
       dirname[0] != '/' - prints DataSet with respect of the current class

       depth       = 0   - print all level of the TDataSet defined with dirname
                   > 0   - print depth levels at most of the dirname TDataSet

TDataSet* Mkdir(const Char_t *dirname)

void Notify(TDataSet *)

      Notify(TDataSet *dataset)

      This dummy method is called when TDataSetIter::Find dives in "dataset"
      to look for thew next level of the dataset's
      printf("void TDataSetIter::Notify(TDataSet *) level: %d %s\n",fDepth,ds->GetName());

TDataSet* Rmdir(TDataSet *dataset,Option_t *)

      Remove the TDataSet *dataset from the current dataset
      If the current dataset is the deleted dataset the its parent
      becomes the "current dataset" or 0 if this dataset has no parent.

      returns: the "current dataset" pointer

TDataSet* Next( TDataSet::EDataSetPass mode)

     returns the pointer the "next" TDataSet object
             = 0 if all objects have been returned.

      mode = kContinue  - default normal mode
             kPrune     - stop passing of the current branch but continue with the next one if any
             kUp        - break passing, return to the previous level, then continue
             all other  - are treated as "kContinue"

TDataSet* NextDataSet(TIter &next)

TDataSet* NextDataSet(Int_t nDataSet)

     Pick the next object of the  level provided

TDataSet* FindByPath(const Char_t *path, TDataSet *rootset,Bool_t mkdir)

TDataSet* Find(const Char_t *path, TDataSet *rootset, Bool_t mkdirflag,Bool_t titleFlag)

         titleFlag = kFALSE; use object name as key (by default)
                     kTRUE;  use object title as key  and ignore mkdirFlag

               "path" ::= <relative path> | <absolute path> | <empty>

      "relative path" ::= <dataset name> | <dataset name>/<dataset name>

      "absolute path" ::= /<relative path>
      "empty"         ::= zero pointer | pointer to zero length string

     "relative path": the search is done against of fWorkingDataSet data mem
     "absolute path": the search is done against of fRootDataSet    data mem
     "empty path"   : no search is done just next TDataSet is returned if any

      Remark: This version can not treat any "special name" like "..", ".", etc
      ------

void Reset(TDataSet *l, int depth)

     TDataSet *l != 0 means the new start pointer
        depth      != 0 means the new value for the depth
                        otherwise the privious one is used;

TDataSet* Shunt(TDataSet *set, TDataSet *dataset)

     Shunt - moves the set to the dataset defined with the second parameters

     TDataSet dataset != 0 - Add the set to the TDataSet *dataset

                         = 0 - (by default) to the current TDataSet defined
                              with fWorkingDataSet data member

      returns  the pointer to set if successful or ZERO pointer
      =======

      Note: If this TDataSetIter is empty (i.e. Cwd() returns 0), the "set"
            becomes the "root" dataset of this iterator                        //

TDataSet* Shunt(TDataSet *dataset, const Char_t *path)

     Shunt

     Char_t path != 0 - Move a TDataSet dataset from its parent to
                        the TDataSet dataset
                        defined with "path"
                  = 0 - (by default) to the current TDataSet defined
                        with fWorkingDataSet data member

      returns the dataset is success or ZERO pointer
      =======

### Inline Functions

                TDataSet* GetNullSet()
                TDataSet* Add(TDataSet* set, TDataSet* dataset)
                TDataSet* operator()(TDataSet::EDataSetPass mode = TDataSet::kContinue)
                TDataSet* operator()(const Char_t* path)
                TDataSet* operator[](const Char_t* path)
                    Int_t GetDepth() const
                TDataSet* Cwd() const
                    Int_t Df() const
                    Int_t Flag(TDataSet* dataset, UInt_t flag = TDataSet::kMark, TDataSet::EBitOpt reset = TDataSet::kSet)
                     void ls(Option_t* dirname = "") const
                TDataSet* ls(TString dirname, Option_t* opt = "") const
                TDataSet* ls(const Char_t* dirname, Int_t depth) const
                TDataSet* Md(const Char_t* dirname)
                  TString Path(const Char_t* path)
                  TString Path()
                TDataSet* Pwd(Option_t* opt = "") const
                TDataSet* Rmdir(const Char_t* dirname, Option_t* option = "")
                TDataSet* Rd(const Char_t* dirname, Option_t* option = "")
                TDataSet* Shunt(TDataSet* set, TDataSet* dataset)
                TDataSet* Next(const Char_t* path, TDataSet* rootset = 0, Bool_t mkdir = kFALSE)
                     void Notify(TDataSet* dataset)
                Option_t* GetOption() const
                TDataSet* operator*() const
                  TClass* Class()
                  TClass* IsA() const
                     void ShowMembers(TMemberInspector& insp, char* parent)
                     void Streamer(TBuffer& b)
                     void StreamerNVirtual(TBuffer& b)
             TDataSetIter TDataSetIter(const TDataSetIter&)
            TDataSetIter& operator=(const TDataSetIter&)

Author: Valery Fine(fine@mail.cern.ch) 03/07/98
Last update: root/star:$Name: $:$Id: TDataSetIter.cxx,v 1.3 2003/01/27 20:41:36 brun Exp $