//*-- Author : Valeriy Onuchin 11/09/2000 
//
//
////////////////////////////////////////////////////////////////////////////////
//
// rooBaseClassPlusInheritedItr corresponds to base_class_plus_inherited_iterator Class
//
// The class rooBaseClassPlusInheritedItr represents iterators for
// ancestor classes of a class. An instance of this class is called a 
// base-class iterator.
//
//______________________________________________________________________________
//
//          About Base_Class Iterators
//
// A base-class iterator steps through embedded-class attributes corresponding 
// to all ancestor classes of a particular class. That collection of attributes
// is called theiterator's iteration set; during iteration, the base-class 
//iterator keeps track of its position within its iteration set. The element at
// the current position is called the iterator's current element. The base-class
// iterator allows you to step through the iteration set, obtaining a descriptor
// for the current element at each step.
//
//______________________________________________________________________________
//
//          Obtaining a Base_Class Iterator
//
// You should not instantiate this class directly. Instead, you call the
// base_classes_plus_inherited_begin() member function of a class descriptor
// to get a base-class iterator for all ancestor classes of the described class.
// You can test for that iterator's termination condition by comparing it with 
// the base-class iterator returned by the same class descriptor's
// base_classes_plus_inherited_end member function.
//
//______________________________________________________________________________
//
//          Including Internal Base Classes
//
// By default, a base-class iterator treats the Objectivity/C++ application 
// classes ooObj, ooContObj, ooDBObj, and ooFDObj as if they were root base 
// classes, inheriting from no other classes. Any ancestor classes of those 
// application classes are considered internal; as a consequence, the iteration
// set does not include the internal attribute classes.
//
// If desired, you can override this default behavior, allowing access to 
// ancestor classes at all levels. To do so, you call the 
// rooClass::enable_root_descent static member function.

#include "rooObjy.h"
#include <ooas.h>
#include <oo.h>

ClassImp(rooBaseClassPlusInheritedItr)

////////////////////////////////////////////////////////////////////////////////
//______________________________________________________________________________
 rooBaseClassPlusInheritedItr::rooBaseClassPlusInheritedItr()  
{
   //default ctor., for internal use only
                                      
   fImp = new base_class_plus_inherited_iterator();
   fObj = new rooClass();     
}                                               

//______________________________________________________________________________
rooBaseClassPlusInheritedItr::
rooBaseClassPlusInheritedItr(const rooBaseClassPlusInheritedItr& in)
{
   // copy constructor 
   //
   // You should not copy a base-class iterator; the behavior of a copied
   // iterator is undefined.
                                      
   fImp = new base_class_plus_inherited_iterator(
         *((base_class_plus_inherited_iterator*)in.getImp()));
   fObj = new rooClass();     
}                                               

//______________________________________________________________________________
 rooBaseClassPlusInheritedItr::~rooBaseClassPlusInheritedItr()                               
{
   // destructor, for internal use only
                                                             
   fImp = 0;                                    
}                                               

//______________________________________________________________________________
rooBaseClassPlusInheritedItr & 
rooBaseClassPlusInheritedItr::operator=(const rooBaseClassPlusInheritedItr & in)   
{ 
   // Assignment operator; sets this base-class iterator to be a copy 
   // of the specified base-class iterator.
                                              
   *((base_class_plus_inherited_iterator*)fImp) = *((base_class_plus_inherited_iterator*)in.getImp());                         
   return *this;                                
}                                               

//______________________________________________________________________________
Bool_t rooBaseClassPlusInheritedItr::operator==(const rooBaseClassPlusInheritedItr & in) const 
{
   // Returns kTRUE if the two base-class iterators are equal and
   // kFALSE if they are different.
                                                  
   return *((const base_class_plus_inherited_iterator*)fImp) == 
         *((const base_class_plus_inherited_iterator*)in.getImp());                     
}                                                 

//______________________________________________________________________________
Bool_t rooBaseClassPlusInheritedItr::operator!=(const rooBaseClassPlusInheritedItr & in) const 
{
   // Tests whether this base-class iterator is different
   // from the specified base-class iterator.
                                              
   return *((const base_class_plus_inherited_iterator*)fImp) != 
         *((const base_class_plus_inherited_iterator*)in.getImp());                     
}

//______________________________________________________________________________                                                   
rooBaseClassPlusInheritedItr & rooBaseClassPlusInheritedItr::operator++()                      
{
   // Increment operator; advances this base-class iterator's 
   // current position. Prefix operator.
   //  
   // If the current position is already after the last attribute in the 
   // iteration set, both variants do nothing.
   
   ++(*((base_class_plus_inherited_iterator*)fImp));                                         
   return *this;                                   
}

//______________________________________________________________________________                                                   
rooBaseClassPlusInheritedItr & rooBaseClassPlusInheritedItr::operator++(int)                      
{
   // Increment operator; advances this base-class iterator's current 
   // position. Postfix operator.
   //
   // Parameter is not used in calling this operator; its presence in the 
   // function declaration specifies a postfix operator.
   //  
   // If the current position is already after the last attribute in the 
   // iteration set, both variants do nothing.

   (*((base_class_plus_inherited_iterator*)fImp))++;  
   return *this;  
}

//______________________________________________________________________________
const rooClass& rooBaseClassPlusInheritedItr::operator*()
{
   // Dereference operator; gets this base-class iterator's current element.
   //
   // You should ensure that iteration has not terminated before calling this 
   // member function. The return value is undefined if the current position 
   // is after the last attribute in the iteration set.
   
   d_Class& cl = *(*((base_class_plus_inherited_iterator*)fImp));                                              
   fObj->setImp((void*)&cl);                   
   return *fObj;                                   
}

//______________________________________________________________________________                                                   
 rooClass* rooBaseClassPlusInheritedItr::elementP()                            
{
   // Returns the pointer to current element for this base-class iterator
                                             
   d_Class& cl = *(*((base_class_plus_inherited_iterator*)fImp));                                              
   fObj->setImp((void*)&cl);                   
   return fObj;             
}


ROOT page - Class index - Top of the page

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.