NavItr Class Reference

#include <NavItr.h>

Inheritance diagram for NavItr:
NavItrT< T >

List of all members.

Public Types

enum  ESide { kLeft = Nav::kLeft, kRight = Nav::kRight }
typedef NavKey(* KeyFunc )(void *)
typedef Bool_t(* SelFunc )(void *)

Public Member Functions

virtual ~NavItr ()
Int_t GetIndex () const
NavKey GetNavKey () const
NavSetGetSet () const
void GetZone (Int_t &lo, Int_t &hi) const
Bool_t IsValid () const
Bool_t IsValid (Int_t index) const
void NotReady (const char *mem) const
void * operator* () const
void * Ptr (Bool_t warnIfNull=kFALSE) const
UInt_t Size () const
UInt_t SizeSelect () const
Bool_t Decrement ()
Bool_t Increment ()
Bool_t Jump (Int_t index)
void * Map (const void *far)
Bool_t Next ()
Bool_t NextKey ()
NavItroperator= (const NavItr &from)
Bool_t Prev ()
Bool_t PrevKey ()
void Reset ()
void ResetFirst ()
void ResetLast ()
void ResetSet ()
 .....................................................................
void SetDirection (Int_t dir)
Bool_t SetIndex (Int_t index)
Bool_t SetIndex (void *obj)
void * Step (Int_t dir=0)

Protected Member Functions

 NavItr ()
 NavItr (const NavItr &from, Bool_t subSlice=kFALSE)
 NavItr (const Text_t *classname, Int_t offset=0)
 NavItr (const TCollection *source, const Text_t *classname, Int_t offset=0)
 NavItr (const TIter *sourceItr, const Text_t *classname, Int_t offset=0)
 NavItr (const Text_t *classname, const Text_t *farclass, Int_t rship=0)
 NavItr (const Lattice *source, const Text_t *classname, ESide side)
void Attach (const TCollection *source, const Text_t *classname, Int_t offset=0)
NavItrCopy (const NavItr &from)
void SubSlice (const NavItr &parent)

Private Member Functions

void GetZone () const
void Connect ()
void Disconnect ()
void Init (NavSet *set=0)

Private Attributes

Short_t fDefaultStep
Int_t fIndex
Int_t fLimLo
Int_t fLimHi
Short_t fRank
NavSetfSet
Int_t fZoneLo
Int_t fZoneHi

Friends

class NavValidate

Detailed Description

Definition at line 24 of file NavItr.h.


Member Typedef Documentation

typedef NavKey(* NavItr::KeyFunc)(void *)

Definition at line 31 of file NavItr.h.

typedef Bool_t(* NavItr::SelFunc)(void *)

Definition at line 32 of file NavItr.h.


Member Enumeration Documentation

Enumerator:
kLeft 
kRight 

Definition at line 33 of file NavItr.h.

00033            { kLeft  = Nav::kLeft,
00034              kRight = Nav::kRight
00035 };


Constructor & Destructor Documentation

NavItr::~NavItr (  )  [virtual]

Definition at line 693 of file NavItr.cxx.

References Disconnect(), and LEA_DTOR.

00693                 {
00694 //
00695 //
00696 //  Purpose:  Destructor.
00697 //
00698 //  Arguments: 
00699 //    None.
00700 //
00701 //  Return:   n/a
00702 //
00703 //  Contact:   N. West
00704 //
00705 //  Specification:-
00706 //  =============
00707 //
00708 //  o Destructor.
00709 
00710 //  Program Notes:-
00711 //  =============
00712 
00713 //  None.
00714 
00715   LEA_DTOR  //Leak Checker
00716 
00717     Disconnect();
00718 
00719 }

NavItr::NavItr (  )  [protected]

Definition at line 454 of file NavItr.cxx.

References Init(), and LEA_CTOR.

00454                {
00455 //
00456 //
00457 //  Purpose:  Default constructor.
00458 //
00459 //  Arguments: 
00460 //    None.
00461 //
00462 //  Return:   n/a
00463 //
00464 //  Contact:   N. West
00465 //
00466 //  Specification:-
00467 //  =============
00468 //
00469 //  o Default constructor.
00470 
00471 //  Program Notes:-
00472 //  =============
00473 
00474 //  None.
00475 
00476   LEA_CTOR  //Leak Checker
00477 
00478   Init();
00479 
00480 }

NavItr::NavItr ( const NavItr from,
Bool_t  subSlice = kFALSE 
) [protected]

Definition at line 483 of file NavItr.cxx.

References Copy(), Init(), LEA_CTOR, and SubSlice().

00483                                                   {
00484 //
00485 //
00486 //  Purpose:  Copy or sub-slice constructor.
00487 //
00488 //  Arguments: 
00489 //    from      in    Iterator to be copied from
00490 //    subSlice  in    = kFALSE (default) to make copy
00491 //                    = kTRUE to form a subslice
00492 //
00493 //  Return:   n/a
00494 //
00495 //  Contact:   N. West
00496 //
00497 //  Specification:-
00498 //  =============
00499 //
00500 //  o Copy or sub-slice constructor.
00501 
00502 //  Program Notes:-
00503 //  =============
00504 
00505 //  None.
00506 
00507   LEA_CTOR  //Leak Checker
00508 
00509   Init();
00510   if ( subSlice) SubSlice(from);
00511   else           Copy(from);
00512 
00513 }

NavItr::NavItr ( const Text_t *  classname,
Int_t  offset = 0 
) [protected]

Definition at line 414 of file NavItr.cxx.

References Connect(), fSet, Init(), NavPrimer::Instance(), and LEA_CTOR.

00414                                                     {
00415 //
00416 //
00417 //  Purpose:  Construct iterator over TCollection.
00418 //
00419 //  Arguments: 
00420 //    classname    in    Name of class associated with NavItr.
00421 //    offset       in    Pointer offset: Object adr - TObject adr
00422 //
00423 //  Return:   n/a
00424 //
00425 //  Contact:   N. West
00426 //
00427 //  Specification:-
00428 //  =============
00429 //
00430 //  o Ask NavPrimer for the default TCollection for this type of
00431 //    object.
00432 //
00433 //  o Create new NavSet derived from a TCollection and attach it.
00434 
00435 //  Program Notes:-
00436 //  =============
00437 
00438 //  None.
00439 
00440   LEA_CTOR  //Leak Checker
00441 
00442   Init();
00443 
00444   const TCollection* source = NavPrimer::Instance()->
00445                               FindTCollection(classname);
00446   if ( source ) {
00447     fSet = new NavSet(source, classname, offset);
00448     Connect();
00449   }
00450 
00451 }

NavItr::NavItr ( const TCollection *  source,
const Text_t *  classname,
Int_t  offset = 0 
) [protected]

Definition at line 557 of file NavItr.cxx.

References Attach(), fSet, and LEA_CTOR.

00559                              {
00560 //
00561 //
00562 //  Purpose:  Construct iterator over TCollection.
00563 //
00564 //  Arguments: 
00565 //    source       in    source set for iterator.
00566 //    classname    in    Name of class associated with NavItr.
00567 //    offset       in    Pointer offset: Object adr - TObject adr
00568 //
00569 //  Return:    n/a
00570 //
00571 //  Contact:   N. West
00572 //
00573 //  Specification:-
00574 //  =============
00575 //
00576 //  o Create new NavSet derived from a TCollection and attach it.
00577 
00578 
00579 //  Program Notes:-
00580 //  =============
00581 
00582 //  None.
00583 
00584   LEA_CTOR  //Leak Checker
00585 
00586 // Clear fSet (Attach only assumes this data member is defined)
00587   fSet = 0;
00588 
00589   Attach(source,classname,offset);
00590 
00591 }

NavItr::NavItr ( const TIter *  sourceItr,
const Text_t *  classname,
Int_t  offset = 0 
) [protected]

Definition at line 516 of file NavItr.cxx.

References Connect(), fSet, Init(), and LEA_CTOR.

00518                              {
00519 //
00520 //
00521 //  Purpose:  Construct iterator over TCollection.
00522 //
00523 //  Arguments: 
00524 //    sourceItr    in    source set TIter for iterator.
00525 //    classname    in    Name of class associated with NavItr.
00526 //    offset       in    Pointer offset: Object adr - TObject adr
00527 //
00528 //  Return:    n/a
00529 //
00530 //  Contact:   N. West
00531 //
00532 //  Specification:-
00533 //  =============
00534 //
00535 //  o Create new NavSet derived from a TCollection and attach it.
00536 
00537 
00538 //  Program Notes:-
00539 //  =============
00540 
00541 //  None.
00542 
00543   LEA_CTOR  //Leak Checker
00544 
00545   Init();
00546 
00547 //    NavSet will check that the supplied TCollection really does 
00548 //    exist and contains the correct class.
00549 
00550   const TCollection* source = sourceItr->GetCollection();
00551   fSet = new NavSet(source, classname, offset);
00552   Connect();
00553 
00554 }

NavItr::NavItr ( const Text_t *  classname,
const Text_t *  farclass,
Int_t  rship = 0 
) [protected]

Definition at line 595 of file NavItr.cxx.

References Connect(), NavPrimer::FindLattice(), fSet, Init(), NavPrimer::Instance(), NavSet::kLeft, NavSet::kRight, Msg::kWarning, LEA_CTOR, and MSG.

00597                             {
00598 //
00599 //
00600 //  Purpose:  Construct iterator over Lattice.
00601 //
00602 //  Arguments: 
00603 //    classname    in    Name of class associated with NavItr.
00604 //    farclass     in    Name of class on far side of Lattice.
00605 //    rship        in    Relationship number or 0.
00606 //
00607 //  Return:   
00608 //
00609 //  Contact:   N. West
00610 //
00611 //  Specification:-
00612 //  =============
00613 //
00614 //  o Ask NavPrimer for the default Lattice for this type of object
00615 //    in specified relationship with farclass objects.
00616 //
00617 //  o Create new NavSet derived from one side of a Lattice and attach it.
00618 
00619 //  Program Notes:-
00620 //  =============
00621 
00622 //  None.
00623 
00624   LEA_CTOR  //Leak Checker
00625 
00626   Init();
00627 
00628   NavPrimer* primer = NavPrimer::Instance();
00629 
00630   NavSet::ESide side = NavSet::kLeft;
00631   const Lattice* source = primer
00632                           ->FindLattice(classname, farclass, rship);
00633 
00634 // If cannot find Lattice with class on left, try on right.
00635 
00636   if ( ! source ) {
00637     side = NavSet::kRight;
00638     source = primer->FindLattice(farclass, classname, rship);
00639   }
00640 
00641   if ( source ) {
00642     fSet = new NavSet(source, (NavSet::ESide) side);
00643     Connect();
00644   }
00645   else {
00646     MSG("Nav", Msg::kWarning) << "Cannot find Lattice for" 
00647        << classname << ":" << farclass << endl;
00648   }
00649 
00650 }

NavItr::NavItr ( const Lattice source,
const Text_t *  classname,
ESide  side 
) [protected]

Definition at line 653 of file NavItr.cxx.

References Connect(), fSet, Init(), Msg::kVerbose, LEA_CTOR, and MSG.

00655                           {
00656 //
00657 //
00658 //  Purpose:  Construct iterator over Lattice.
00659 //
00660 //  Arguments: 
00661 //    source       in    Source relationship set
00662 //    classname    in    Name of class associated with NavItr.
00663 //    side         in    Side of reltionship (either kLeft or kRight).
00664 //
00665 //  Return:    n/a
00666 //
00667 //  Contact:   N. West
00668 //
00669 //  Specification:-
00670 //  =============
00671 //
00672 //  o Create new NavSet derived from one side of a Lattice and attach it.
00673 
00674 
00675 //  Program Notes:-
00676 //  =============
00677 
00678 //  None.
00679 
00680   LEA_CTOR  //Leak Checker
00681 
00682   MSG("Nav", Msg::kVerbose) << "Creating iterator over Lattice for" 
00683                             << classname << endl;
00684 
00685   Init();
00686 
00687   fSet = new NavSet(source, (NavSet::ESide) side);
00688   Connect();
00689 
00690 }


Member Function Documentation

void NavItr::Attach ( const TCollection *  source,
const Text_t *  classname,
Int_t  offset = 0 
) [protected]

Definition at line 45 of file NavItr.cxx.

Referenced by NavItr().

00047                                   {
00048 //
00049 //
00050 //  Purpose:  Attach iterator to TCollection.
00051 //
00052 //  Arguments: 
00053 //    source       in    source set for iterator.
00054 //    classname    in    Name of class associated with NavItr.
00055 //    offset       in    Pointer offset: Object adr - TObject adr
00056 //
00057 //  Return:    n/a
00058 //
00059 //  Contact:   N. West
00060 //
00061 //  Specification:-
00062 //  =============
00063 //
00064 //  o Disconnect any existing collection.
00065 //
00066 //  o Create new NavSet derived from a TCollection and attach it.
00067 
00068 
00069 //  Program Notes:-
00070 //  =============
00071 
00072 //  Can be called from ctor so long as fSet has been set to zero.
00073 
00074   Disconnect();
00075   Init();
00076 
00077 //    NavSet will check that the supplied TCollection really does 
00078 //    exist and contains the correct class.
00079 
00080   fSet = new NavSet(source, classname, offset);
00081   Connect();
00082 
00083 }

void NavItr::Connect (  )  [private]

Definition at line 87 of file NavItr.cxx.

References NavSet::Attach(), fSet, and Init().

Referenced by Copy(), NavItr(), and SubSlice().

00087                      {
00088 //
00089 //
00090 //  Purpose:  Connect to current NavSet (if any)
00091 //
00092 //  Arguments: n/a
00093 //
00094 //  Return:    n/a
00095 //
00096 //  Contact:   N. West
00097 //
00098 //  Specification:-
00099 //  =============
00100 //
00101 //  o If current NavSet exists connect to it.
00102 //
00103 //  o Set up as a rank 0 iterator.
00104 
00105 
00106 //  Program Notes:-
00107 //  =============
00108 
00109 // None.
00110 
00111   if ( fSet ) fSet->Attach(this);
00112   Init(fSet);
00113 
00114 }

NavItr & NavItr::Copy ( const NavItr from  )  [protected]

Definition at line 117 of file NavItr.cxx.

References Connect(), Disconnect(), fDefaultStep, fIndex, fLimHi, fLimLo, fRank, fSet, fZoneHi, and fZoneLo.

Referenced by NavItr(), NavItrT< T >::operator=(), and operator=().

00117                                        {
00118 //
00119 //
00120 //  Purpose:  Replace current state with from object.
00121 //
00122 //  Arguments: 
00123 //    from         in    Object whose state is to be copied.
00124 //
00125 //  Return:    
00126 //
00127 //  Contact:   N. West
00128 //
00129 //  Specification:-
00130 //  =============
00131 //
00132 //  o Detach object from current NavSet (if any).
00133 //
00134 //  o Copy state from input object and reconnect to new NavSet.
00135 
00136 //  Program Notes:-
00137 //  =============
00138 
00139 //  None.
00140 
00141   Disconnect();
00142   fSet         = from.fSet;
00143   Connect();
00144   fDefaultStep = from.fDefaultStep;
00145   fIndex       = from.fIndex;
00146   fLimLo       = from.fLimLo;
00147   fLimHi       = from.fLimHi;
00148   fRank        = from.fRank;
00149   fZoneLo      = from.fZoneLo;
00150   fZoneHi      = from.fZoneHi;
00151 
00152   return *this;
00153 
00154 }

Bool_t NavItr::Decrement (  ) 

Definition at line 158 of file NavItr.cxx.

References fIndex, and IsValid().

Referenced by NavItrT< T >::operator--(), Prev(), NavItrT< T >::PrevPtr(), and Step().

00158                           {
00159 //
00160 //
00161 //  Purpose:  Decrement pointer skipping unwanted objects.
00162 //
00163 //  Arguments: None.
00164 //
00165 //  Return: kTRUE if pointer is positioned on a valid object.  
00166 //
00167 //  Contact:   N. West
00168 //
00169 //  Specification:-
00170 //  =============
00171 //
00172 //  o  Decrement pointer skipping unwanted objects.
00173 
00174 //  Program Notes:-
00175 //  =============
00176 
00177 //  None.
00178 
00179    fIndex--;
00180    return IsValid();
00181 
00182 }

void NavItr::Disconnect (  )  [private]

Definition at line 185 of file NavItr.cxx.

References NavSet::Detach(), fSet, and Init().

Referenced by Copy(), SubSlice(), and ~NavItr().

00185                         {
00186 //
00187 //
00188 //  Purpose:  Disconnect from current NavSet (if any)
00189 //
00190 //  Arguments: n/a
00191 //
00192 //  Return:    n/a
00193 //
00194 //  Contact:   N. West
00195 //
00196 //  Specification:-
00197 //  =============
00198 //
00199 //  o If connected to a NavSet, and disconnecting leave it ownerless
00200 //    then delete it.
00201 
00202 
00203 //  Program Notes:-
00204 //  =============
00205 
00206 //  A single NavSet can be shared by any number of NavItrs, hence
00207 //  this reference counting logic.
00208 
00209   if ( fSet && ! fSet->Detach(this) ) delete fSet;
00210   Init();
00211  
00212 }

Int_t NavItr::GetIndex (  )  const [inline]

Definition at line 41 of file NavItr.h.

References fIndex.

00041 { return fIndex; }

NavKey NavItr::GetNavKey (  )  const

Definition at line 216 of file NavItr.cxx.

References fIndex, fRank, fSet, NavSet::GetNavKey(), and IsValid().

00216                                {
00217 //
00218 //
00219 //  Purpose:  Return associated NavKey.
00220 //
00221 //  Arguments: None.
00222 //
00223 //  Return:  Return associated NavKey or NavKey(0) if none. 
00224 //
00225 //  Contact:   N. West
00226 //
00227 //  Specification:-
00228 //  =============
00229 //
00230 //  o Return associated NavKey or NavKey(0) if none. 
00231 
00232 //  Program Notes:-
00233 //  =============
00234 
00235 //  None.
00236 
00237   return ( fSet && IsValid() ) ? fSet->GetNavKey(fIndex,fRank) : 0;
00238 
00239 }

NavSet* NavItr::GetSet (  )  const [inline]

Definition at line 43 of file NavItr.h.

References fSet.

00043 { return fSet; }

void NavItr::GetZone (  )  const [private]

Definition at line 243 of file NavItr.cxx.

References fIndex, fLimHi, fLimLo, fRank, fSet, fZoneHi, fZoneLo, and NavSet::GetZone().

Referenced by GetZone(), NextKey(), and PrevKey().

00243                            {
00244 //
00245 //
00246 //  Purpose:  Get zone limits into fZoneLo, fZoneHi cache.
00247 //
00248 //  Arguments: none.
00249 //
00250 //  Return:   n/a
00251 //
00252 //  Contact:   N. West
00253 //
00254 //  Specification:-
00255 //  =============
00256 //
00257 //  o Get zone limits into fZoneLo, fZoneHi cache.
00258 
00259 //  Program Notes:-
00260 //  =============
00261 
00262 //  The zone limits is the range of indeces containing the current
00263 //  index and bounded by (fLimLo,fLimHi) within which the associated
00264 //  NavKey has a single value.  Finding zone limits is an expensive
00265 //  operation so they are cached in fZoneLo, fZoneHi and reused if
00266 //  possible.  Consequently these members are not really true state
00267 //  but just an optimisation so this const member function is allowed
00268 //  to modify them.
00269 
00270   if (    fZoneLo <= fIndex
00271        && fZoneHi >= fIndex ) return;
00272 
00273   Int_t lo = fLimLo;
00274   Int_t hi = fLimHi;
00275   if ( fSet ) fSet->GetZone(fLimLo,fLimHi,fIndex,fRank,lo,hi);
00276   
00277 // Allow write access (see Program Notes).
00278   NavItr* itr = const_cast<NavItr*>(this);
00279   itr->fZoneLo = lo;
00280   itr->fZoneHi = hi;
00281 
00282 }

void NavItr::GetZone ( Int_t &  lo,
Int_t &  hi 
) const [inline]

Definition at line 44 of file NavItr.h.

References fZoneHi, fZoneLo, and GetZone().

Referenced by SubSlice().

00044                                                       {
00045                                 GetZone(); lo = fZoneLo; hi = fZoneHi; }

Bool_t NavItr::Increment (  ) 

Definition at line 286 of file NavItr.cxx.

References fIndex, and IsValid().

Referenced by Next(), NavItrT< T >::NextPtr(), NavItrT< T >::operator++(), and Step().

00286                           {
00287 //
00288 //
00289 //  Purpose:  Increment pointer skipping unwanted objects.
00290 //
00291 //  Arguments: None.
00292 //
00293 //  Return: kTRUE if pointer is positioned on a valid object.  
00294 //
00295 //  Contact:   N. West
00296 //
00297 //  Specification:-
00298 //  =============
00299 //
00300 //  o  Increment pointer skipping unwanted objects.
00301 
00302 //  Program Notes:-
00303 //  =============
00304 
00305 //  None.
00306 
00307    fIndex++;
00308    return IsValid();
00309 
00310 }

void NavItr::Init ( NavSet set = 0  )  [private]

Definition at line 313 of file NavItr.cxx.

References fDefaultStep, fIndex, fLimHi, fLimLo, fRank, fSet, fZoneHi, fZoneLo, and NavSet::GetMaxIndex().

Referenced by Connect(), Disconnect(), NavItr(), and ResetSet().

00313                              {
00314 //
00315 //
00316 //  Purpose:  Initialise an empty object.
00317 //
00318 //  Arguments: 
00319 //      set      in    Associated NavSet (if any).
00320 //
00321 //  Return:    n/a
00322 //
00323 //  Contact:   N. West
00324 //
00325 //  Specification:-
00326 //  =============
00327 //
00328 //  o Initialise an empty object.
00329 
00330 //  Program Notes:-
00331 //  =============
00332 
00333 //  None.
00334 
00335   fIndex       = 0;
00336   fLimLo       = 0;
00337   if ( set ) fLimHi = fSet->GetMaxIndex();
00338   else       fLimHi = -1;
00339   fSet         = set;
00340   fRank        = 0;
00341   fZoneLo      = 0;
00342   fZoneHi      = -1;
00343   fDefaultStep = 1;
00344 }

Bool_t NavItr::IsValid ( Int_t  index  )  const

Definition at line 348 of file NavItr.cxx.

References fLimHi, and fLimLo.

00348                                        {
00349 
00350 
00351 //  Purpose:  Check if index is valid (i.e. within selected range).
00352 //
00353 //  Arguments: 
00354 //    index        in    Index to be checked.
00355 //
00356 //  Return:    
00357 //
00358 //  Contact:   N. West
00359 //
00360 //  Specification:-
00361 //  =============
00362 //
00363 //  o Check if index is valid.
00364 
00365 //  Program Notes:-
00366 //  =============
00367 
00368 //  None.
00369 
00370   return index >= fLimLo && index <= fLimHi;
00371 
00372 }

Bool_t NavItr::IsValid (  )  const [inline]

Definition at line 46 of file NavItr.h.

References fIndex, and IsValid().

Referenced by Decrement(), GetNavKey(), Increment(), IsValid(), Next(), NextKey(), operator*(), Prev(), PrevKey(), Ptr(), SetIndex(), and Step().

00046 { return IsValid(fIndex); }

Bool_t NavItr::Jump ( Int_t  index  )  [inline]

Definition at line 57 of file NavItr.h.

References SetIndex().

Referenced by NavItrT< T >::JumpPtr().

00057 { return SetIndex(index); }

void * NavItr::Map ( const void *  far  ) 

Reimplemented in NavItrT< T >.

Definition at line 376 of file NavItr.cxx.

References fSet, NavSet::Map(), and Ptr().

00376                                  {
00377 
00378 
00379 //  Purpose:  Select objects associated with supplied object
00380 //            on far side of Lattice.
00381 //
00382 //  Arguments: 
00383 //    far          in    Far side object.
00384 //
00385 //  Return:   First object in the set or = 0 if none. 
00386 //
00387 //  Contact:   N. West
00388 //
00389 //  Specification:-
00390 //  =============
00391 //
00392 //  o Select the objects associated with the Lattice far object and 
00393 //    return the first of them.
00394 
00395 //  Program Notes:-
00396 //  =============
00397 
00398 //  CAUTION: This member function directly effects the associated
00399 //           NavSet and causes all its iterators to reposition at 
00400 //           start of their range.  This would be more apparent if
00401 //           the user did the longer equivalent:-
00402 //
00403 //           XxxItr* myItr;
00404 //           myItr->GetSet()->Map(far);
00405 //           Xxx* myObj = myItrPtr();
00406 
00407   fSet->Map(far);
00408   return Ptr();
00409 
00410 }

Bool_t NavItr::Next (  )  [inline]

Definition at line 59 of file NavItr.h.

References Increment(), and IsValid().

00059 { Increment(); return IsValid(); }

Bool_t NavItr::NextKey (  ) 

Definition at line 722 of file NavItr.cxx.

References fIndex, fZoneHi, GetZone(), and IsValid().

00722                         {
00723 //
00724 //
00725 //  Purpose:  Increment pointer skipping unwanted objects until
00726 //            associated NavKey changes value.
00727 //
00728 //  Arguments: None.
00729 //
00730 //  Return: kTRUE if pointer is positioned on a valid object.  
00731 //
00732 //  Contact:   N. West
00733 //
00734 //  Specification:-
00735 //  =============
00736 //
00737 //  o  Increment pointer skipping unwanted objects until
00738 //     associated NavKey changes value.
00739 
00740 //  Program Notes:-
00741 //  =============
00742 
00743 //  None.
00744 
00745   GetZone();
00746   fIndex = fZoneHi+1;
00747   return IsValid();
00748 
00749 }

void NavItr::NotReady ( const char *  mem  )  const

Definition at line 753 of file NavItr.cxx.

References Msg::kError, and MSG.

Referenced by SetIndex().

00753                                            {
00754 //
00755 //
00756 //  Purpose:  Warning for unimplemented member functions.
00757 //
00758 //  Arguments: 
00759 //    mem          in    Member function name.
00760 //
00761 //  Return:    
00762 //
00763 //  Contact:   N. West
00764 //
00765 //  Specification:-
00766 //  =============
00767 //
00768 //  o Display error message giving name of unimplemented member
00769 //    function.
00770 
00771 //  Program Notes:-
00772 //  =============
00773 
00774 //  None.
00775 
00776   MSG("Nav", Msg::kError) << "Sorry, member function NavItr:::" << mem
00777                           << " is not yet ready" << endl;
00778 
00779 }

void * NavItr::operator* (  )  const

Reimplemented in NavItrT< T >.

Definition at line 782 of file NavItr.cxx.

References NavSet::At(), fIndex, fSet, and IsValid().

00782                               {
00783 //
00784 //
00785 //  Purpose:  Return object pointer at current index if valid.
00786 //
00787 //  Arguments: None
00788 //
00789 //  Return:    Object pointer, or 0 if current index invalid.
00790 //
00791 //  Contact:   N. West
00792 //
00793 //  Specification:-
00794 //  =============
00795 //
00796 //  o 
00797 
00798 //  Program Notes:-
00799 //  =============
00800 
00801 //  None.
00802 
00803   return ( IsValid() ) ? fSet->At(fIndex) : 0;
00804 
00805 }

NavItr& NavItr::operator= ( const NavItr from  )  [inline]

Reimplemented in NavItrT< T >.

Definition at line 61 of file NavItr.h.

References Copy().

00061 { return Copy(from); }

Bool_t NavItr::Prev (  )  [inline]

Definition at line 62 of file NavItr.h.

References Decrement(), and IsValid().

00062 { Decrement(); return IsValid(); }

Bool_t NavItr::PrevKey (  ) 

Definition at line 808 of file NavItr.cxx.

References fIndex, fZoneLo, GetZone(), and IsValid().

00808                         {
00809 //
00810 //
00811 //  Purpose:  Decrement pointer skipping unwanted objects until
00812 //            associated NavKey changes value.
00813 //
00814 //  Arguments: None.
00815 //
00816 //  Return: kTRUE if pointer is positioned on a valid object.  
00817 //
00818 //  Contact:   N. West
00819 //
00820 //  Specification:-
00821 //  =============
00822 //
00823 //  o  Decrement pointer skipping unwanted objects until
00824 //     associated NavKey changes value.
00825 
00826 //  Program Notes:-
00827 //  =============
00828 
00829 //  None.
00830 
00831   GetZone();
00832   fIndex = fZoneLo-1;
00833   return IsValid();
00834 
00835 }

void * NavItr::Ptr ( Bool_t  warnIfNull = kFALSE  )  const

Definition at line 839 of file NavItr.cxx.

References NavSet::At(), fIndex, fSet, IsValid(), Msg::kError, and MSG.

Referenced by Map(), and Step().

00839                                          {
00840 //
00841 //
00842 //  Purpose:  Return pointer to object at current index.
00843 //
00844 //  Arguments: 
00845 //    warnIfNull   in    = kTRUE to give warning if null.
00846 //
00847 //  Return:    Object pointer, or 0 if current index invalid.
00848 //
00849 //  Contact:   N. West
00850 //
00851 //  Specification:-
00852 //  =============
00853 //
00854 //  o Return pointer to object at current index.  If required issue
00855 //    warning if pointer is null.
00856 
00857 //  Program Notes:-
00858 //  =============
00859 
00860 //  None.
00861 
00862   void* ptr = ( IsValid() ) ? fSet->At(fIndex) : 0;
00863 
00864   if ( ! ptr && warnIfNull )
00865     MSG("Nav", Msg::kError) << "There is no object at index: " 
00866        << fIndex << "! The code will attempt to create an object." 
00867        << endl
00868        << "At the very least this will be a memory leak!" << endl;
00869   return ptr;
00870 
00871 }

void NavItr::Reset (  ) 

Definition at line 874 of file NavItr.cxx.

References fDefaultStep, ResetFirst(), and ResetLast().

