DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
ConfigurationPointer.hpp
Go to the documentation of this file.
1//
2// DUNE DAQ modification notice:
3// This file has been modified from the original ATLAS config source for the DUNE DAQ project.
4// Fork baseline commit: 67a24e731 (2022-10-27).
5// Renamed since fork: yes (from config/ConfigurationPointer.h to include/conffwk/ConfigurationPointer.hpp).
6//
7
14
15#ifndef PYTHONCONFIGURATION_H
16#define PYTHONCONFIGURATION_H
17
19#include <boost/shared_ptr.hpp>
20
21namespace dunedaq {
22namespace conffwk {
23
24namespace python {
25
32{
33
34public:
37 : m_shared()
38 , m_pointer(0)
39 {
40 }
41
43 ConfigurationPointer(const std::string& s)
44 : m_shared(new Configuration(s))
45 , m_pointer(0)
46 {
47 }
48
51 : m_shared()
52 , m_pointer(&const_cast<Configuration&>(p))
53 {
54 }
55
58 : m_shared(other.m_shared)
59 , m_pointer(const_cast<ConfigurationPointer&>(other).m_pointer)
60 {
61 }
62
65 {
66 m_shared = other.m_shared;
67 m_pointer = const_cast<ConfigurationPointer&>(other).m_pointer;
68 return *this;
69 }
70
73
76
79
81 Configuration* get() { return (m_pointer) ? m_pointer : m_shared.get(); }
82
83private:
84 boost::shared_ptr<Configuration> m_shared; // self-initialized Configuration
85 Configuration* m_pointer; // user initialized Configuration
86};
87
88}
89} // namespace conffwk
90} // namespace dunedaq
91
92#endif /* PYTHONCONFIGURATION_H */
Defines base class for cache of template objects.
Configuration * operator->()
Let python bindings access the configuration pointer.
ConfigurationPointer(const ConfigurationPointer &other)
Copying, is shallow. Don't do this at home...
ConfigurationPointer & operator=(const ConfigurationPointer &other)
Assignment is shallow.
ConfigurationPointer(const Configuration &p)
Constructor when the user initializes from C++. In this case, the pointed configuration should never ...
Configuration & operator*()
Another way to access the configuration pointer.
ConfigurationPointer(const std::string &s)
Constructor when the user initializes from within python.
virtual ~ConfigurationPointer()
Destructor. If started from string, destroy if the last instance, otherwise, doesn't do anything at a...
Configuration * get()
Get the configuration pointer.
conffwk entry point
The DUNE-DAQ namespace.