DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
dunedaq::conffwk::python::ConfigurationPointer Class Reference

#include <ConfigurationPointer.hpp>

Collaboration diagram for dunedaq::conffwk::python::ConfigurationPointer:
[legend]

Public Member Functions

 ConfigurationPointer ()
 Default.
 
 ConfigurationPointer (const std::string &s)
 Constructor when the user initializes from within python.
 
 ConfigurationPointer (const Configuration &p)
 Constructor when the user initializes from C++. In this case, the pointed configuration should never be deleted.
 
 ConfigurationPointer (const ConfigurationPointer &other)
 Copying, is shallow. Don't do this at home...
 
ConfigurationPointeroperator= (const ConfigurationPointer &other)
 Assignment is shallow.
 
virtual ~ConfigurationPointer ()
 Destructor. If started from string, destroy if the last instance, otherwise, doesn't do anything at all.
 
Configurationoperator-> ()
 Let python bindings access the configuration pointer.
 
Configurationoperator* ()
 Another way to access the configuration pointer.
 
Configurationget ()
 Get the configuration pointer.
 

Private Attributes

boost::shared_ptr< Configurationm_shared
 
Configurationm_pointer
 

Detailed Description

Use this class only when you want to bridge your C++ code with python. It implements some weird reference counted pointer which helps a clean API for the python bindings and the DBE

Definition at line 24 of file ConfigurationPointer.hpp.

Constructor & Destructor Documentation

◆ ConfigurationPointer() [1/4]

dunedaq::conffwk::python::ConfigurationPointer::ConfigurationPointer ( )
inline

Default.

Definition at line 28 of file ConfigurationPointer.hpp.

◆ ConfigurationPointer() [2/4]

dunedaq::conffwk::python::ConfigurationPointer::ConfigurationPointer ( const std::string & s)
inline

Constructor when the user initializes from within python.

Definition at line 31 of file ConfigurationPointer.hpp.

32 : m_shared(new Configuration(s)), m_pointer(0) {}

◆ ConfigurationPointer() [3/4]

dunedaq::conffwk::python::ConfigurationPointer::ConfigurationPointer ( const Configuration & p)
inline

Constructor when the user initializes from C++. In this case, the pointed configuration should never be deleted.

Definition at line 35 of file ConfigurationPointer.hpp.

36 : m_shared(),
37 m_pointer(&const_cast<Configuration&>(p)) {}

◆ ConfigurationPointer() [4/4]

dunedaq::conffwk::python::ConfigurationPointer::ConfigurationPointer ( const ConfigurationPointer & other)
inline

Copying, is shallow. Don't do this at home...

Definition at line 40 of file ConfigurationPointer.hpp.

41 : m_shared(other.m_shared),
42 m_pointer(const_cast<ConfigurationPointer&>(other).m_pointer) {}

◆ ~ConfigurationPointer()

virtual dunedaq::conffwk::python::ConfigurationPointer::~ConfigurationPointer ( )
inlinevirtual

Destructor. If started from string, destroy if the last instance, otherwise, doesn't do anything at all.

Definition at line 53 of file ConfigurationPointer.hpp.

53{}

Member Function Documentation

◆ get()

Configuration * dunedaq::conffwk::python::ConfigurationPointer::get ( )
inline

Get the configuration pointer.

Definition at line 62 of file ConfigurationPointer.hpp.

62{ return (m_pointer)?m_pointer:m_shared.get(); }
void get(const std::string &class_name, const std::string &id, ConfigObject &object, unsigned long rlevel=0, const std::vector< std::string > *rclasses=0)
Get object by class name and object id (multi-thread safe).

◆ operator*()

Configuration & dunedaq::conffwk::python::ConfigurationPointer::operator* ( )
inline

Another way to access the configuration pointer.

Definition at line 59 of file ConfigurationPointer.hpp.

59{ return (m_pointer)?*m_pointer:*m_shared; }

◆ operator->()

Configuration * dunedaq::conffwk::python::ConfigurationPointer::operator-> ( )
inline

Let python bindings access the configuration pointer.

Definition at line 56 of file ConfigurationPointer.hpp.

56{ return (m_pointer)?m_pointer:m_shared.get(); }

◆ operator=()

ConfigurationPointer & dunedaq::conffwk::python::ConfigurationPointer::operator= ( const ConfigurationPointer & other)
inline

Assignment is shallow.

Definition at line 45 of file ConfigurationPointer.hpp.

46 {
47 m_shared = other.m_shared;
48 m_pointer = const_cast<ConfigurationPointer&>(other).m_pointer;
49 return *this;
50 }

Member Data Documentation

◆ m_pointer

Configuration* dunedaq::conffwk::python::ConfigurationPointer::m_pointer
private

Definition at line 66 of file ConfigurationPointer.hpp.

◆ m_shared

boost::shared_ptr<Configuration> dunedaq::conffwk::python::ConfigurationPointer::m_shared
private

Definition at line 65 of file ConfigurationPointer.hpp.


The documentation for this class was generated from the following file: