NavPrimer Class Reference

#include <NavPrimer.h>

List of all members.

Public Member Functions

 NavPrimer ()
virtual ~NavPrimer ()
void AdoptGenerator (NavPrimerGenerator *gen)
void DeleteAdoptedGenerators ()
const LatticeFindLattice (const Char_t *leftClass, const Char_t *rightClass, Int_t rship=0)
const TCollection * FindTCollection (const Char_t *classname)

Static Public Member Functions

static NavPrimerInstance ()

Private Types

typedef NavKey(* KeyFunc )(TObject *)

Private Member Functions

 NavPrimer (const NavPrimer &)
Bool_t IsOutOfDate () const
NavPrimerGeneratorFindGenerator (const Char_t *leftClass, const Char_t *rightClass, Int_t rship)

Private Attributes

std::list< NavPrimerGenerator * > fGens
UInt_t fNumBuiltIn

Static Private Attributes

static NavPrimerfgInstance = 0

Friends

class NavPrimerGenerator

Detailed Description

Definition at line 24 of file NavPrimer.h.


Member Typedef Documentation

typedef NavKey(* NavPrimer::KeyFunc)(TObject *) [private]

Definition at line 53 of file NavPrimer.h.


Constructor & Destructor Documentation

NavPrimer::NavPrimer (  ) 

Definition at line 272 of file NavPrimer.cxx.

References fGens, fNumBuiltIn, and LEA_CTOR.

00272                     {
00273 
00274 
00275 //  Purpose:  Constructor.
00276 
00277 //  Arguments: None.
00278 
00279 //  Return:    
00280 
00281 //  Contact:   N. West
00282 
00283 //  Specification:-
00284 //  =============
00285 
00286 //  o Assemble a set of Lattice building records.
00287 
00288 //  Program Notes:-
00289 //  =============
00290 
00291 //  None.
00292 
00293   LEA_CTOR  //Leak Checking
00294 
00295 
00296   fNumBuiltIn = fGens.size();
00297 
00298 }

NavPrimer::~NavPrimer (  )  [virtual]

Definition at line 301 of file NavPrimer.cxx.

References fGens, and LEA_DTOR.

00301                        {
00302 
00303 
00304 //  Purpose:  Destructor
00305 
00306 //  Arguments: None.
00307 
00308 //  Return:   n.a 
00309 
00310 //  Contact:   N. West
00311 
00312 //  Specification:-
00313 //  =============
00314 
00315 //  o Delete all Lattice building records.
00316 
00317 //  Program Notes:-
00318 //  =============
00319 
00320 //  None.
00321 
00322   LEA_DTOR  //Leak Checking
00323 
00324   for (RecItr irec = fGens.begin(); irec != fGens.end(); irec++) {
00325     delete *irec;
00326   }
00327 
00328 }

NavPrimer::NavPrimer ( const NavPrimer  )  [private]

Member Function Documentation

void NavPrimer::AdoptGenerator ( NavPrimerGenerator gen  ) 

Definition at line 79 of file NavPrimer.cxx.

References fGens.

Referenced by NavValidate::PrepareTestObjects().

00079                                                       {
00080 
00081 //  Purpose:  Adopt new gnerator.
00082 
00083 //  Arguments: 
00084 //    gen          in    Generator to be adopted.
00085 //                       NB  Caller must give generator to NavPrimer
00086 //                           which will subsequently delete it.
00087 
00088 //  Return:    n/a
00089 
00090 //  Contact:   N. West
00091 
00092 //  Specification:-
00093 //  =============
00094 
00095 //  o Adopt new gnerator.
00096 
00097 //  Program Notes:-
00098 //  =============
00099 
00100 //  NavValidate ceates generators and gives them to Navprimer as part
00101 //  of standalone testing.
00102 
00103   fGens.push_back(gen);
00104 
00105 }

void NavPrimer::DeleteAdoptedGenerators (  ) 

Definition at line 108 of file NavPrimer.cxx.

References fGens, and fNumBuiltIn.

Referenced by NavValidate::EraseTestObjects().

00108                                         {
00109 
00110 
00111 //  Purpose:  Delete any adopted generator.
00112 
00113 //  Arguments: None.
00114 
00115 //  Return:   n/a 
00116 
00117 //  Contact:   N. West
00118 
00119 //  Specification:-
00120 //  =============
00121 
00122 //  o Delete any adopted generator so that only the built-in
00123 //    ones remain.
00124 
00125 //  Program Notes:-
00126 //  =============
00127 
00128 //  Used from standalone testing which adds generators for test puposes.
00129 
00130     UInt_t numDel = fGens.size() - fNumBuiltIn;
00131 
00132     for ( ; numDel;  numDel-- ) {
00133       delete fGens.back();
00134       fGens.pop_back();
00135     }
00136 
00137 
00138 }

NavPrimerGenerator * NavPrimer::FindGenerator ( const Char_t *  leftClass,
const Char_t *  rightClass,
Int_t  rship 
) [private]

Definition at line 141 of file NavPrimer.cxx.

References fGens, and fNumBuiltIn.

Referenced by FindLattice(), and FindTCollection().

00144                                                           {
00145 
00146 
00147 //  Purpose:  Locate a suitable generator.
00148 
00149 //  Arguments: 
00150 //    leftClass    in    Class name of objects in TCollection or on 
00151 //                       left of Lattice
00152 //    rightClass   in    Null string or class name of objects on right 
00153 //                       of Lattice,
00154 //    rship        in    Relationship number or 0.
00155 
00156 //  Return:    NavPrimerGenerator that matches or =0 if none.
00157 
00158 //  Contact:   N. West
00159 
00160 //  Specification:-
00161 //  =============
00162 
00163 //  o Search list of NavPrimerGenerator objects for one that matches.
00164 
00165 //  o If none and asked for a TCollection, create a built in one.
00166 
00167 //  Program Notes:-
00168 //  =============
00169 
00170 //  This function automatically builds NavGenTCollections to simplify
00171 //  maintenance: adding a new TCollection support only requires a 1-line
00172 //  update to NavGenTCollection::Rebuild which will report any error
00173 //  if asked to build an unsupported one.
00174 
00175 //  Search for an existing one.
00176 
00177   for (RecItr irec = fGens.begin(); irec != fGens.end(); irec++) { 
00178     if ( (*irec)->Matches(leftClass,rightClass,rship) ) return *irec;
00179   }
00180 
00181 //  Build NavGenTCollection
00182 
00183     if ( rightClass[0] == '\0' ) {
00184       NavGenTCollection* gen = new NavGenTCollection(leftClass);
00185 //    Put the new one at the front so that DeleteAdoptedGenerators
00186 //    won't delete it.
00187       fGens.push_front(gen);
00188       fNumBuiltIn++;
00189       return gen;
00190     }
00191 
00192     return 0;
00193 
00194 }

const Lattice * NavPrimer::FindLattice ( const Char_t *  leftClass,
const Char_t *  rightClass,
Int_t  rship = 0 
)

Definition at line 197 of file NavPrimer.cxx.

References FindGenerator(), and NavPrimerGenerator::GetLattice().

Referenced by NavItr::NavItr(), and NavValidate::Test_2().

00199                                                    {
00200 
00201 
00202 //  Purpose:  Find Lattice between object left and right.
00203 
00204 //  Arguments: 
00205 //    leftClass    in    Class name of objects on left of Lattice,
00206 //    rightClass   in    Class name of objects on right of Lattice,
00207 //    rship        in    Relationship number or 0.
00208 
00209 
00210 //  Return:    Lattice or =0 if Lattice cannot be found.
00211 
00212 
00213 //  Contact:   N. West
00214 
00215 //  Specification:-
00216 //  =============
00217 
00218 //  o Find the appropriate Lattice generator and ask it for the Lattice.
00219 
00220 //  Program Notes:-
00221 //  =============
00222 
00223 //  FindLattice will only return a Lattice with class left on left and
00224 //  class right on the right.  However as Lattices are symmetric if
00225 //  FindLattice(left,right) fails its worth trying 
00226 //  FindLattice(right,left).
00227 
00228   NavPrimerGenerator* gen = FindGenerator(leftClass,
00229                                           rightClass,
00230                                           rship);
00231   if ( gen ) return gen->GetLattice();
00232 
00233   return 0;
00234 
00235 }

const TCollection * NavPrimer::FindTCollection ( const Char_t *  classname  ) 

Definition at line 239 of file NavPrimer.cxx.

References FindGenerator(), and NavPrimerGenerator::GetTCollection().

Referenced by NavGenLattice::Rebuild().

00239                                                                      {
00240 
00241 
00242 //  Purpose:  Find ROOT container holding objects of given class.
00243 
00244 //  Arguments: 
00245 //    classname        in    Class name of objects.
00246 
00247 //  Return:    TCollection or =0 if none can be found.
00248 
00249 
00250 //  Contact:   N. West
00251 
00252 //  Specification:-
00253 //  =============
00254 
00255 //  o Find the appropriate TCollection generator and ask it for the 
00256 //    collection.
00257 
00258 //  Program Notes:-
00259 //  =============
00260 
00261 //  None.
00262 
00263 
00264   NavPrimerGenerator* gen = FindGenerator(classname,"",0);
00265   if ( gen ) return gen->GetTCollection();
00266 
00267   return 0;
00268 
00269 }

NavPrimer * NavPrimer::Instance ( void   )  [static]

Definition at line 44 of file NavPrimer.cxx.

Referenced by NavValidate::EraseTestObjects(), NavItr::NavItr(), NavValidate::PrepareTestObjects(), NavGenLattice::Rebuild(), NavValidate::RunAllTests(), and NavValidate::Test_2().

00044                                {
00045 
00046 
00047 //  Purpose:  Create if necessary and then return singleton instance
00048 //            of NavPrimer.
00049 
00050 //  Arguments: None.
00051 
00052 //  Return:    Singleton instance of NavPrimer.
00053 
00054 //  Contact:   N. West
00055 
00056 //  Specification:-
00057 //  =============
00058 
00059 //  o Create if necessary and then return singleton instance of 
00060 //    NavPrimer.
00061 
00062 //  Program Notes:-
00063 //  =============
00064 
00065 //  None.
00066 
00067   if ( ! fgInstance ) fgInstance = new NavPrimer;
00068   return fgInstance;
00069 
00070 }

Bool_t NavPrimer::IsOutOfDate (  )  const [private]

Friends And Related Function Documentation

friend class NavPrimerGenerator [friend]

Definition at line 26 of file NavPrimer.h.


Member Data Documentation

std::list<NavPrimerGenerator*> NavPrimer::fGens [private]
NavPrimer * NavPrimer::fgInstance = 0 [static, private]

Definition at line 72 of file NavPrimer.h.

UInt_t NavPrimer::fNumBuiltIn [private]

Definition at line 71 of file NavPrimer.h.

Referenced by DeleteAdoptedGenerators(), FindGenerator(), and NavPrimer().


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

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1