Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Additional key that may be provided when storing or retrieving the data from event is used to distinguish between data objects of the same type and address. As an example the raw data that come from XTC file are stored with the default empty key. User algorithm can apply some algorithm to the data and store new version of the same data using non-default key (such as "fixed" or "calibrated").

Event Data

Event data are accessible through the Event object which is the parameter to event() method of the user module. To access the data on needs to use overloaded get() method which can take different number of arguments. There are three different method signatures:

  • get(const std::string& key="", Pds::Src* foundSrc=0)
    This method does not accept data source address argument. It will try to find the data object which was stored without address (such as EventId data which has no corresponding device), otherwise it will return data with any source address.
  • get(const Pds::Src& source, const std::string& key="", Pds::Src* foundSrc=0)
    This method takes an exact data source address in the form of Pds::Src class. This method is occasionally useful and its use is explained above.
  • get(const Source& source, const std::string& key="", Pds::Src* foundSrc=0)
    This method takes an data source address in the form of Source class which is explained above.

All three above methods take an optional string key which is empty by default. Additionally one can provide a pointer to Pds::Src object as the last argument and the pointed object will be filled with the exact source address of the found object.

All three methods return a special object type that is convertible to a pointer to a specific data type. Thanks to this intermediate special object type the user does not need to provide data type as an argument to get() method which simplifies user code. In fact all important work is done during the conversion of this intermediate object to final pointer, and if this conversion does not happen then get() method does not actually do anything. This implies that the code:

Code Block

   Pds::Src src;
   evt.get("AmoITof:Acqiris", "", &src);

does not do anything at all and does not update src object. To make it useful one needs to assign the result of get() to a smart pointer:

Code Block

   Pds::Src src;
   shared_ptr<Acqiris::DataDescV1> acqData = evt.get("AmoITof:Acqiris", "", &src);