Jpp  18.0.0
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Protected Attributes | Private Types | Private Attributes | List of all members
JDETECTOR::JLocationRouter Class Reference

Router for direct addressing of location data in detector data structure. More...

#include <JLocationRouter.hh>

Inheritance diagram for JDETECTOR::JLocationRouter:
JLANG::JReference< JClass_t >

Public Types

typedef JDetector::const_iterator const_iterator
 

Public Member Functions

 JLocationRouter (const JDetector &detector)
 Constructor. More...
 
const JLocationRoutergetLocationRouter () const
 Get location router. More...
 
const JModuleAddressgetAddress (const JLocation &location) const
 Get address of location. More...
 
const JModulegetModule (const JLocation &location) const
 Get module parameters. More...
 
bool hasLocation (const JLocation &location) const
 Has module. More...
 
const int getIndex (const JLocation &location) const
 Get index of location. More...
 
const JClass_t & getReference () const
 Get reference to object. More...
 
JClass_t & getReference ()
 Get reference to object. More...
 
bool is_valid () const
 Check validity of reference. More...
 
const JClass_t * operator-> () const
 Smart pointer. More...
 
JClass_t * operator-> ()
 Smart pointer. More...
 
const JClass_t & operator* () const
 Dereference operator. More...
 
JClass_t & operator* ()
 Dereference operator. More...
 

Protected Attributes

JClass_t & __object
 

Private Types

typedef JReference< const
JDetector
JReference_t
 

Private Attributes

JTOOLS::JHashMap< int,
JTOOLS::JHashMap< int,
JModuleAddress > > 
router
 

Detailed Description

Router for direct addressing of location data in detector data structure.

Definition at line 28 of file JLocationRouter.hh.

Member Typedef Documentation

Definition at line 32 of file JLocationRouter.hh.

typedef JDetector::const_iterator JDETECTOR::JLocationRouter::const_iterator

Definition at line 36 of file JLocationRouter.hh.

Constructor & Destructor Documentation

JDETECTOR::JLocationRouter::JLocationRouter ( const JDetector detector)
inline

Constructor.

Parameters
detectordetector

Definition at line 44 of file JLocationRouter.hh.

44  :
45  JReference_t(detector)
46  {
47  for (const_iterator module = detector.begin(); module != detector.end(); ++module) {
48  router[module->getString()][module->getFloor()] = JModuleAddress(std::distance(detector.begin(), module));
49  }
50  }
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
JDetector::const_iterator const_iterator
JTOOLS::JHashMap< int, JTOOLS::JHashMap< int, JModuleAddress > > router
Address of module in detector data structure.
JReference< const JDetector > JReference_t

Member Function Documentation

const JLocationRouter& JDETECTOR::JLocationRouter::getLocationRouter ( ) const
inline

Get location router.

Returns
location router

Definition at line 58 of file JLocationRouter.hh.

59  {
60  return static_cast<const JLocationRouter&>(*this);
61  }
Router for direct addressing of location data in detector data structure.
const JModuleAddress& JDETECTOR::JLocationRouter::getAddress ( const JLocation location) const
inline

Get address of location.

Parameters
locationlocation
Returns
address

Definition at line 70 of file JLocationRouter.hh.

71  {
72  return router[location.getString()][location.getFloor()];
73  }
int getFloor() const
Get floor number.
Definition: JLocation.hh:145
JTOOLS::JHashMap< int, JTOOLS::JHashMap< int, JModuleAddress > > router
int getString() const
Get string number.
Definition: JLocation.hh:134
const JModule& JDETECTOR::JLocationRouter::getModule ( const JLocation location) const
inline

Get module parameters.

Parameters
locationlocation
Returns
module parameters

Definition at line 82 of file JLocationRouter.hh.

83  {
84  return getReference().getModule(this->getAddress(location));
85  }
const JModuleAddress & getAddress(const JLocation &location) const
Get address of location.
const JClass_t & getReference() const
Get reference to object.
Definition: JReference.hh:38
bool JDETECTOR::JLocationRouter::hasLocation ( const JLocation location) const
inline

Has module.

Parameters
locationlocation
Returns
true if location present; else false

Definition at line 94 of file JLocationRouter.hh.

95  {
96  return router.has(location.getString()) && router[location.getString()].has(location.getFloor());
97  }
int getFloor() const
Get floor number.
Definition: JLocation.hh:145
JTOOLS::JHashMap< int, JTOOLS::JHashMap< int, JModuleAddress > > router
int getString() const
Get string number.
Definition: JLocation.hh:134
const int JDETECTOR::JLocationRouter::getIndex ( const JLocation location) const
inline

Get index of location.

Parameters
locationlocation
Returns
index

Definition at line 106 of file JLocationRouter.hh.

107  {
108  return getAddress(location).first;
109  }
int first
index of module in detector data structure
const JModuleAddress & getAddress(const JLocation &location) const
Get address of location.
template<class JClass_t>
const JClass_t& JLANG::JReference< JClass_t >::getReference ( ) const
inlineinherited

Get reference to object.

Returns
reference to object

Definition at line 38 of file JReference.hh.

39  {
40  return __object;
41  }
JClass_t & __object
Definition: JReference.hh:110
template<class JClass_t>
JClass_t& JLANG::JReference< JClass_t >::getReference ( )
inlineinherited

Get reference to object.

Returns
reference to object

Definition at line 49 of file JReference.hh.

50  {
51  return __object;
52  }
JClass_t & __object
Definition: JReference.hh:110
template<class JClass_t>
bool JLANG::JReference< JClass_t >::is_valid ( ) const
inlineinherited

Check validity of reference.

Returns
true

Definition at line 60 of file JReference.hh.

61  {
62  return true;
63  }
template<class JClass_t>
const JClass_t* JLANG::JReference< JClass_t >::operator-> ( ) const
inlineinherited

Smart pointer.

Returns
pointer to object

Definition at line 71 of file JReference.hh.

72  {
73  return &__object;
74  }
JClass_t & __object
Definition: JReference.hh:110
template<class JClass_t>
JClass_t* JLANG::JReference< JClass_t >::operator-> ( )
inlineinherited

Smart pointer.

Returns
pointer to object

Definition at line 82 of file JReference.hh.

83  {
84  return &__object;
85  }
JClass_t & __object
Definition: JReference.hh:110
template<class JClass_t>
const JClass_t& JLANG::JReference< JClass_t >::operator* ( ) const
inlineinherited

Dereference operator.

Returns
reference to object

Definition at line 93 of file JReference.hh.

94  {
95  return __object;
96  }
JClass_t & __object
Definition: JReference.hh:110
template<class JClass_t>
JClass_t& JLANG::JReference< JClass_t >::operator* ( )
inlineinherited

Dereference operator.

Returns
reference to object

Definition at line 104 of file JReference.hh.

105  {
106  return __object;
107  }
JClass_t & __object
Definition: JReference.hh:110

Member Data Documentation

JTOOLS::JHashMap<int, JTOOLS::JHashMap<int, JModuleAddress> > JDETECTOR::JLocationRouter::router
private

Definition at line 112 of file JLocationRouter.hh.

template<class JClass_t>
JClass_t& JLANG::JReference< JClass_t >::__object
protectedinherited

Definition at line 110 of file JReference.hh.


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