Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

LatticeBuilder.h

Go to the documentation of this file.
00001 // $Id: LatticeBuilder.h,v 1.2 2000/05/10 10:07:04 west Exp $
00002 
00003 #if !defined(LATTICEBUILDER_H)
00004 #define LATTICEBUILDER_H
00005 
00006 
00008 // LatticeBuilder                                                            //
00009 //                                                                    //
00010 // Package: Lat (Lattice Navigation Model).                           //
00011 //                                                                    //
00012 // 
00013 // 
00014 // LatticeBuilder is a tool to simplify Lattice building in those
00015 // cases where the relationship can be expressed in terms of a key
00016 // convertible to Long_t.  The build process is as follows:-
00017 // 
00018 // 1)  Create an empty Lattice.
00019 // 
00020 // 2)  Dock it to the builder using DockLattice();
00021 // 
00022 // 3)  Loop over the primaries i.e. that side of the Lattice
00023 //     whose object's map to keys and call AddPrimary().
00024 // 
00025 // 4)  Loop over secondaries, determine the key of the associated
00026 //     primary and call AddSecondary.
00027 // 
00028 // Note:-
00029 // ====
00030 // 
00031 // 1)  The LatticeBuilder never clears the Lattice, the owner must
00032 //     do that if required.
00033 // 
00034 // 2)  All AddPrimary calls must come before any secondary call.
00035 // 
00036 // 3)  Only those primaries that are actually connected to one
00037 //     or more secondary are recorded in the lattice.
00038 // 
00039 // 4)  The same LatticeBuilder can be used to build any number
00040 //     of Lattices; docking a new Lattice reinitialises the builder
00041 // 
00042 // 
00043 //
00044 // N. West  03/2000                                                   //
00046 
00047 #include <map>
00048 #include "Rtypes.h"
00049 #include "Lattice/Lattice.h"
00050 
00051 class Lattice;
00052 
00053 class LatticeBuilder
00054 {
00055 
00056 public:
00057 
00058 typedef    Long_t            Key;
00059 typedef    Lattice::ESide    ESide;
00060 typedef    Lattice::ID       ID;
00061 
00062 // Constructors and destructors
00063                            LatticeBuilder();
00064                            LatticeBuilder( Lattice* lattice,
00065                                            ESide primarySide);
00066   virtual                 ~LatticeBuilder();
00067 
00068 // State testing member functions
00069 
00070  
00071 // State changing member functions
00072 
00073 Bool_t AddPrimary(   Long_t key, ID primaryID);
00074 Bool_t AddSecondary( Long_t key, ID secondaryID);
00075  void  DockLattice( Lattice* lattice, ESide primarySide);
00076 
00077 protected:
00078 
00079 
00080 private:
00081 
00082 enum EState { kFloating, kHasLattice, kHasPrimary, kHasSecondary };
00083 
00084 // Data members
00085 
00086   Lattice*                 fLattice;
00087   map<const Key, ID>       fKeyMap;
00088   ESide                    fPrimarySide;
00089   EState                   fState;
00090 };
00091 
00092 
00093 #endif /* LATTICEBUILDER_H */

Generated on Mon Feb 15 11:06:50 2010 for loon by  doxygen 1.3.9.1