#include <Event.h>
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< EventKey > | keys (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... |
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.
Definition at line 85 of file Event.h.
PSEvt::Event::Event | ( | const boost::shared_ptr< ProxyDictI > & | dict | ) | [inline, explicit] |
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.
[in] | source | Source detector address. |
[in] | key | Optional key to distinguish different objects of the same type. |
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.
[in] | key | Optional key to distinguish different objects of the same type. |
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.
[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. |
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.
[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) |
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.
[in] | key | Optional key to distinguish different objects of the same type. |
Definition at line 214 of file Event.h.
References PSEvt::Source::null.
const boost::shared_ptr<ProxyDictI>& PSEvt::Event::proxyDict | ( | ) | const [inline] |
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.
[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. |
ExceptionDuplicateKey | ||
ExceptionNoAliasMap |
void PSEvt::Event::put | ( | const boost::shared_ptr< T > & | data, | |
const std::string & | key = std::string() | |||
) | [inline] |
Add one more object to the event.
[in] | data | Object to store in the event. |
[in] | key | Optional key to distinguish different objects of the same type. |
ExceptionDuplicateKey | ||
ExceptionNoAliasMap |
Definition at line 172 of file Event.h.
References PSEvt::EventKey::noSource().
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.
[in] | proxy | Proxy object for type T. |
[in] | source | Source detector address. |
[in] | key | Optional key to distinguish different objects of the same type. |
ExceptionDuplicateKey | ||
ExceptionNoAliasMap |
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.
[in] | proxy | Proxy object for type T. |
[in] | key | Optional key to distinguish different objects of the same type. |
ExceptionDuplicateKey | ||
ExceptionNoAliasMap |
Definition at line 137 of file Event.h.
References PSEvt::EventKey::noSource().
bool PSEvt::Event::remove | ( | const Pds::Src & | source, | |
const std::string & | key = std::string() | |||
) | [inline] |
bool PSEvt::Event::remove | ( | const std::string & | key = std::string() |
) | [inline] |