//*-- Author : Valeriy Onuchin 11/09/2000
//
//
////////////////////////////////////////////////////////////////////////////////
//
// rooAttributePlusInheritedItr corresponds to attribute_plus_inherited_iterator class
//
// The class rooAttributePlusInheritedItr represents iterators for
// attributes of a class. An instance of this class is called an
// inherited-attribute iterator.
//
//______________________________________________________________________________
//
// About Inherited-Attribute Iterators
//
// An inherited-attribute iterator steps through all attributes of a particular
// class, including relationships and embedded-class attributes corresponding
// to base classes. It finds all attributes of the class, whether they are
// defined in that class or inherited. That collection of attributes is called
// the iterator's iteration set; during iteration, the inherited-attribute
// iterator keeps track of its position within its iteration set. The element
// at the current position is called the iterator's current element. The
// inherited-attribute iterator allows you to step through the iteration
// set, obtaining a descriptor for the current element at each step.
//
//______________________________________________________________________________
//
// Obtaining an Inherited-Attribute Iterator
//
// You should not instantiate this class directly. Instead, you call the
// attributes_plus_inherited_begin() member function of a class descriptor to
// get an inherited-attribute iterator for all attributes of the described
// class. You can test for that iterator's termination condition by comparing
// it with the inherited-attribute iterator returned by the same class
// descriptor's attributes_plus_inherited_begin() member function.
//
//______________________________________________________________________________
//
// Including Attributes of Internal Base Classes
//
// By default, an inherited-attribute 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 attributes of internal attribute classes.
//
// If desired, you can override this default behavior, allowing access to
// attributes of 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(rooAttributePlusInheritedItr)
////////////////////////////////////////////////////////////////////////////////
//______________________________________________________________________________
rooAttributePlusInheritedItr::rooAttributePlusInheritedItr()
{
//default ctor., internal use only
fImp = new attribute_plus_inherited_iterator();
fObj = new rooAttribute();
}
//______________________________________________________________________________
rooAttributePlusInheritedItr::
rooAttributePlusInheritedItr(const rooAttributePlusInheritedItr& in)
{
// Reserved for internal use.
//
// You should not copy an inherited-attribute iterator; the behavior of a
// copied iterator is undefined.
fImp = new attribute_plus_inherited_iterator(
*((attribute_plus_inherited_iterator*)in.getImp()));
fObj = new rooAttribute();
}
//______________________________________________________________________________
rooAttributePlusInheritedItr::~rooAttributePlusInheritedItr()
{
// destructor, internal use only
fImp = 0;
}
//______________________________________________________________________________
rooAttributePlusInheritedItr &
rooAttributePlusInheritedItr::operator=(const rooAttributePlusInheritedItr & in)
{
// Assignment operator; sets this inherited-attribute iterator to be a copy
// of the specified inherited-attribute iterator.
*((attribute_plus_inherited_iterator*)fImp) = *((attribute_plus_inherited_iterator*)in.getImp());
return *this;
}
//______________________________________________________________________________
Bool_t rooAttributePlusInheritedItr::operator==(const rooAttributePlusInheritedItr & in) const
{
// Returns kTRUE if the two inherited-attribute iterators are equal and
// kFALSE if they are different.
return *((const attribute_plus_inherited_iterator*)fImp)
== *((const attribute_plus_inherited_iterator*)in.getImp());
}
//______________________________________________________________________________
Bool_t rooAttributePlusInheritedItr::operator!=(const rooAttributePlusInheritedItr & in) const
{
// Tests whether this inherited-attribute iterator is different
// from the specified inherited-attribute iterator.
return *((const attribute_plus_inherited_iterator*)fImp) !=
*((const attribute_plus_inherited_iterator*)in.getImp());
}
//______________________________________________________________________________
rooAttributePlusInheritedItr & rooAttributePlusInheritedItr::operator++()
{
// Increment operator; advances this inherited-attribute iterator's
// current position. Prefix operator.
//
// If the current position is already after the last attribute in the
// iteration set, both variants do nothing.
++(*((attribute_plus_inherited_iterator*)fImp));
return *this;
}
//______________________________________________________________________________
rooAttributePlusInheritedItr & rooAttributePlusInheritedItr::operator++(int)
{
// Increment operator; advances this inherited-attribute 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.
(*((attribute_plus_inherited_iterator*)fImp))++;
return *this;
}
//______________________________________________________________________________
const rooAttribute& rooAttributePlusInheritedItr::operator*()
{
// Dereference operator; gets this inherited-attribute 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_Attribute& atr = *(*((attribute_plus_inherited_iterator*)fImp));
fObj->setImp((void*)&atr);
return *fObj;
}
//______________________________________________________________________________
rooAttribute* rooAttributePlusInheritedItr::elementP()
{
// Returns the pointer to current element for this inherited-attribute
// iterator
d_Attribute& atr = *(*((attribute_plus_inherited_iterator*)fImp));
fObj->setImp((void*)&atr);
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.