00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef SimEvent_SimVertexReference_H
00016 #define SimEvent_SimVertexReference_H 1
00017
00018
00019 #include "GaudiKernel/boost_allocator.h"
00020 #include <ostream>
00021
00022
00023
00024 namespace DayaBay
00025 {
00026
00027
00028 class SimVertex;
00029
00030
00041 class SimVertexReference
00042 {
00043 public:
00044
00046 SimVertexReference() : m_vertex(0),
00047 m_indirection(-999) {}
00048
00050 SimVertexReference(SimVertex* t,
00051 int indirection) : m_vertex(t),
00052 m_indirection(indirection) {}
00053
00055 virtual ~SimVertexReference() {}
00056
00058 bool isDirect() const;
00059
00061 bool isIndirect() const;
00062
00064 bool isBad() const;
00065
00067 bool isPrimary() const;
00068
00070 SimVertex* vertex();
00071
00073 std::ostream& fillStream(std::ostream& s) const;
00074
00077 const DayaBay::SimVertex* vertex() const;
00078
00081 int indirection() const;
00082
00083
00084 #ifndef GOD_NOALLOC
00086 static void* operator new ( size_t size )
00087 {
00088 return ( sizeof(SimVertexReference) == size ?
00089 boost::singleton_pool<SimVertexReference, sizeof(SimVertexReference)>::malloc() :
00090 ::operator new(size) );
00091 }
00092
00096 static void* operator new ( size_t size, void* pObj )
00097 {
00098 return ::operator new (size,pObj);
00099 }
00100
00102 static void operator delete ( void* p )
00103 {
00104 boost::singleton_pool<SimVertexReference, sizeof(SimVertexReference)>::is_from(p) ?
00105 boost::singleton_pool<SimVertexReference, sizeof(SimVertexReference)>::free(p) :
00106 ::operator delete(p);
00107 }
00108
00111 static void operator delete ( void* p, void* pObj )
00112 {
00113 ::operator delete (p, pObj);
00114 }
00115 #endif
00116 protected:
00117
00118 private:
00119
00120 DayaBay::SimVertex* m_vertex;
00121 int m_indirection;
00122
00123 };
00124
00125 inline std::ostream& operator<< (std::ostream& str, const SimVertexReference& obj)
00126 {
00127 return obj.fillStream(str);
00128 }
00129
00130 }
00131
00132
00133
00134
00135
00136
00137 #include "SimVertex.h"
00138
00139
00140 inline const DayaBay::SimVertex* DayaBay::SimVertexReference::vertex() const
00141 {
00142 return m_vertex;
00143 }
00144
00145 inline int DayaBay::SimVertexReference::indirection() const
00146 {
00147 return m_indirection;
00148 }
00149
00150 inline bool DayaBay::SimVertexReference::isDirect() const
00151 {
00152 return (m_indirection == 0);
00153 }
00154
00155 inline bool DayaBay::SimVertexReference::isIndirect() const
00156 {
00157 return (m_indirection > 0);
00158 }
00159
00160 inline bool DayaBay::SimVertexReference::isBad() const
00161 {
00162 return (m_indirection < 0);
00163 }
00164
00165 inline bool DayaBay::SimVertexReference::isPrimary() const
00166 {
00167 return(m_vertex==0)&&(m_indirection==0);
00168 }
00169
00170 inline DayaBay::SimVertex* DayaBay::SimVertexReference::vertex()
00171 {
00172 return m_vertex;
00173 }
00174
00175
00176 #endif