EventSelectorDataStream Class Reference

Definition of class EventSelectorDataStream. More...

#include </tmp/marcocle/lhcb-release/1122/GAUDI/GAUDI_v27r0/InstallArea/x86_64-slc6-gcc49-opt/include/GaudiKernel/EventSelectorDataStream.h>

Inheritance diagram for EventSelectorDataStream:
Collaboration diagram for EventSelectorDataStream:

Public Types

typedef std::vector< StringPropertyProperties
 
typedef std::vector< StringPropertyProperties
 
- Public Types inherited from implements< Interfaces >
using base_class = implements< Interfaces...>
 Typedef to this class. More...
 
using extend_interfaces_base = extend_interfaces< Interfaces...>
 Typedef to the base of this class. More...
 
using iids = typename extend_interfaces_base::ext_iids
 
using base_class = implements< Interfaces...>
 Typedef to this class. More...
 
using extend_interfaces_base = extend_interfaces< Interfaces...>
 Typedef to the base of this class. More...
 
using iids = typename extend_interfaces_base::ext_iids
 
- Public Types inherited from extend_interfaces< Interfaces...>
using ext_iids = typename Gaudi::interface_list_cat< typename Interfaces::ext_iids...>::type
 take union of the ext_iids of all Interfaces... More...
 
using ext_iids = typename Gaudi::interface_list_cat< typename Interfaces::ext_iids...>::type
 take union of the ext_iids of all Interfaces... More...
 

Public Member Functions

 EventSelectorDataStream (std::string nam, std::string def, ISvcLocator *svcloc)
 Standard Constructor. More...
 
virtual void setSelector (IEvtSelector *pSelector)
 Attach event selector object. More...
 
virtual StatusCode initialize ()
 Parse input criteria. More...
 
virtual StatusCode finalize ()
 Finalize stream and release resources. More...
 
StringPropertyproperty (const std::string &nam)
 Allow access to individual properties by name. More...
 
const StringPropertyproperty (const std::string &nam) const
 Allow access to individual properties by name (CONST) More...
 
const Propertiesproperties ()
 Access properties. More...
 
const std::string & name () const
 Retrieve stream name. More...
 
const std::string & criteria () const
 Retrieve stream criteria. More...
 
const std::string & dbName () const
 Retrieve stream dbName. More...
 
const std::string & selectorType () const
 Retrieve event selector type. More...
 
const std::string & definition () const
 Retrieve definition string. More...
 
IEvtSelectorselector () const
 Retrieve event selector object. More...
 
bool isInitialized () const
 Check initialization status. More...
 
 EventSelectorDataStream (std::string nam, std::string def, ISvcLocator *svcloc)
 Standard Constructor. More...
 
virtual void setSelector (IEvtSelector *pSelector)
 Attach event selector object. More...
 
virtual StatusCode initialize ()
 Parse input criteria. More...
 
virtual StatusCode finalize ()
 Finalize stream and release resources. More...
 
StringPropertyproperty (const std::string &nam)
 Allow access to individual properties by name. More...
 
const StringPropertyproperty (const std::string &nam) const
 Allow access to individual properties by name (CONST) More...
 
const Propertiesproperties ()
 Access properties. More...
 
const std::string & name () const
 Retrieve stream name. More...
 
const std::string & criteria () const
 Retrieve stream criteria. More...
 
const std::string & dbName () const
 Retrieve stream dbName. More...
 
const std::string & selectorType () const
 Retrieve event selector type. More...
 
const std::string & definition () const
 Retrieve definition string. More...
 
IEvtSelectorselector () const
 Retrieve event selector object. More...
 
bool isInitialized () const
 Check initialization status. More...
 
- Public Member Functions inherited from implements< Interfaces >
void * i_cast (const InterfaceID &tid) const override
 Implementation of IInterface::i_cast. More...
 
StatusCode queryInterface (const InterfaceID &ti, void **pp) override
 Implementation of IInterface::queryInterface. More...
 
std::vector< std::string > getInterfaceNames () const override
 Implementation of IInterface::getInterfaceNames. More...
 
 implements ()=default
 Default constructor. More...
 
 implements (const implements &)
 Copy constructor (zero the reference count) More...
 
implementsoperator= (const implements &)
 Assignment operator (do not touch the reference count). More...
 
 ~implements () override=default
 Virtual destructor. More...
 
unsigned long addRef () override
 Reference Interface instance. More...
 
unsigned long release () override
 Release Interface instance. More...
 
unsigned long refCount () const override
 Current reference count. More...
 
void * i_cast (const InterfaceID &tid) const override
 Implementation of IInterface::i_cast. More...
 
StatusCode queryInterface (const InterfaceID &ti, void **pp) override
 Implementation of IInterface::queryInterface. More...
 
std::vector< std::string > getInterfaceNames () const override
 Implementation of IInterface::getInterfaceNames. More...
 
 implements ()=default
 Default constructor. More...
 
 implements (const implements &)
 Copy constructor (zero the reference count) More...
 
implementsoperator= (const implements &)
 Assignment operator (do not touch the reference count). More...
 
 ~implements () override=default
 Virtual destructor. More...
 
unsigned long addRef () override
 Reference Interface instance. More...
 
unsigned long release () override
 Release Interface instance. More...
 
unsigned long refCount () const override
 Current reference count. More...
 
- Public Member Functions inherited from extend_interfaces< Interfaces...>
 ~extend_interfaces () override=default
 Virtual destructor. More...
 
 ~extend_interfaces () override=default
 Virtual destructor. More...
 

Protected Member Functions

virtual ~EventSelectorDataStream ()=default
 Standard Destructor. More...
 
virtual ~EventSelectorDataStream ()=default
 Standard Destructor. More...
 

Protected Attributes

std::string m_name
 Name. More...
 
std::string m_definition
 Definition string. More...
 
std::string m_criteria
 Criteria. More...
 
std::string m_dbName
 String with name of the db as parsed. More...
 
std::string m_selectorType
 Event selector type. More...
 
SmartIF< IEvtSelectorm_pSelector
 Pointer to valid selector. More...
 
ISvcLocatorm_pSvcLocator
 Reference to service locator. More...
 
Properties m_properties
 Properties vector. More...
 
bool m_initialized = false
 Initialization state. More...
 
- Protected Attributes inherited from implements< Interfaces >
std::atomic_ulong m_refCount = {0}
 Reference counter. More...
 

Friends

MsgStreamoperator<< (MsgStream &s, const EventSelectorDataStream &obj)
 Output friend for MsgStream. More...
 
std::ostream & operator<< (std::ostream &s, const EventSelectorDataStream &obj)
 Output friend for standard I/O. More...
 
MsgStreamoperator<< (MsgStream &s, const EventSelectorDataStream &obj)
 Output friend for MsgStream. More...
 
std::ostream & operator<< (std::ostream &s, const EventSelectorDataStream &obj)
 Output friend for standard I/O. More...
 

Detailed Description

Definition of class EventSelectorDataStream.

Small class which eases the management of multiple input streams for the event selector.

History: +------—+-------------------------------------------—+---------—+ | Date | Comment | Who | +------—+-------------------------------------------—+---------—+ | 3/10/00 | Initial version | M.Frank | +------—+-------------------------------------------—+---------—+ | 4/09/09 | Added m_dbName and dbName() | R. Lambert | +------—+-------------------------------------------—+---------—+

Author
Markus Frank
R. Lambert
Version
1.0

Definition at line 45 of file EventSelectorDataStream.h.

Member Typedef Documentation

Definition at line 51 of file EventSelectorDataStream.h.

Definition at line 51 of file EventSelectorDataStream.h.

Constructor & Destructor Documentation

virtual EventSelectorDataStream::~EventSelectorDataStream ( )
protectedvirtualdefault

