LatticeBuilder Class Reference

#include <LatticeBuilder.h>

List of all members.

Public Types

typedef Long_t Key
typedef Lattice::ESide ESide
typedef Lattice::ID ID

Public Member Functions

 LatticeBuilder ()
 LatticeBuilder (Lattice *lattice, ESide primarySide)
virtual ~LatticeBuilder ()
Bool_t AddPrimary (Long_t key, ID primaryID)
Bool_t AddSecondary (Long_t key, ID secondaryID)
void DockLattice (Lattice *lattice, ESide primarySide)

Private Types

enum  EState { kFloating, kHasLattice, kHasPrimary, kHasSecondary }

Private Attributes

LatticefLattice
map< const Key, IDfKeyMap
ESide fPrimarySide
EState fState

Detailed Description

Definition at line 53 of file LatticeBuilder.h.


Member Typedef Documentation

Definition at line 59 of file LatticeBuilder.h.

Definition at line 60 of file LatticeBuilder.h.

typedef Long_t LatticeBuilder::Key

Definition at line 58 of file LatticeBuilder.h.


Member Enumeration Documentation

enum LatticeBuilder::EState [private]
Enumerator:
kFloating 
kHasLattice 
kHasPrimary 
kHasSecondary 

Definition at line 82 of file LatticeBuilder.h.


Constructor & Destructor Documentation

LatticeBuilder::LatticeBuilder (  ) 

Definition at line 140 of file LatticeBuilder.cxx.

References DockLattice(), and Lattice::kLeft.

00140                                 {
00141 
00142 //  Purpose:   Default Constructor
00143 //  Arguments: None
00144 //            
00145 //  Return:    n/a
00146 
00147 //  Contact:   N. West
00148 
00149 
00150    DockLattice( 0, Lattice::kLeft ); 
00151 }

LatticeBuilder::LatticeBuilder ( Lattice lattice,
ESide  primarySide 
)

Definition at line 155 of file LatticeBuilder.cxx.

References DockLattice().

00156                                                    {
00157 
00158 //  Purpose:   Constructor
00159 //  Arguments:
00160 //     lattice      in  The lattice to be docked ready for filling
00161 //     primarySide  in  The side of lattice holding primaries.
00162 //                   
00163 //            
00164 //  Return:    n/a
00165 
00166 //  Contact:   N. West
00167 
00168 
00169    DockLattice( lattice, primarySide ); 
00170 }

LatticeBuilder::~LatticeBuilder (  )  [virtual]

Definition at line 174 of file LatticeBuilder.cxx.

00174 {}


Member Function Documentation

Bool_t LatticeBuilder::AddPrimary ( Long_t  key,
ID  primaryID 
)

Definition at line 31 of file LatticeBuilder.cxx.

References fKeyMap, fState, kHasLattice, kHasPrimary, Msg::kWarning, and MSG.

Referenced by NavGenLattice::Rebuild(), LatValidate::Test_1(), and LatValidate::Test_2().

00031                                                              {
00032 
00033 //  Purpose:   Add primary to lattice
00034 //  Arguments: 
00035 //      Key          in   Key associated with primary
00036 //      primaryID    in   ID of  primary
00037 //            
00038 //  Return:    kTRUE if request accepted.
00039 
00040 //  Contact:   N. West
00041 
00042 
00043 // Specification:-
00044 // =============
00045 
00046 // o  Record the keys and IDs of all primaries ready for pass over 
00047 //    secondaries.
00048 
00049 
00050 //  Confirm that we can record a primary.
00051 
00052   if ( fState != kHasLattice && fState != kHasPrimary ) {
00053     MSG("Lat",Msg::kWarning) << "Lattice not ready for primaries " 
00054                              <<endl;
00055     return kFALSE;
00056   }
00057 
00058 
00059 //  Record key in look-up table.
00060   fKeyMap[key] = primaryID;
00061   fState       = kHasPrimary;
00062   return kTRUE;
00063 
00064 }

Bool_t LatticeBuilder::AddSecondary ( Long_t  key,
ID  secondaryID 
)

Definition at line 68 of file LatticeBuilder.cxx.

References Lattice::Connect(), fKeyMap, fLattice, fPrimarySide, fState, kHasPrimary, kHasSecondary, Msg::kWarning, and MSG.

Referenced by NavGenLattice::Rebuild(), LatValidate::Test_1(), and LatValidate::Test_2().

00068                                                                {
00069 
00070 //  Purpose:   
00071 //      Key          in   Key associated with secondary
00072 //      primaryID    in   ID of  secondary
00073 //            
00074 //  Return:    kTRUE if request accepted.
00075 //            
00076 //  Return:    
00077 
00078 //  Contact:   N. West
00079 
00080 // Specification:-
00081 // =============
00082 
00083 // o  Look up the key and record the (primary,secondary) pair in 
00084   //  the lattice.
00085 
00086 //  Confirm that we can build a primary secondary pair.
00087 
00088   if ( fState != kHasSecondary && fState != kHasPrimary ) {
00089     MSG("Lat",Msg::kWarning) << "Lattice not ready for secondaries " 
00090                              <<endl;
00091     return kFALSE;
00092   }
00093   
00094 
00095 
00096 // Retrieve primary using key and record pair in Lattice.
00097 
00098   if ( fKeyMap.count(key) == 0 ) {
00099     MSG("Lat",Msg::kWarning) << "No primary for key " << key <<endl;
00100     return kFALSE;
00101   }
00102 
00103   fLattice->Connect(fPrimarySide, fKeyMap[key], 0, secondaryID);
00104   fState = kHasSecondary;
00105   return kTRUE;
00106 
00107 
00108 }

void LatticeBuilder::DockLattice ( Lattice lattice,
ESide  primarySide 
)

Definition at line 112 of file LatticeBuilder.cxx.

References fKeyMap, fLattice, fPrimarySide, fState, kFloating, and kHasLattice.

Referenced by LatticeBuilder(), LatValidate::Test_1(), and LatValidate::Test_2().

00113                                                       {
00114 
00115 //  Purpose:   Dock new lattice to Builder ready for filling.
00116 //  Arguments:
00117 //        lattice  in    lattice to be filled (any existing lattice
00118 //                       will be disconected).
00119 //        primarySide
00120 //                 in    The side of the Lattice (either kLeft or
00121 //                       kRight) that holds the primaries.
00122 //  Return:  n/a  
00123 
00124 //  Contact:   N. West
00125 
00126 // Specification:-
00127 // =============
00128 
00129 // o  Dock new kattice ready for building.
00130 
00131 
00132   fLattice       = lattice;
00133   fPrimarySide   = primarySide;
00134   fState         = fLattice ? kHasLattice : kFloating;
00135   fKeyMap.clear();
00136 }


Member Data Documentation

map<const Key, ID> LatticeBuilder::fKeyMap [private]

Definition at line 87 of file LatticeBuilder.h.

Referenced by AddPrimary(), AddSecondary(), and DockLattice().

Definition at line 86 of file LatticeBuilder.h.

Referenced by AddSecondary(), and DockLattice().

Definition at line 88 of file LatticeBuilder.h.

Referenced by AddSecondary(), and DockLattice().

Definition at line 89 of file LatticeBuilder.h.

Referenced by AddPrimary(), AddSecondary(), and DockLattice().


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

Generated on 24 Jul 2017 for loon by  doxygen 1.6.1