All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
EventSelectorDataStream Class Reference

Definition of class EventSelectorDataStream. More...

#include <GaudiKernel/EventSelectorDataStream.h>

Inheritance diagram for EventSelectorDataStream:
Collaboration diagram for EventSelectorDataStream:

Public Types

typedef std::vector
< StringProperty
Properties
 
- Public Types inherited from implements1< IInterface >
typedef implements1 base_class
 Typedef to this class. More...
 
typedef extend_interfaces1
< IInterface
extend_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...
 
- Public Types inherited from extend_interfaces1< IInterface >
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 }
 Return status. 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...
 
- Public Member Functions inherited from extend_interfaces1< IInterface >
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...
 

Protected Member Functions

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

Additional Inherited Members

- Static Public Member Functions inherited from IInterface
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.

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.
IEvtSelector * m_pSelector
Pointer to valid selector.
ISvcLocator * m_pSvcLocator
Reference to service locator.
std::vector< StringProperty > Properties
std::string m_definition
Definition string.
Properties * m_properties
Properties vector.

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::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.
StatusCode EventSelectorDataStream::finalize ( )
virtual

Finalize stream and release resources.

Definition at line 220 of file EventSelectorDataStream.cpp.

220  {
221  setSelector(0);
222  if ( m_properties ) {
223  m_properties->clear();
224  }
225  m_initialized = false;
226  return StatusCode::SUCCESS;
227 }
bool m_initialized
Initialization state.
Properties * m_properties
Properties vector.
virtual void setSelector(IEvtSelector *pSelector)
Attach event selector object.
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  Tokenizer tok(true);
89 
90  SmartIF<IDataManagerSvc> eds(m_pSvcLocator->service("EventDataSvc"));
91  if( !eds.isValid() ) {
92  std::cout << "ERROR: Unable to localize interface IDataManagerSvc from service EventDataSvc"
93  << std::endl;
94  return StatusCode::FAILURE;
95  }
96  else {
97  cnt = eds->rootName();
98  }
100  m_properties->erase(m_properties->begin(), m_properties->end());
101 
102  tok.analyse(m_definition, " ", "", "", "=", "'", "'");
103  for ( Tokenizer::Items::iterator i = tok.items().begin(); i != tok.items().end(); i++ ) {
104  long hash = -1;
105  const std::string& tag = (*i).tag();
106  const std::string& val = (*i).value();
107  switch( ::toupper(tag[0]) ) {
108  case 'A':
109  auth = val;
110  break;
111  case 'C':
112  svc = "EvtTupleSvc";
113  isData = false;
114  case 'E':
115  hash = val.find('#');
116  if ( hash > 0 ) {
117  cnt = val.substr(0,hash);
118  item = val.substr(hash+1, val.length()-hash-1);
119  }
120  else {
121  cnt = val;
122  item = "Address";
123  }
124  break;
125  case 'D':
126  m_criteria = "FILE " + val;
127  m_dbName=val;
128  break;
129  case 'F':
130  switch( ::toupper(tag[1]) ) {
131  case 'I':
132  m_criteria = "FILE " + val;
133  m_dbName=val;
134  break;
135  case 'U':
136  stmt = val;
137  break;
138  default:
139  break;
140  }
141  break;
142  case 'J':
143  m_criteria = "JOBID " + val;
144  m_dbName=val;
145  dbtyp = "SICB";
146  break;
147  case 'T':
148  switch( ::toupper(tag[1]) ) {
149  case 'Y':
150  dbtyp = val;
151  break;
152  default:
153  break;
154  }
155  break;
156  case 'S':
157  switch( ::toupper(tag[1]) ) {
158  case 'E':
159  sel = val;
160  break;
161  case 'V':
162  svc = val;
163  collsvc = val;
164  break;
165  default:
166  break;
167  }
168  break;
169  default:
170  m_properties->push_back(StringProperty(tag,val));
171  break;
172  }
173  }
174  if ( !isData ) { // Unfortunately options do not come in order...
175  m_selectorType = "EventCollectionSelector";
176  svc = "EvtTupleSvc";
177  }
178  else if ( dbtyp.substr(0,4) == "POOL" ) {
179  m_selectorType = "PoolDbEvtSelector";
180  }
181  else if ( svc.empty() ) {
182  m_selectorType = "DbEvtSelector";
183  }
184  else {
185  m_selectorType = svc;
186  }
188  if ( svc.length() == 0 && dbtyp.length() != 0 ) {
189  SmartIF<IPersistencySvc> ipers(m_pSvcLocator->service("EventPersistencySvc"));
190  if ( ipers.isValid() ) {
191  IConversionSvc* icnvSvc = 0;
192  status = ipers->getService(dbtyp, icnvSvc);
193  if ( status.isSuccess() ) {
194  IService* isvc = 0;
195  status = icnvSvc->queryInterface(IService::interfaceID(), pp_cast<void>(&isvc));
196  if ( status.isSuccess() ) {
197  svc = isvc->name();
198  isvc->release();
199  }
200  }
201  }
202  }
203  m_properties->push_back( StringProperty("Function", stmt));
204  m_properties->push_back( StringProperty("CnvService", svc));
205  m_properties->push_back( StringProperty("Authentication",auth));
206  m_properties->push_back( StringProperty("Container", cnt));
207  m_properties->push_back( StringProperty("Item", item));
208  m_properties->push_back( StringProperty("Criteria", sel));
209  m_properties->push_back( StringProperty("DbType", dbtyp));
210  m_properties->push_back( StringProperty("DB", m_criteria));
211  if ( !isData && !collsvc.empty() ) {
212  m_properties->push_back( StringProperty("DbService", collsvc));
213  }
214 
215  m_initialized = status.isSuccess();
216  return status;
217 }
bool m_initialized
Initialization state.
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:62
std::string m_criteria
Criteria.
SimpleProperty< std::string > StringProperty
Definition: Property.h:743
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
STL Include files.
Definition: Tokenizer.h:24
std::string m_definition
Definition string.
virtual unsigned long release()=0
Release Interface instance.
tuple item
print s1,s2
Definition: ana.py:146
Properties * m_properties
Properties vector.
std::string m_dbName
String with name of the db as parsed.
list i
Definition: ana.py:128
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.
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 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.

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

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:210
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:210

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: