PSEvt::Event Class Reference
[PSEvt package]

Class which manages event data in psana framework. More...

#include <Event.h>

List of all members.

Public Member Functions

 Event (const boost::shared_ptr< ProxyDictI > &dict)
 Standard constructor takes proxy dictionary object.
 ~Event ()
template<typename T>
void putProxy (const boost::shared_ptr< Proxy< T > > &proxy, const std::string &key=std::string())
 Add one more proxy object to the event.
template<typename T>
void putProxy (const boost::shared_ptr< Proxy< T > > &proxy, const Pds::Src &source, const std::string &key=std::string())
 Add one more proxy object to the event.
template<typename T>
void put (const boost::shared_ptr< T > &data, const std::string &key=std::string())
 Add one more object to the event.
template<typename T>
void put (const boost::shared_ptr< T > &data, const Pds::Src &source, const std::string &key=std::string())
 Add one more object to the event.
GetResultProxy get (const std::string &key=std::string())
 Get an object from event.
GetResultProxy get (const Pds::Src &source, const std::string &key=std::string(), Pds::Src *foundSrc=0)
 Get an object from event.
GetResultProxy get (const Source &source, const std::string &key=std::string(), Pds::Src *foundSrc=0)
 Get an object from event.
template<typename T>
bool exists (const std::string &key=std::string())
 Check if object (or proxy) of given type exists in the event.
template<typename T>
bool exists (const Pds::Src &source, const std::string &key=std::string())
 Check if object (or proxy) of given type exists in the event.
template<typename T>
bool remove (const std::string &key=std::string())
 Remove object of given type from the event.
template<typename T>
bool remove (const Pds::Src &source, const std::string &key=std::string())
 Remove object of given type from the event.
std::list< EventKeykeys (const Source &source=Source()) const
 Get the list of event keys defined in event matching given source.
const boost::shared_ptr< ProxyDictI > & proxyDict () const
 Get access to proxy dictionary.

Classes

struct  GetResultProxy
 Special class used for type-less return from get(). More...


Detailed Description

Class which manages event data in psana framework.

This class is a user-friendly interface to proxy dictionary object. It provides a number of put() and get() methods to store/retrieve arbitrarily typed data.

This software was developed for the LCLS project. If you use all or part of it, please give an appropriate acknowledgment.

See also:
ProxyDictI
Version:
$Id: Event.h 8071 2014-04-29 17:39:40Z davidsch@SLAC.STANFORD.EDU $
Author:
Andrei Salnikov

Definition at line 85 of file Event.h.


Constructor & Destructor Documentation

PSEvt::Event::Event ( const boost::shared_ptr< ProxyDictI > &  dict  )  [inline, explicit]

Standard constructor takes proxy dictionary object.

Parameters:
[in] dict Pointer to proxy dictionary

Definition at line 122 of file Event.h.

PSEvt::Event::~Event (  )  [inline]

Definition at line 125 of file Event.h.


Member Function Documentation

template<typename T>
bool PSEvt::Event::exists ( const Pds::Src &  source,
const std::string &  key = std::string() 
) [inline]

Check if object (or proxy) of given type exists in the event.

This is optimized version of get() which only checks whether the proxy is there but does not ask proxy to do any real work. It is not guaranteed that get() will return any data even if exists() returns true, proxy may decide that its corresponding data does not exits.

Parameters:
[in] source Source detector address.
[in] key Optional key to distinguish different objects of the same type.
Returns:
true if object or proxy exists

Definition at line 293 of file Event.h.

template<typename T>
bool PSEvt::Event::exists ( const std::string &  key = std::string()  )  [inline]

Check if object (or proxy) of given type exists in the event.

This is optimized version of get() which only checks whether the proxy is there but does not ask proxy to do any real work. It is not guaranteed that get() will return any data even if exists() returns true, proxy may decide that its corresponding data does not exits.

Parameters:
[in] key Optional key to distinguish different objects of the same type.
Returns:
true if object or proxy exists

Definition at line 274 of file Event.h.

GetResultProxy PSEvt::Event::get ( const Source source,
const std::string &  key = std::string(),
Pds::Src *  foundSrc = 0 
) [inline]

Get an object from event.

Find and return data object which was produced by device. This method accepts Source object which allows approximate specification of the device addresses. If specified address matches more than one device in the event then one arbitrary object is returned. The foundSrc argument can be used to obtain exact address of a returned object.

Parameters:
[in] source Source detector address.
[in] key Optional key to distinguish different objects of the same type.
[out] foundSrc If pointer is non-zero then pointed object will be assigned with the exact source address of the returned object.
Returns:
Shared pointer which can be zero if object not found.

Definition at line 256 of file Event.h.

GetResultProxy PSEvt::Event::get ( const Pds::Src &  source,
const std::string &  key = std::string(),
Pds::Src *  foundSrc = 0 
) [inline]

Get an object from event.

Find and return data object which was produced by specific device. Device is specified as a source object of type Pds::Src. This overloaded function should be used if the source is known exactly, for example when Pds::Src object is returned via foundSrc pointer from previous call to get() method.

Parameters:
[in] source Source detector address.
[in] key Optional key to distinguish different objects of the same type.
[out] foundSrc If pointer is non-zero then pointed object will be assigned with the exact source address of the returned object (must be the same as source)
Returns:
Shared pointer which can be zero if object not found.

Definition at line 235 of file Event.h.

GetResultProxy PSEvt::Event::get ( const std::string &  key = std::string()  )  [inline]

Get an object from event.

This method finds and returns object in an event which is not associated with any detector device (this is why it does not have source argument). It can be used for example to obtain EventId object or other similar types of data.

Note that if you pass an std::string to get() then this method will be called even if string may look like device address. Always use Source class as an argument to get() to locate detector data.

Parameters:
[in] key Optional key to distinguish different objects of the same type.
Returns:
Shared pointer which can be zero if object not found.

Definition at line 214 of file Event.h.

References PSEvt::Source::null.

std::list<EventKey> PSEvt::Event::keys ( const Source source = Source()  )  const [inline]

Get the list of event keys defined in event matching given source.

Parameters:
[in] source matching source address
Returns:
list of the EventKey objects

Definition at line 334 of file Event.h.

const boost::shared_ptr<ProxyDictI>& PSEvt::Event::proxyDict (  )  const [inline]

Get access to proxy dictionary.

This method exposes underlying proxy dictionary object. It should not be used by ordinary clients but it could be useful for code which implements additional services based on event (such as Python wrappers).

Definition at line 349 of file Event.h.

template<typename T>
void PSEvt::Event::put ( const boost::shared_ptr< T > &  data,
const Pds::Src &  source,
const std::string &  key = std::string() 
) [inline]

Add one more object to the event.

Parameters:
[in] data Object to store in the event.
[in] source Source detector address.
[in] key Optional key to distinguish different objects of the same type.
Exceptions:
ExceptionDuplicateKey 
ExceptionNoAliasMap 

Definition at line 190 of file Event.h.

template<typename T>
void PSEvt::Event::put ( const boost::shared_ptr< T > &  data,
const std::string &  key = std::string() 
) [inline]

Add one more object to the event.

Parameters:
[in] data Object to store in the event.
[in] key Optional key to distinguish different objects of the same type.
Exceptions:
ExceptionDuplicateKey 
ExceptionNoAliasMap 

Definition at line 172 of file Event.h.

References PSEvt::EventKey::noSource().

template<typename T>
void PSEvt::Event::putProxy ( const boost::shared_ptr< Proxy< T > > &  proxy,
const Pds::Src &  source,
const std::string &  key = std::string() 
) [inline]

Add one more proxy object to the event.

Parameters:
[in] proxy Proxy object for type T.
[in] source Source detector address.
[in] key Optional key to distinguish different objects of the same type.
Exceptions:
ExceptionDuplicateKey 
ExceptionNoAliasMap 

Definition at line 154 of file Event.h.

template<typename T>
void PSEvt::Event::putProxy ( const boost::shared_ptr< Proxy< T > > &  proxy,
const std::string &  key = std::string() 
) [inline]

Add one more proxy object to the event.

Parameters:
[in] proxy Proxy object for type T.
[in] key Optional key to distinguish different objects of the same type.
Exceptions:
ExceptionDuplicateKey 
ExceptionNoAliasMap 

Definition at line 137 of file Event.h.

References PSEvt::EventKey::noSource().

template<typename T>
bool PSEvt::Event::remove ( const Pds::Src &  source,
const std::string &  key = std::string() 
) [inline]

Remove object of given type from the event.

Parameters:
[in] source Source detector address.
[in] key Optional key to distinguish different objects of the same type.
Returns:
false if object did not exist before this call

Definition at line 321 of file Event.h.

template<typename T>
bool PSEvt::Event::remove ( const std::string &  key = std::string()  )  [inline]

Remove object of given type from the event.

Parameters:
[in] key Optional key to distinguish different objects of the same type.
Returns:
false if object did not exist before this call

Definition at line 307 of file Event.h.


The documentation for this class was generated from the following file:
Generated on 19 Dec 2016 for PSANAclasses by  doxygen 1.4.7