00874                    {
00875 //
00876 //
00877 //  Purpose: Set to first valid entry in the default direction. 
00878 //
00879 //  Arguments: None.
00880 //
00881 //  Return:    n/a
00882 //
00883 //  Contact:   N. West
00884 //
00885 //  Specification:-
00886 //  =============
00887 //
00888 //  o Move to first valid entry.
00889 
00890 //  Program Notes:-
00891 //  =============
00892 
00893 //  None.
00894 
00895   if ( fDefaultStep > 0 ) ResetFirst();
00896   else                    ResetLast();
00897  
00898 }

void NavItr::ResetFirst (  ) 

Definition at line 901 of file NavItr.cxx.

References fDefaultStep, fIndex, and fLimLo.

Referenced by Reset().

00901                         {
00902 //
00903 //
00904 //  Purpose: Set to first valid entry and set default direction to 
00905 //           forwards. 
00906 //
00907 //  Arguments: None.
00908 //
00909 //  Return:    n/a
00910 //
00911 //  Contact:   N. West
00912 //
00913 //  Specification:-
00914 //  =============
00915 //
00916 //  o Move to last valid entry or to 0 if none.
00917 
00918 //  Program Notes:-
00919 //  =============
00920 
00921 //  None.
00922 
00923   fIndex = fLimLo;
00924   fDefaultStep = +1;
00925 
00926 }

void NavItr::ResetLast (  ) 

Definition at line 929 of file NavItr.cxx.

References fDefaultStep, fIndex, and fLimHi.

Referenced by Reset().

00929                        {
00930 //
00931 //
00932 //  Purpose: Set to last valid entry and set default direction to 
00933 //           backwards. 
00934 //
00935 //  Arguments: None.
00936 //
00937 //  Return:    n/a
00938 //
00939 //  Contact:   N. West
00940 //
00941 //  Specification:-
00942 //  =============
00943 
00944 //  o Move to last valid entry or to 0 if none.
00945 
00946 //  Program Notes:-
00947 //  =============
00948 
00949 //  None.
00950 
00951   fIndex = fLimHi;
00952   fDefaultStep = -1;
00953 
00954 }

void NavItr::ResetSet (  ) 

.....................................................................

Definition at line 957 of file NavItr.cxx.

References fSet, and Init().

00957                       {
00958 //
00959 //
00960 //  Purpose: Reset after change in underlying set.
00961 //
00962 //  Arguments: None.
00963 //
00964 //  Return:    n/a
00965 //
00966 //  Contact:   N. West
00967 //
00968 //  Specification:-
00969 //  =============
00970 
00971 //  Reset after change in underlying set.
00972 
00973 //  Program Notes:-
00974 //  =============
00975 
00976 //  None.
00977 
00978   Init(fSet);
00979 
00980 }

void NavItr::SetDirection ( Int_t  dir  ) 

Definition at line 983 of file NavItr.cxx.

References fDefaultStep.

00983                                    {
00984 //
00985 //
00986 //  Purpose:  Set default direction.
00987 //
00988 //  Arguments: 
00989 //    dir          in    Direction: > 0 Forwards 
00990 //                                  < 0 Backwards
00991 //                                  = 0 Leave default direction.
00992 //
00993 //  Return:   
00994 //
00995 //  Contact:   N. West
00996 //
00997 //  Specification:-
00998 //  =============
00999 //
01000 //  o Set default direction.
01001 
01002 //  Program Notes:-
01003 //  =============
01004 
01005 //  None.
01006 
01007   if ( dir >  0 ) fDefaultStep =  1;
01008   if ( dir <  0 ) fDefaultStep = -1;
01009 
01010 }

Bool_t NavItr::SetIndex ( void *  obj  )  [inline]

Definition at line 70 of file NavItr.h.

References NotReady().

00070                                     {NotReady("SetIndex"); 
00071                                               return obj == 0;}

Bool_t NavItr::SetIndex ( Int_t  index  ) 

Definition at line 1014 of file NavItr.cxx.

References fIndex, and IsValid().

Referenced by Jump().

01014                                    {
01015 //
01016 //
01017 //  Purpose:  Set index if valid.
01018 //
01019 //  Arguments: 
01020 //    index        in    Required position.
01021 //
01022 //  Return:    kTRUE if index is valid.
01023 //
01024 //  Contact:   N. West
01025 //
01026 //  Specification:-
01027 //  =============
01028 //
01029 //  o If new index valid update iterator, otherwise leave where it is
01030 //    even if this is also invalid.
01031 
01032 
01033 //  Program Notes:-
01034 //  =============
01035 
01036 //  None.
01037 
01038   if ( IsValid(index) ) {
01039     fIndex = index;
01040     return kTRUE;
01041   }
01042 
01043   return kFALSE;
01044 
01045 }

UInt_t NavItr::Size ( void   )  const

Definition at line 1048 of file NavItr.cxx.

References fSet, and NavSet::Size().

Referenced by NavValidate::Test_1().

01048                           {
01049 //
01050 //
01051 //  Purpose:  Return current size of set.
01052 //
01053 //  Arguments: None.
01054 //
01055 //  Return:  Current size of set  
01056 //
01057 //  Contact:   N. West
01058 //
01059 //  Specification:-
01060 //  =============
01061 //
01062 //  o Return current size of set.
01063 
01064 //  Program Notes:-
01065 //  =============
01066 
01067 //  None.
01068 
01069    return ( fSet ) ? fSet->Size() : 0;
01070 
01071 }

UInt_t NavItr::SizeSelect (  )  const

Definition at line 1074 of file NavItr.cxx.

References fSet, and NavSet::SizeSelect().

01074                                 {
01075 //
01076 //
01077 //  Purpose:  Return current size of selected set.
01078 //
01079 //  Arguments: None.
01080 //
01081 //  Return:  Current size of selected set  
01082 //
01083 //  Contact:   N. West
01084 //
01085 //  Specification:-
01086 //  =============
01087 //
01088 //  o Return current size of selected set.
01089 
01090 //  Program Notes:-
01091 //  =============
01092 
01093 //  None.
01094 
01095    return ( fSet ) ? fSet->SizeSelect() : 0;
01096 
01097 }

void * NavItr::Step ( Int_t  dir = 0  ) 

Definition at line 1100 of file NavItr.cxx.

References Decrement(), fDefaultStep, fIndex, Increment(), IsValid(), and Ptr().

Referenced by NavItrT< T >::operator()().

01100                                   {
01101 //
01102 //
01103 //  Purpose:  Step iterator in required direction and return object pointed
01104 //            before the step.
01105 //
01106 //  Arguments: 
01107 //    dir          in    Direction: > 0 Forwards 
01108 //                                  < 0 Backwards
01109 //                                  = 0 Default direction.
01110 //
01111 //  Return:   
01112 //
01113 //  Contact:   N. West
01114 //
01115 //  Specification:-
01116 //  =============
01117 //
01118 //  o Step iterator in required direction and return object pointed
01119 //    before the step.
01120 
01121 //  Program Notes:-
01122 //  =============
01123 
01124 //  Returning the object in the old position allows this access
01125 //  method to be handled consistantly with the Ptr() and
01126 //  Obj() methods.  In all cases Reset() can move to the first valid.
01127 
01128 
01129   void* old = Ptr();
01130 
01131   if ( dir >  0 ) Increment();
01132   if ( dir <  0 ) Decrement();
01133   if ( dir == 0 && IsValid() ) fIndex += fDefaultStep;
01134 
01135   return old;
01136 
01137 }

void NavItr::SubSlice ( const NavItr parent  )  [protected]

Definition at line 1141 of file NavItr.cxx.

References Connect(), Disconnect(), fDefaultStep, fIndex, fLimHi, fLimLo, fRank, fSet, fZoneHi, fZoneLo, and GetZone().

Referenced by NavItr().

01141                                           {
01142 //
01143 //
01144 //  Purpose: Set up iterator over sub-slice of supplied parent iterator.
01145 //
01146 //  Arguments: 
01147 //    parent        in    The parent iterator defining the sub-slice.
01148 //
01149 //  Return:   n/a
01150 //
01151 //  Contact:   N. West
01152 //
01153 //  Specification:-
01154 //  =============
01155 //
01156 //  o Set up iterator to be one rank higher than the supplied parent 
01157 //    and set its range to be the current parent zone.
01158 
01159 //  Program Notes:-
01160 //  =============
01161 
01162 //  By setting the this iterator's range to be the current zone of its 
01163 //  parent  means that this iterator is limits to the range in which 
01164 //  the parent has a constant NavKey value.
01165 
01166   Disconnect();
01167   fSet         = parent.fSet;
01168   Connect();
01169   fDefaultStep = parent.fDefaultStep;
01170   parent.GetZone(fLimLo,fLimHi);
01171   fIndex       = (fDefaultStep > 0 ) ? fLimLo : fLimHi;
01172   fRank        = parent.fRank+1;
01173   fZoneLo      = 0;
01174   fZoneHi      = -1;
01175   
01176 }


Friends And Related Function Documentation

friend class NavValidate [friend]

Definition at line 27 of file NavItr.h.


Member Data Documentation

Short_t NavItr::fDefaultStep [private]

Definition at line 114 of file NavItr.h.

Referenced by Copy(), Init(), Reset(), ResetFirst(), ResetLast(), SetDirection(), Step(), and SubSlice().

Int_t NavItr::fIndex [private]
Int_t NavItr::fLimHi [private]

Definition at line 117 of file NavItr.h.

Referenced by Copy(), GetZone(), Init(), IsValid(), ResetLast(), and SubSlice().

Int_t NavItr::fLimLo [private]

Definition at line 116 of file NavItr.h.

Referenced by Copy(), GetZone(), Init(), IsValid(), ResetFirst(), and SubSlice().

Short_t NavItr::fRank [private]

Definition at line 118 of file NavItr.h.

Referenced by Copy(), GetNavKey(), GetZone(), Init(), and SubSlice().

NavSet* NavItr::fSet [private]
Int_t NavItr::fZoneHi [private]

Definition at line 121 of file NavItr.h.

Referenced by Copy(), GetZone(), Init(), NextKey(), and SubSlice().

Int_t NavItr::fZoneLo [private]

Definition at line 120 of file NavItr.h.

Referenced by Copy(), GetZone(), Init(), PrevKey(), and SubSlice().


The documentation for this class was generated from the following files:

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1