Standard Destructor.

EventSelectorDataStream::EventSelectorDataStream ( std::string  nam,
std::string  def,
ISvcLocator svcloc 
)

Standard Constructor.

Definition at line 37 of file EventSelectorDataStream.cpp.

38 : m_name{ std::move(nam) }, m_definition{ std::move(def) }, m_pSvcLocator(svcloc)
39 {
40 }
ISvcLocator * m_pSvcLocator
Reference to service locator.
std::string m_definition
Definition string.
virtual EventSelectorDataStream::~EventSelectorDataStream ( )
protectedvirtualdefault

Standard Destructor.

EventSelectorDataStream::EventSelectorDataStream ( std::string  nam,
std::string  def,
ISvcLocator svcloc 
)

Standard Constructor.

Member Function Documentation

const std::string& EventSelectorDataStream::criteria ( ) const
inline

Retrieve stream criteria.

Definition at line 95 of file EventSelectorDataStream.h.

95  {
96  return m_criteria;
97  }
std::string m_criteria
Criteria.
const std::string& EventSelectorDataStream::criteria ( ) const
inline

Retrieve stream criteria.

Definition at line 95 of file EventSelectorDataStream.h.

95  {
96  return m_criteria;
97  }
std::string m_criteria
Criteria.
const std::string& EventSelectorDataStream::dbName ( ) const
inline

Retrieve stream dbName.

Definition at line 99 of file EventSelectorDataStream.h.

99  {
100  return m_dbName;
101  }
std::string m_dbName
String with name of the db as parsed.
const std::string& EventSelectorDataStream::dbName ( ) const
inline

Retrieve stream dbName.

Definition at line 99 of file EventSelectorDataStream.h.

99  {
100  return m_dbName;
101  }
std::string m_dbName
String with name of the db as parsed.
const std::string& EventSelectorDataStream::definition ( ) const
inline

Retrieve definition string.

Definition at line 107 of file EventSelectorDataStream.h.

107  {
108  return m_definition;
109  }
std::string m_definition
Definition string.
const std::string& EventSelectorDataStream::definition ( ) const
inline

Retrieve definition string.

Definition at line 107 of file EventSelectorDataStream.h.

107  {
108  return m_definition;
109  }
std::string m_definition
Definition string.
StatusCode EventSelectorDataStream::finalize ( )
virtual

Finalize stream and release resources.

Definition at line 193 of file EventSelectorDataStream.cpp.

193  {
194  setSelector(nullptr);
195  m_properties.clear();
196  m_initialized = false;
197  return StatusCode::SUCCESS;
198 }
bool m_initialized
Initialization state.
Properties m_properties
Properties vector.
virtual void setSelector(IEvtSelector *pSelector)
Attach event selector object.
virtual StatusCode EventSelectorDataStream::finalize ( )
virtual

Finalize stream and release resources.

StatusCode EventSelectorDataStream::initialize ( )
virtual

Parse input criteria.

Definition at line 62 of file EventSelectorDataStream.cpp.

62  {
63  bool isData = true;
64  std::string auth, dbtyp, collsvc, item, crit, sel, svc, stmt;
65  std::string cnt = "/Event";
66  std::string db = "<Unknown>";
67 
68  auto eds = m_pSvcLocator->service<IDataManagerSvc>("EventDataSvc");
69  if( !eds ) {
70  std::cout << "ERROR: Unable to localize interface IDataManagerSvc from service EventDataSvc"
71  << std::endl;
72  return StatusCode::FAILURE;
73  }
74  else {
75  cnt = eds->rootName();
76  }
78  m_properties.clear();
79 
80  using Parser = Gaudi::Utils::AttribStringParser;
81  for (auto attrib: Parser(m_definition)) {
82  long hash = -1;
83  switch( ::toupper(attrib.tag[0]) ) {
84  case 'A':
85  auth = std::move(attrib.value);
86  break;
87  case 'C':
88  svc = "EvtTupleSvc";
89  isData = false;
90  /* no break */
91  case 'E':
92  hash = attrib.value.find('#');
93  if ( hash > 0 ) {
94  cnt = attrib.value.substr(0, hash);
95  item = attrib.value.substr(hash + 1);
96  }
97  else {
98  cnt = std::move(attrib.value);
99  item = "Address";
100  }
101  break;
102  case 'D':
103  m_criteria = "FILE " + attrib.value;
104  m_dbName = std::move(attrib.value);
105  break;
106  case 'F':
107  switch( ::toupper(attrib.tag[1]) ) {
108  case 'I':
109  m_criteria = "FILE " + attrib.value;
110  m_dbName = std::move(attrib.value);
111  break;
112  case 'U':
113  stmt = std::move(attrib.value);
114  break;
115  default:
116  break;
117  }
118  break;
119  case 'J':
120  m_criteria = "JOBID " + attrib.value;
121  m_dbName = std::move(attrib.value);
122  dbtyp = "SICB";
123  break;
124  case 'T':
125  switch( ::toupper(attrib.tag[1]) ) {
126  case 'Y':
127  dbtyp = std::move(attrib.value);
128  break;
129  default:
130  break;
131  }
132  break;
133  case 'S':
134  switch( ::toupper(attrib.tag[1]) ) {
135  case 'E':
136  sel = std::move(attrib.value);
137  break;
138  case 'V':
139  svc = std::move(attrib.value);
140  collsvc = svc;
141  break;
142  default:
143  break;
144  }
145  break;
146  default:
147  m_properties.emplace_back(attrib.tag, attrib.value);
148  break;
149  }
150  }
151  if ( !isData ) { // Unfortunately options do not come in order...
152  m_selectorType = "EventCollectionSelector";
153  svc = "EvtTupleSvc";
154  }
155  else if ( dbtyp.compare(0,4,"POOL") == 0 ) {
156  m_selectorType = "PoolDbEvtSelector";
157  }
158  else if ( svc.empty() ) {
159  m_selectorType = "DbEvtSelector";
160  }
161  else {
162  m_selectorType = svc;
163  }
165  if ( svc.empty() && !dbtyp.empty() ) {
166  auto ipers = m_pSvcLocator->service<IPersistencySvc>("EventPersistencySvc");
167  if ( ipers ) {
168  IConversionSvc* icnvSvc = nullptr;
169  status = ipers->getService(dbtyp, icnvSvc);
170  if ( status.isSuccess() ) {
171  auto isvc = SmartIF<INamedInterface>{ icnvSvc } ;
172  if ( isvc ) svc = isvc->name();
173  }
174  }
175  }
176  m_properties.emplace_back( "Function", stmt);
177  m_properties.emplace_back( "CnvService", svc);
178  m_properties.emplace_back( "Authentication",auth);
179  m_properties.emplace_back( "Container", cnt);
180  m_properties.emplace_back( "Item", item);
181  m_properties.emplace_back( "Criteria", sel);
182  m_properties.emplace_back( "DbType", dbtyp);
183  m_properties.emplace_back( "DB", m_criteria);
184  if ( !isData && !collsvc.empty() ) {
185  m_properties.emplace_back( "DbService", collsvc);
186  }
187 
188  m_initialized = status.isSuccess();
189  return status;
190 }
bool m_initialized
Initialization state.
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
std::string m_criteria
Criteria.
std::string m_selectorType
Event selector type.
StatusCode service(const Gaudi::Utils::TypeNameString &name, T *&svc, bool createIf=true)
Templated method to access a service by name.
Definition: ISvcLocator.h:78
ISvcLocator * m_pSvcLocator
Reference to service locator.
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
std::string m_definition
Definition string.
Properties m_properties
Properties vector.
tuple item
print s1,s2
Definition: ana.py:146
Data persistency service interface.
std::string m_dbName
String with name of the db as parsed.
void toupper(std::string &s)
virtual StatusCode EventSelectorDataStream::initialize ( )
virtual

Parse input criteria.

bool EventSelectorDataStream::isInitialized ( ) const
inline

Check initialization status.

Definition at line 115 of file EventSelectorDataStream.h.

115  {
116  return m_initialized;
117  }
bool m_initialized
Initialization state.
bool EventSelectorDataStream::isInitialized ( ) const
inline

Check initialization status.

Definition at line 115 of file EventSelectorDataStream.h.

115  {
116  return m_initialized;
117  }
bool m_initialized
Initialization state.
const std::string& EventSelectorDataStream::name ( ) const
inline

Retrieve stream name.

Definition at line 91 of file EventSelectorDataStream.h.

91  {
92  return m_name;
93  }
const std::string& EventSelectorDataStream::name ( ) const
inline

Retrieve stream name.

Definition at line 91 of file EventSelectorDataStream.h.

91  {
92  return m_name;
93  }
const Properties& EventSelectorDataStream::properties ( )
inline

Access properties.

Definition at line 87 of file EventSelectorDataStream.h.

87  {
88  return m_properties;
89  }
Properties m_properties
Properties vector.
const Properties& EventSelectorDataStream::properties ( )
inline

Access properties.

Definition at line 87 of file EventSelectorDataStream.h.

87  {
88  return m_properties;
89  }
Properties m_properties
Properties vector.
StringProperty* EventSelectorDataStream::property ( const std::string &  nam)

Allow access to individual properties by name.

StringProperty * EventSelectorDataStream::property ( const std::string &  nam)

Allow access to individual properties by name.

Definition at line 48 of file EventSelectorDataStream.cpp.

48  {
49  auto i = std::find_if( std::begin(m_properties), std::end(m_properties),
50  [&](const StringProperty& j ) { return j.name() == nam ; } );
51  return i!=std::end(m_properties) ? &(*i) : nullptr;
52 }
const std::string & name() const
property name
Definition: Property.h:45
auto begin(reverse_wrapper< T > &w)
Definition: reverse.h:45
auto end(reverse_wrapper< T > &w)
Definition: reverse.h:47
Properties m_properties
Properties vector.
list i
Definition: ana.py:128
const StringProperty * EventSelectorDataStream::property ( const std::string &  nam) const

Allow access to individual properties by name (CONST)

Definition at line 55 of file EventSelectorDataStream.cpp.

55  {
56  auto i = std::find_if( std::begin(m_properties), std::end(m_properties),
57  [&](const StringProperty& j ) { return j.name() == nam ; } );
58  return i!=std::end(m_properties) ? &(*i) : nullptr;
59 }
const std::string & name() const
property name
Definition: Property.h:45
auto begin(reverse_wrapper< T > &w)
Definition: reverse.h:45
auto end(reverse_wrapper< T > &w)
Definition: reverse.h:47
Properties m_properties
Properties vector.
list i
Definition: ana.py:128
const StringProperty* EventSelectorDataStream::property ( const std::string &  nam) const

Allow access to individual properties by name (CONST)

IEvtSelector* EventSelectorDataStream::selector ( ) const
inline

Retrieve event selector object.

Definition at line 111 of file EventSelectorDataStream.h.

111  {
112  return m_pSelector.get();
113  }
TYPE * get() const
Get interface pointer.
Definition: SmartIF.h:76
SmartIF< IEvtSelector > m_pSelector
Pointer to valid selector.
IEvtSelector* EventSelectorDataStream::selector ( ) const
inline

Retrieve event selector object.

Definition at line 111 of file EventSelectorDataStream.h.

111  {
112  return m_pSelector.get();
113  }
TYPE * get() const
Get interface pointer.
Definition: SmartIF.h:76
SmartIF< IEvtSelector > m_pSelector
Pointer to valid selector.
const std::string& EventSelectorDataStream::selectorType ( ) const
inline

Retrieve event selector type.

Definition at line 103 of file EventSelectorDataStream.h.

103  {
104  return m_selectorType;
105  }
std::string m_selectorType
Event selector type.
const std::string& EventSelectorDataStream::selectorType ( ) const
inline

Retrieve event selector type.

Definition at line 103 of file EventSelectorDataStream.h.

103  {
104  return m_selectorType;
105  }
std::string m_selectorType
Event selector type.
void EventSelectorDataStream::setSelector ( IEvtSelector pSelector)
virtual

Attach event selector object.

Definition at line 43 of file EventSelectorDataStream.cpp.

43  {
44  m_pSelector = pSelector;
45 }
SmartIF< IEvtSelector > m_pSelector
Pointer to valid selector.
virtual void EventSelectorDataStream::setSelector ( IEvtSelector pSelector)
virtual

Attach event selector object.

Friends And Related Function Documentation

MsgStream& operator<< ( MsgStream s,
const EventSelectorDataStream obj 
)
friend

Output friend for MsgStream.

Definition at line 27 of file EventSelectorDataStream.cpp.

27  {
28  return s << "Stream:" << obj.name() << " Def:" << obj.definition();
29 }
const std::string & name() const
Retrieve stream name.
const std::string & definition() const
Retrieve definition string.
MsgStream& operator<< ( MsgStream s,
const EventSelectorDataStream obj 
)
friend

Output friend for MsgStream.

Definition at line 27 of file EventSelectorDataStream.cpp.

27  {
28  return s << "Stream:" << obj.name() << " Def:" << obj.definition();
29 }
const std::string & name() const
Retrieve stream name.
const std::string & definition() const
Retrieve definition string.
std::ostream& operator<< ( std::ostream &  s,
const EventSelectorDataStream obj 
)
friend

Output friend for standard I/O.

Definition at line 32 of file EventSelectorDataStream.cpp.

32  {
33  return s << "Stream:" << obj.name() << " Def:" << obj.definition();
34 }
const std::string & name() const
Retrieve stream name.
const std::string & definition() const
Retrieve definition string.
string s
Definition: gaudirun.py:245
std::ostream& operator<< ( std::ostream &  s,
const EventSelectorDataStream obj 
)
friend

Output friend for standard I/O.

Definition at line 32 of file EventSelectorDataStream.cpp.

32  {
33  return s << "Stream:" << obj.name() << " Def:" << obj.definition();
34 }
const std::string & name() const
Retrieve stream name.
const std::string & definition() const
Retrieve definition string.
string s
Definition: gaudirun.py:245

Member Data Documentation

std::string EventSelectorDataStream::m_criteria
protected

Criteria.

Definition at line 58 of file EventSelectorDataStream.h.

std::string EventSelectorDataStream::m_dbName
protected

String with name of the db as parsed.

Definition at line 60 of file EventSelectorDataStream.h.

std::string EventSelectorDataStream::m_definition
protected

Definition string.

Definition at line 56 of file EventSelectorDataStream.h.

bool EventSelectorDataStream::m_initialized = false
protected

Initialization state.

Definition at line 70 of file EventSelectorDataStream.h.

std::string EventSelectorDataStream::m_name
protected

Name.

Definition at line 54 of file EventSelectorDataStream.h.

Properties EventSelectorDataStream::m_properties
protected

Properties vector.

Definition at line 68 of file EventSelectorDataStream.h.

SmartIF< IEvtSelector > EventSelectorDataStream::m_pSelector
protected

Pointer to valid selector.

Definition at line 64 of file EventSelectorDataStream.h.

ISvcLocator * EventSelectorDataStream::m_pSvcLocator
protected

Reference to service locator.

Definition at line 66 of file EventSelectorDataStream.h.

std::string EventSelectorDataStream::m_selectorType
protected

Event selector type.

Definition at line 62 of file EventSelectorDataStream.h.


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