JANA2
|
Public Types | |
using | IteratorType = typename std::vector< T * >::const_iterator |
using | PairType = std::pair< IteratorType, IteratorType > |
Public Types inherited from JFactory | |
enum | JFactory_Flags_t { JFACTORY_NULL = 0x00, PERSISTENT = 0x01, WRITE_TO_OUTPUT = 0x02, NOT_OBJECT_OWNER = 0x04 } |
Public Member Functions | |
JFactoryT (const std::string &aName=JTypeInfo::demangle< T >(), const std::string &aTag="") | |
void | Init () override |
void | ChangeRun (const std::shared_ptr< const JEvent > &aEvent) override |
void | Process (const std::shared_ptr< const JEvent > &aEvent) override |
std::type_index | GetObjectType (void) const override |
PairType | GetOrCreate (const std::shared_ptr< const JEvent > &event, JApplication *app, uint64_t run_number) |
GetOrCreate handles all the preconditions and postconditions involved in calling the user-defined Open(), ChangeRun(), and Process() methods. More... | |
void | Set (std::vector< JObject * > &aData) override |
Please use the typed setters instead whenever possible. | |
void | Insert (JObject *aDatum) override |
Please use the typed setters instead whenever possible. | |
void | Set (const std::vector< T * > &aData) |
void | Set (std::vector< T * > &&aData) |
void | Insert (T *aDatum) |
template<typename S > | |
void | EnableGetAs () |
EnableGetAs generates a vtable entry so that users may extract the contents of this JFactoryT from the type-erased JFactory. More... | |
void | ClearData () override |
void | SetMetadata (JMetadata< T > metadata) |
Set the JFactory's metadata. More... | |
JMetadata< T > | GetMetadata () |
Get the JFactory's metadata. More... | |
Public Member Functions inherited from JFactory | |
JFactory (std::string aName, std::string aTag="") | |
std::string | GetName () const |
std::string | GetTag () const |
uint32_t | GetPreviousRunNumber (void) const |
void | SetPreviousRunNumber (uint32_t aRunNumber) |
uint32_t | GetFactoryFlags (void) |
Get all flags in the form of a single word. | |
void | SetFactoryFlag (JFactory_Flags_t f) |
Set a flag (or flags) | |
void | ClearFactoryFlag (JFactory_Flags_t f) |
Clear a flag (or flags) | |
bool | TestFactoryFlag (JFactory_Flags_t f) |
Test if a flag (or set of flags) is set. | |
template<typename T > | |
void | Set (std::vector< T * > &items) |
template<typename S > | |
std::vector< S * > | GetAs () |
Access the encapsulated data, performing an upcast if necessary. More... | |
void | SetApplication (JApplication *app) |
JApplication setter. This is meant to be used under the hood. | |
JApplication * | GetApplication () |
JApplication getter. More... | |
Protected Attributes | |
std::vector< T * > | mData |
JMetadata< T > | mMetadata |
Protected Attributes inherited from JFactory | |
std::string | mPluginName |
std::string | mFactoryName |
std::string | mObjectName |
std::string | mTag |
uint32_t | mFlags = 0 |
uint32_t | mPreviousRunNumber = -1 |
JApplication * | mApp = nullptr |
std::unordered_map< std::type_index, void * > | mUpcastVTable |
Status | mStatus = Status::Uninitialized |
std::mutex | mMutex |
std::once_flag | mInitFlag |
Additional Inherited Members | |
Protected Types inherited from JFactory | |
enum | Status { Uninitialized, Unprocessed, Processed, Inserted } |
EnableGetAs generates a vtable entry so that users may extract the contents of this JFactoryT from the type-erased JFactory.
The user has to manually specify which upcasts to allow, and they have to do so for each instance. It is recommended to do so in the constructor. Note that EnableGetAs<T>() is called automatically.
|
inline |
GetOrCreate handles all the preconditions and postconditions involved in calling the user-defined Open(), ChangeRun(), and Process() methods.
These include making sure the JFactory JApplication is set, Init() is called exactly once, exceptions are tagged with the originating plugin and eventsource, ChangeRun() is called if and only if the run number changes, etc.