PSEnv::EpicsStore Class Reference
[PSEnv package]

Class implementing storage for EPICS data in psana framework. More...

#include <EpicsStore.h>

List of all members.

Public Member Functions

 EpicsStore ()
 ~EpicsStore ()
void store (const boost::shared_ptr< Psana::Epics::EpicsPvHeader > &pv, const Pds::Src &src, const std::string *pvName=NULL, long eventTag=-1)
 Store EPICS PV.
void storeAlias (const Pds::Src &src, int pvId, const std::string &alias)
 Store alias name for EPICS PV.
std::vector< std::string > names () const
 Get the full list of PV names and aliases.
std::vector< std::string > pvNames () const
 Get the list of PV names.
std::vector< std::string > aliases () const
 Get the list of PV aliases.
std::string alias (const std::string &pv) const
 Get alias name for specified PV name.
std::string pvName (const std::string &alias) const
 Get PV name for specified alias name.
EpicsValue value (const std::string &name, int idx=0) const
 Get the value for a given PV or alias name.
void status (const std::string &name, int &status, int &severity, PSTime::Time &time) const
 Get status information for a given PV or alias name.
EpicsPV getPV (const std::string &name) const
 Find EPICS PV given its PV or alias name.
const EpicsStoreImplinternal_implementation () const
 Access implementation object.

Classes

struct  EpicsPV
struct  EpicsValue


Detailed Description

Class implementing storage for EPICS data in psana framework.

The EPICS store keeps track of all current EPICS value during the event loop in the framework. It is updated with the new values whenever new EPICS data is read from the input file.

Epics data is retrieved by specifying a name. The EpicsStore first checks if this name is an alias, if not it is assumed to be a pvName.

When the initial EPICS data is added, the EpicsStore checks for aliases that have the same name as a pvName. These aliases are discared (debug messages are generated for discared aliases). This prevents aliases that hide pv's. A consequence is that users cannot use aliases to swap the names of existing epics pv's.

While the same EPICs pv can come from multiple sources, the EpicsStore does not expose the source to the user in the interface to get EPICs data. When a user gets a pv, the EpicsStore returns the last one stored. When the same TIME pv is coming from two or more sources during the same event, users will generally prefer the one with the latest internal time stamp value. When storing EPICS data, an optional eventId can be passed. EpicsStore will use this to identify TIME pv's from the same event. For multiple pv's from the same event, it will then store the one with the most recent stamp.

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

See also:
Env
Version:
$Id: EpicsStore.h 8341 2014-06-05 21:10:27Z davidsch@SLAC.STANFORD.EDU $
Author:
Andrei Salnikov

Definition at line 81 of file EpicsStore.h.


Constructor & Destructor Documentation

PSEnv::EpicsStore::EpicsStore (  ) 

Definition at line 39 of file EpicsStore.cpp.

PSEnv::EpicsStore::~EpicsStore (  ) 

Definition at line 47 of file EpicsStore.cpp.


Member Function Documentation

std::string PSEnv::EpicsStore::alias ( const std::string &  pv  )  const [inline]

Get alias name for specified PV name.

If specified PV is not found or does not have an alias an empty string is returned.

Definition at line 259 of file EpicsStore.h.

std::vector<std::string> PSEnv::EpicsStore::aliases (  )  const [inline]

Get the list of PV aliases.

Returned list includes the names of all alias names but no PV names.

Definition at line 247 of file EpicsStore.h.

EpicsPV PSEnv::EpicsStore::getPV ( const std::string &  name  )  const [inline]

Find EPICS PV given its PV or alias name.

Parameters:
[in] name PV name
Returns:
Object convertible to shared_ptr<T> where T is one of the epics PV classes.

Definition at line 310 of file EpicsStore.h.

const EpicsStoreImpl& PSEnv::EpicsStore::internal_implementation (  )  const [inline]

Access implementation object.

Do not use this method unless you know what you are doing. This is not supposed to be used by end clients, but may be useful for other services like Python wrappers. The name is intentionally long to make you very uncomfortable using it.

Definition at line 323 of file EpicsStore.h.

std::vector<std::string> PSEnv::EpicsStore::names (  )  const [inline]

Get the full list of PV names and aliases.

Returned list includes the names of all PVs and aliases.

Definition at line 223 of file EpicsStore.h.

std::string PSEnv::EpicsStore::pvName ( const std::string &  alias  )  const [inline]

Get PV name for specified alias name.

If specified alias is not found an empty string is returned.

Definition at line 269 of file EpicsStore.h.

std::vector<std::string> PSEnv::EpicsStore::pvNames (  )  const [inline]

Get the list of PV names.

Returned list includes the names of all PVs but no alias names.

Definition at line 235 of file EpicsStore.h.

void PSEnv::EpicsStore::status ( const std::string &  name,
int &  status,
int &  severity,
PSTime::Time time 
) const [inline]

Get status information for a given PV or alias name.

Parameters:
[in] name PV name
[out] status EPICS status value
[out] severity EPICS severity value
[out] time Time of the last change, can be (0) if time is unknown
Exceptions:
ExceptionEpicsName if the name of the PV is not known

Definition at line 299 of file EpicsStore.h.

void PSEnv::EpicsStore::store ( const boost::shared_ptr< Psana::Epics::EpicsPvHeader > &  pv,
const Pds::Src &  src,
const std::string *  pvName = NULL,
long  eventTag = -1 
) [inline]

Store EPICS PV.

storing a pv first requires identifying the pvName. If this is not stored in the pv header (as with TIME pv's), or it is not passed explicitly through the optional argument pvName, then the pvName will be found using the pvid in the pv header and the source. If no pvName is found (this can happen for damaged data missing configuration events) one will be created based on the src and pvId in the header.

The optional argument eventTag can be set to a value >= 0 to identify TIME pv's from the same event. When store gets a TIME pv that is from the same event as the last one stored, it will only update the internal store if the new pv has a stamp value > than the stamp of the previously stored pv. If eventTag < 0, this check of the stamp values is not made.

Parameters:
[in] pv pv header
[in] src src pv
[in] pvName optional pvName, overrides use of internal mechanism to find pvName based on pvid and src. Note - if passed, this should be a valid pvName consinstent with the data, not an alias.
[in] eventTag optional key for grouping TIME pv's from the same event. If eventTag >=0, it is treated as such a key. Can be a simple counter for identifying events - not related to the EventId of a psana Event.

Definition at line 208 of file EpicsStore.h.

void PSEnv::EpicsStore::storeAlias ( const Pds::Src &  src,
int  pvId,
const std::string &  alias 
) [inline]

Store alias name for EPICS PV.

Definition at line 214 of file EpicsStore.h.

EpicsValue PSEnv::EpicsStore::value ( const std::string &  name,
int  idx = 0 
) const [inline]

Get the value for a given PV or alias name.

Parameters:
[in] name PV name
[in] idx value index (for array PVs)
Returns:
object that is convertible to regular numeric types or std::string.
This method does not throw but conversion from EpicsValue to final type can throw ExceptionEpicsName or ExceptionEpicsConversion.

Definition at line 284 of file EpicsStore.h.


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