EventSelectorDataStream Class Reference

Definition of class EventSelectorDataStream. More...

#include </scratch/z5/marcocle/GaudiDocs/lhcb-release/825/GAUDI/GAUDI_v26r3/InstallArea/x86_64-slc6-gcc48-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 implements1< IInterface >
typedef implements1 base_class
 Typedef to this class. More...
 
typedef implements1 base_class
 Typedef to this class. More...
 
typedef extend_interfaces1< IInterfaceextend_interfaces_base
 Typedef to the base of this class. More...
 
typedef extend_interfaces1< IInterfaceextend_interfaces_base
 Typedef to the base of this class. More...
 
typedef extend_interfaces_base::ext_iids interfaces
 MPL set of all the implemented interfaces. More...
 
typedef extend_interfaces_base::ext_iids interfaces
 MPL set of all the implemented interfaces. More...
 
- Public Types inherited from extend_interfaces1< IInterface >
typedef IInterface::iid::iids::type ext_iids
 MPL set of interfaces extended by this one. More...
 
typedef IInterface::iid::iids::type ext_iids
 MPL set of interfaces extended by this one. More...
 
- Public Types inherited from IInterface
enum  Status {
  SUCCESS = 1, NO_INTERFACE, VERSMISMATCH, LAST_ERROR,
  SUCCESS = 1, NO_INTERFACE, VERSMISMATCH, LAST_ERROR
}
 Return status. More...
 
enum  Status {
  SUCCESS = 1, NO_INTERFACE, VERSMISMATCH, LAST_ERROR,
  SUCCESS = 1, NO_INTERFACE, VERSMISMATCH, LAST_ERROR
}
 Return status. More...
 
typedef Gaudi::InterfaceId< IInterface, 0, 0 > iid
 Interface ID. More...
 
typedef mpl::set1< iidext_iids
 Extra interfaces. More...
 
typedef Gaudi::InterfaceId< IInterface, 0, 0 > iid
 Interface ID. More...
 
typedef mpl::set1< iidext_iids
 Extra interfaces. More...
 

Public Member Functions

 EventSelectorDataStream (const std::string &nam, const 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 (const std::string &nam, const 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 extend_interfaces1< IInterface >
virtual ~extend_interfaces1 ()
 Virtual destructor. More...
 
virtual ~extend_interfaces1 ()
 Virtual destructor. More...
 
- Public Member Functions inherited from IInterface
virtual void * i_cast (const InterfaceID &) const =0
 main cast function More...
 
virtual std::vector< std::string > getInterfaceNames () const =0
 Returns a vector of strings containing the names of all the implemented interfaces. More...
 
virtual unsigned long addRef ()=0
 Increment the reference count of Interface instance. More...
 
virtual unsigned long release ()=0
 Release Interface instance. More...
 
virtual unsigned long refCount () const =0
 Current reference count. More...
 
virtual StatusCode queryInterface (const InterfaceID &ti, void **pp)=0
 Set the void** to the pointer to the requested interface of the instance. More...
 
virtual ~IInterface ()
 Virtual destructor. More...
 
virtual void * i_cast (const InterfaceID &) const =0
 main cast function More...
 
virtual std::vector< std::string > getInterfaceNames () const =0
 Returns a vector of strings containing the names of all the implemented interfaces. More...
 
virtual unsigned long addRef ()=0
 Increment the reference count of Interface instance. More...
 
virtual unsigned long release ()=0
 Release Interface instance. More...
 
virtual unsigned long refCount () const =0
 Current reference count. More...
 
virtual StatusCode queryInterface (const InterfaceID &ti, void **pp)=0
 Set the void** to the pointer to the requested interface of the instance. More...
 
virtual ~IInterface ()
 Virtual destructor. More...
 

Protected Member Functions

virtual ~EventSelectorDataStream ()
 Standard Destructor. More...
 
virtual ~EventSelectorDataStream ()
 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...
 
IEvtSelectorm_pSelector
 Pointer to valid selector. More...
 
ISvcLocatorm_pSvcLocator
 Reference to service locator. More...
 
Propertiesm_properties
 Properties vector. More...
 
bool m_initialized
 Initialization state. 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...
 

Additional Inherited Members

- Static Public Member Functions inherited from IInterface
static const InterfaceIDinterfaceID ()
 Return an instance of InterfaceID identifying the interface. More...
 
static const InterfaceIDinterfaceID ()
 Return an instance of InterfaceID identifying the interface. 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

EventSelectorDataStream::~EventSelectorDataStream ( )
protectedvirtual

Standard Destructor.

Definition at line 50 of file EventSelectorDataStream.cpp.

50  {
51  setSelector(0);
52  delete m_properties;
53 }
Properties * m_properties
Properties vector.
virtual void setSelector(IEvtSelector *pSelector)
Attach event selector object.
EventSelectorDataStream::EventSelectorDataStream ( const std::string &  nam,
const std::string &  def,
ISvcLocator svcloc 
)

Standard Constructor.

Definition at line 39 of file EventSelectorDataStream.cpp.

40 : m_pSelector(0),
41  m_pSvcLocator(svcloc)
42 {
43  m_name = nam;
44  m_definition = def;
45  m_initialized = false;
46  m_properties = new Properties();
47 }
bool m_initialized
Initialization state.
Properties * m_properties
Properties vector.
ISvcLocator * m_pSvcLocator
Reference to service locator.
std::vector< StringProperty > Properties
IEvtSelector * m_pSelector
Pointer to valid selector.
std::string m_definition
Definition string.
virtual EventSelectorDataStream::~EventSelectorDataStream ( )
protectedvirtual

Standard Destructor.

EventSelectorDataStream::EventSelectorDataStream ( const std::string &  nam,
const 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 218 of file EventSelectorDataStream.cpp.

218  {
219  setSelector(0);
220  if ( m_properties ) {
221  m_properties->clear();
222  }
223  m_initialized = false;
224  return StatusCode::SUCCESS;
225 }
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 83 of file EventSelectorDataStream.cpp.

83  {
84  bool isData = true;
85  std::string auth, dbtyp, collsvc, item, crit, sel, svc, stmt;
86  std::string cnt = "/Event";
87  std::string db = "<Unknown>";
88 
89  SmartIF<IDataManagerSvc> eds(m_pSvcLocator->service("EventDataSvc"));
90  if( !eds.isValid() ) {
91  std::cout << "ERROR: Unable to localize interface IDataManagerSvc from service EventDataSvc"
92  << std::endl;
93  return StatusCode::FAILURE;
94  }
95  else {
96  cnt = eds->rootName();
97  }
99  m_properties->erase(m_properties->begin(), m_properties->end());
100 
101  using Parser = Gaudi::Utils::AttribStringParser;
102  for (auto attrib: Parser(m_definition)) {
103  long hash = -1;
104  switch( ::toupper(attrib.tag[0]) ) {
105  case 'A':
106  auth = std::move(attrib.value);
107  break;
108  case 'C':
109  svc = "EvtTupleSvc";
110  isData = false;
111  /* no break */
112  case 'E':
113  hash = attrib.value.find('#');
114  if ( hash > 0 ) {
115  cnt = attrib.value.substr(0, hash);
116  item = attrib.value.substr(hash + 1);
117  }
118  else {
119  cnt = std::move(attrib.value);
120  item = "Address";
121  }
122  break;
123  case 'D':
124  m_criteria = "FILE " + attrib.value;
125  m_dbName = std::move(attrib.value);
126  break;
127  case 'F':
128  switch( ::toupper(attrib.tag[1]) ) {
129  case 'I':
130  m_criteria = "FILE " + attrib.value;
131  m_dbName = std::move(attrib.value);
132  break;
133  case 'U':
134  stmt = std::move(attrib.value);
135  break;
136  default:
137  break;
138  }
139  break;
140  case 'J':
141  m_criteria = "JOBID " + attrib.value;
142  m_dbName = std::move(attrib.value);
143  dbtyp = "SICB";
144  break;
145  case 'T':
146  switch( ::toupper(attrib.tag[1]) ) {
147  case 'Y':
148  dbtyp = std::move(attrib.value);
149  break;
150  default:
151  break;
152  }
153  break;
154  case 'S':
155  switch( ::toupper(attrib.tag[1]) ) {
156  case 'E':
157  sel = std::move(attrib.value);
158  break;
159  case 'V':
160  svc = std::move(attrib.value);
161  collsvc = svc;
162  break;
163  default:
164  break;
165  }
166  break;
167  default:
168  m_properties->push_back(StringProperty(attrib.tag, attrib.value));
169  break;
170  }
171  }
172  if ( !isData ) { // Unfortunately options do not come in order...
173  m_selectorType = "EventCollectionSelector";
174  svc = "EvtTupleSvc";
175  }
176  else if ( dbtyp.substr(0,4) == "POOL" ) {
177  m_selectorType = "PoolDbEvtSelector";
178  }
179  else if ( svc.empty() ) {
180  m_selectorType = "DbEvtSelector";
181  }
182  else {
183  m_selectorType = svc;
184  }
186  if ( svc.length() == 0 && dbtyp.length() != 0 ) {
187  SmartIF<IPersistencySvc> ipers(m_pSvcLocator->service("EventPersistencySvc"));
188  if ( ipers.isValid() ) {
189  IConversionSvc* icnvSvc = 0;
190  status = ipers->getService(dbtyp, icnvSvc);
191  if ( status.isSuccess() ) {
192  IService* isvc = 0;
193  status = icnvSvc->queryInterface(IService::interfaceID(), pp_cast<void>(&isvc));
194  if ( status.isSuccess() ) {
195  svc = isvc->name();
196  isvc->release();
197  }
198  }
199  }
200  }
201  m_properties->push_back( StringProperty("Function", stmt));
202  m_properties->push_back( StringProperty("CnvService", svc));
203  m_properties->push_back( StringProperty("Authentication",auth));
204  m_properties->push_back( StringProperty("Container", cnt));
205  m_properties->push_back( StringProperty("Item", item));
206  m_properties->push_back( StringProperty("Criteria", sel));
207  m_properties->push_back( StringProperty("DbType", dbtyp));
208  m_properties->push_back( StringProperty("DB", m_criteria));
209  if ( !isData && !collsvc.empty() ) {
210  m_properties->push_back( StringProperty("DbService", collsvc));
211  }
212 
213  m_initialized = status.isSuccess();
214  return status;
215 }
bool m_initialized
Initialization state.
Properties * m_properties
Properties vector.
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:75
std::string m_criteria
Criteria.
std::string m_selectorType
Event selector type.
virtual const std::string & name() const =0
Retrieve the name of the instance.
StatusCode service(const Gaudi::Utils::TypeNameString &name, T *&svc, bool createIf=true)
Templated method to access a service by name.
Definition: ISvcLocator.h:82
ISvcLocator * m_pSvcLocator
Reference to service locator.
General service interface definition.
Definition: IService.h:19
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
SimpleProperty< std::string > StringProperty
Definition: Property.h:743
std::string m_definition
Definition string.
virtual unsigned long release()=0
Release Interface instance.
tuple item
print s1,s2
Definition: ana.py:146
std::string m_dbName
String with name of the db as parsed.
static const InterfaceID & interfaceID()
Return an instance of InterfaceID identifying the interface.
Definition: IInterface.h:171
void toupper(std::string &s)
virtual StatusCode queryInterface(const InterfaceID &ti, void **pp)=0
Set the void** to the pointer to the requested interface of the instance.
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 63 of file EventSelectorDataStream.cpp.

63  {
64  for ( Properties::iterator i = m_properties->begin(); i != m_properties->end(); i++ ) {
65  if ( (*i).name() == nam ) {
66  return &(*i);
67  }
68  }
69  return 0;
70 }
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 73 of file EventSelectorDataStream.cpp.

73  {
74  for ( Properties::const_iterator i = m_properties->begin(); i != m_properties->end(); i++ ) {
75  if ( (*i).name() == nam ) {
76  return &(*i);
77  }
78  }
79  return 0;
80 }
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;
113  }
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;
113  }
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 56 of file EventSelectorDataStream.cpp.

56  {
57  if ( 0 != pSelector ) pSelector->addRef();
58  if ( 0 != m_pSelector ) m_pSelector->release();
59  m_pSelector = pSelector;
60 }
IEvtSelector * m_pSelector
Pointer to valid selector.
virtual unsigned long release()=0
Release Interface instance.
virtual unsigned long addRef()=0
Increment the reference count of Interface instance.
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  s << "Stream:" << obj.name() << " Def:" << obj.definition();
29  return s;
30 }
const std::string & name() const
Retrieve stream name.
const std::string & definition() const
Retrieve definition string.
string s
Definition: gaudirun.py:244
MsgStream& operator<< ( MsgStream s,
const EventSelectorDataStream obj 
)
friend

Output friend for MsgStream.

Definition at line 27 of file EventSelectorDataStream.cpp.

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

Output friend for standard I/O.

Definition at line 33 of file EventSelectorDataStream.cpp.

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

Output friend for standard I/O.

Definition at line 33 of file EventSelectorDataStream.cpp.

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

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
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.

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: