DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
dunedaq::confmodel::NetworkConnection Class Reference

#include <NetworkConnection.hpp>

Inheritance diagram for dunedaq::confmodel::NetworkConnection:
[legend]
Collaboration diagram for dunedaq::confmodel::NetworkConnection:
[legend]

Classes

struct  Connection_type
 

Public Member Functions

virtual void print (unsigned int offset, bool print_header, std::ostream &s) const
 Print details of the NetworkConnection object.
 
virtual std::vector< const dunedaq::conffwk::DalObject * > get (const std::string &name, bool upcast_unregistered=true) const
 Get values of relationships and results of some algorithms as a vector of dunedaq::conffwk::DalObject pointers.
 
const std::string & get_connection_type () const
 Get "connection_type" attribute value. Type of the network connection.
 
void set_connection_type (const std::string &value)
 Set "connection_type" attribute value. Type of the network connection.
 
const dunedaq::confmodel::Serviceget_associated_service () const
 Get "associated_service" relationship value. Service provided by this connection.
 
void set_associated_service (const dunedaq::confmodel::Service *value)
 Set "associated_service" relationship value. Service provided by this connection.
 
virtual void print (unsigned int offset, bool print_header, std::ostream &s) const
 Print details of the NetworkConnection object.
 
virtual std::vector< const dunedaq::conffwk::DalObject * > get (const std::string &name, bool upcast_unregistered=true) const
 Get values of relationships and results of some algorithms as a vector of dunedaq::conffwk::DalObject pointers.
 
const std::string & get_connection_type () const
 Get "connection_type" attribute value. Type of the network connection.
 
void set_connection_type (const std::string &value)
 Set "connection_type" attribute value. Type of the network connection.
 
const dunedaq::confmodel::Serviceget_associated_service () const
 Get "associated_service" relationship value. Service provided by this connection.
 
void set_associated_service (const dunedaq::confmodel::Service *value)
 Set "associated_service" relationship value. Service provided by this connection.
 
- Public Member Functions inherited from dunedaq::confmodel::Connection
const std::string & get_data_type () const
 Get "data_type" attribute value. String identifying the data that travel through this connection. This can be used to match up the endpoints of this connection.
 
void set_data_type (const std::string &value)
 Set "data_type" attribute value. String identifying the data that travel through this connection. This can be used to match up the endpoints of this connection.
 
uint32_t get_send_timeout_ms () const
 Get "send_timeout_ms" attribute value. Timeout in ms for sending on this connection.
 
void set_send_timeout_ms (uint32_t value)
 Set "send_timeout_ms" attribute value. Timeout in ms for sending on this connection.
 
uint32_t get_recv_timeout_ms () const
 Get "recv_timeout_ms" attribute value. Timeout in ms for receiving on this connection.
 
void set_recv_timeout_ms (uint32_t value)
 Set "recv_timeout_ms" attribute value. Timeout in ms for receiving on this connection.
 
const std::string & get_data_type () const
 Get "data_type" attribute value. String identifying the data that travel through this connection. This can be used to match up the endpoints of this connection.
 
void set_data_type (const std::string &value)
 Set "data_type" attribute value. String identifying the data that travel through this connection. This can be used to match up the endpoints of this connection.
 
uint32_t get_send_timeout_ms () const
 Get "send_timeout_ms" attribute value. Timeout in ms for sending on this connection.
 
void set_send_timeout_ms (uint32_t value)
 Set "send_timeout_ms" attribute value. Timeout in ms for sending on this connection.
 
uint32_t get_recv_timeout_ms () const
 Get "recv_timeout_ms" attribute value. Timeout in ms for receiving on this connection.
 
void set_recv_timeout_ms (uint32_t value)
 Set "recv_timeout_ms" attribute value. Timeout in ms for receiving on this connection.
 
- Public Member Functions inherited from dunedaq::conffwk::DalObject
const std::string & UID () const noexcept
 
const std::string & class_name () const noexcept
 
bool castable (const std::string &target) const noexcept
 
bool castable (const std::string *target) const noexcept
 
template<class TARGET >
const TARGET * cast () const noexcept
 Casts object to different class.
 
std::string full_name () const noexcept
 
const ConfigObjectconfig_object () const
 
DalRegistryregistry () const noexcept
 
Configurationconfiguration () const noexcept
 
void unread ()
 
void set (const ConfigObject &o) noexcept
 
void move (const std::string &at)
 
void rename (const std::string &new_id)
 
void p_hdr (std::ostream &s, unsigned int indent, const std::string &cl, const char *nm=nullptr) const
 print object headers
 
std::ostream & print_object (std::ostream &s) const
 print object details
 
void throw_init_ex (dunedaq::conffwk::Exception &ex)
 throw object initialisation exception (i.e.
 

Static Public Member Functions

static const std::string & __get_connection_type_str () noexcept
 
static const std::string & __get_associated_service_str () noexcept
 
static const std::string & __get_connection_type_str () noexcept
 
static const std::string & __get_associated_service_str () noexcept
 
- Static Public Member Functions inherited from dunedaq::confmodel::Connection
static const std::string & __get_data_type_str () noexcept
 
static const std::string & __get_send_timeout_ms_str () noexcept
 
static const std::string & __get_recv_timeout_ms_str () noexcept
 
static const std::string & __get_data_type_str () noexcept
 
static const std::string & __get_send_timeout_ms_str () noexcept
 
static const std::string & __get_recv_timeout_ms_str () noexcept
 
- Static Public Member Functions inherited from dunedaq::conffwk::DalObject
static void p_null (std::ostream &s)
 print "(null)"
 
static void p_rm (std::ostream &s)
 print "(deleted object)"
 
static void p_error (std::ostream &s, dunedaq::conffwk::Exception &ex)
 print error text
 
static void throw_get_ex (const std::string &what, const std::string &class_name, const DalObject *obj)
 throw exception in generated get method (i.e.
 
static bool is_null (const DalObject *ref) noexcept
 check a pointer on DAL object is null
 

Static Public Attributes

static const std::string & s_class_name
 
static const std::string s_connection_type = "connection_type"
 
static const std::string s_associated_service = "associated_service"
 
- Static Public Attributes inherited from dunedaq::confmodel::Connection
static const std::string & s_class_name
 
static const std::string s_data_type = "data_type"
 
static const std::string s_send_timeout_ms = "send_timeout_ms"
 
static const std::string s_recv_timeout_ms = "recv_timeout_ms"
 

Protected Member Functions

 NetworkConnection (conffwk::DalRegistry &db, const conffwk::ConfigObject &obj) noexcept
 
virtual ~NetworkConnection () noexcept
 
virtual void init (bool init_children)
 
bool get (const std::string &name, std::vector< const dunedaq::conffwk::DalObject * > &vec, bool upcast_unregistered, bool first_call) const
 
 NetworkConnection (conffwk::DalRegistry &db, const conffwk::ConfigObject &obj) noexcept
 
virtual ~NetworkConnection () noexcept
 
virtual void init (bool init_children)
 
bool get (const std::string &name, std::vector< const dunedaq::conffwk::DalObject * > &vec, bool upcast_unregistered, bool first_call) const
 
- Protected Member Functions inherited from dunedaq::confmodel::Connection
 Connection (conffwk::DalRegistry &db, const conffwk::ConfigObject &obj) noexcept
 
virtual ~Connection () noexcept
 
bool get (const std::string &name, std::vector< const dunedaq::conffwk::DalObject * > &vec, bool upcast_unregistered, bool first_call) const
 
 Connection (conffwk::DalRegistry &db, const conffwk::ConfigObject &obj) noexcept
 
virtual ~Connection () noexcept
 
bool get (const std::string &name, std::vector< const dunedaq::conffwk::DalObject * > &vec, bool upcast_unregistered, bool first_call) const
 
- Protected Member Functions inherited from dunedaq::conffwk::DalObject
 DalObject (DalRegistry &db, const ConfigObject &o) noexcept
 
virtual ~DalObject ()
 
void clear () noexcept
 
void check () const
 
bool is_deleted () const
 
void increment_created () noexcept
 
void increment_read () noexcept
 
void check_init () const
 Check and initialize object if necessary.
 
template<typename T >
void _set_object (const std::string &name, const T *value)
 Helper method for generated set single-value relationship methods.
 
template<typename T >
void _set_objects (const std::string &name, const std::vector< const T * > &value)
 Helper method for generated set multi-value relationship methods.
 
bool get_rel_objects (const std::string &name, bool upcast_unregistered, std::vector< const DalObject * > &objs) const
 Read relationship values as DAL objects using DAL factory.
 
bool get_algo_objects (const std::string &name, std::vector< const DalObject * > &objs) const
 Run algorithm and return result as DAL objects using DAL factory.
 

Private Attributes

std::string m_connection_type
 
const dunedaq::confmodel::Servicem_associated_service
 

Friends

class conffwk::Configuration
 
class conffwk::DalObject
 
class conffwk::DalFactory
 
class conffwk::DalRegistry
 

Additional Inherited Members

- Protected Attributes inherited from dunedaq::conffwk::DalObject
std::mutex m_mutex
 Used to protect changes of DAL object.
 
bool p_was_read
 is true, if the object was read
 
DalRegistryp_registry
 Configuration object.
 
ConfigObject p_obj
 Config object used by given template object.
 
std::string p_UID
 Is used for template objects (see dqm_conffwk)
 

Detailed Description

Definition at line 32 of file NetworkConnection.hpp.

Constructor & Destructor Documentation

◆ NetworkConnection() [1/2]

dunedaq::confmodel::NetworkConnection::NetworkConnection ( conffwk::DalRegistry & db,
const conffwk::ConfigObject & obj )
protectednoexcept

Definition at line 31 of file NetworkConnection.cpp.

31 :
33 Connection(db, o),
34 m_associated_service (nullptr)
35
36 {
37 ;
38 }
The base class for any generated DAL object.
Definition DalObject.hpp:45
Connection(conffwk::DalRegistry &db, const conffwk::ConfigObject &obj) noexcept
const dunedaq::confmodel::Service * m_associated_service

◆ ~NetworkConnection() [1/2]

dunedaq::confmodel::NetworkConnection::~NetworkConnection ( )
protectedvirtualnoexcept

Definition at line 87 of file NetworkConnection.cpp.

88 {
89 }

◆ NetworkConnection() [2/2]

dunedaq::confmodel::NetworkConnection::NetworkConnection ( conffwk::DalRegistry & db,
const conffwk::ConfigObject & obj )
protectednoexcept

◆ ~NetworkConnection() [2/2]

virtual dunedaq::confmodel::NetworkConnection::~NetworkConnection ( )
protectedvirtualnoexcept

Member Function Documentation

◆ __get_associated_service_str() [1/2]

static const std::string & dunedaq::confmodel::NetworkConnection::__get_associated_service_str ( )
inlinestaticnoexcept

Definition at line 142 of file NetworkConnection.hpp.

142{ return s_associated_service; }
static const std::string s_associated_service

◆ __get_associated_service_str() [2/2]

static const std::string & dunedaq::confmodel::NetworkConnection::__get_associated_service_str ( )
inlinestaticnoexcept

Definition at line 142 of file NetworkConnection.hpp.

142{ return s_associated_service; }

◆ __get_connection_type_str() [1/2]

static const std::string & dunedaq::confmodel::NetworkConnection::__get_connection_type_str ( )
inlinestaticnoexcept

Definition at line 93 of file NetworkConnection.hpp.

93{ return s_connection_type; }

◆ __get_connection_type_str() [2/2]

static const std::string & dunedaq::confmodel::NetworkConnection::__get_connection_type_str ( )
inlinestaticnoexcept

Definition at line 93 of file NetworkConnection.hpp.

93{ return s_connection_type; }

◆ get() [1/4]

std::vector< const dunedaq::conffwk::DalObject * > dunedaq::confmodel::NetworkConnection::get ( const std::string & name,
bool upcast_unregistered = true ) const
virtual

Get values of relationships and results of some algorithms as a vector of dunedaq::conffwk::DalObject pointers.

Parameters are:

Parameters
namename of the relationship or algorithm
Returns
value of relationship or result of algorithm
Exceptions
std::exceptionif there is no relationship or algorithm with such name in this and base classes

Reimplemented from dunedaq::confmodel::Connection.

Definition at line 91 of file NetworkConnection.cpp.

92 {
93 std::vector<const dunedaq::conffwk::DalObject *> vec;
94
95 if (!get(name, vec, upcast_unregistered, true))
96 throw_get_ex(name, s_class_name, this);
97
98 return vec;
99 }
static void throw_get_ex(const std::string &what, const std::string &class_name, const DalObject *obj)
throw exception in generated get method (i.e.
Definition DalObject.cpp:82
static const std::string & s_class_name
virtual std::vector< const dunedaq::conffwk::DalObject * > get(const std::string &name, bool upcast_unregistered=true) const
Get values of relationships and results of some algorithms as a vector of dunedaq::conffwk::DalObject...

◆ get() [2/4]

virtual std::vector< const dunedaq::conffwk::DalObject * > dunedaq::confmodel::NetworkConnection::get ( const std::string & name,
bool upcast_unregistered = true ) const
virtual

Get values of relationships and results of some algorithms as a vector of dunedaq::conffwk::DalObject pointers.

Parameters are:

Parameters
namename of the relationship or algorithm
Returns
value of relationship or result of algorithm
Exceptions
std::exceptionif there is no relationship or algorithm with such name in this and base classes

Reimplemented from dunedaq::confmodel::Connection.

◆ get() [3/4]

bool dunedaq::confmodel::NetworkConnection::get ( const std::string & name,
std::vector< const dunedaq::conffwk::DalObject * > & vec,
bool upcast_unregistered,
bool first_call ) const
protected

Definition at line 101 of file NetworkConnection.cpp.

102 {
103 if (first_call)
104 {
105 std::lock_guard scoped_lock(m_mutex);
106
107 check();
108 check_init();
109
110 if (get_rel_objects(name, upcast_unregistered, vec))
111 return true;
112 }
113
114 if (Connection::get(name, vec, upcast_unregistered, false)) return true;
115
116 if (first_call)
117 return get_algo_objects(name, vec);
118
119 return false;
120 }
bool get_rel_objects(const std::string &name, bool upcast_unregistered, std::vector< const DalObject * > &objs) const
Read relationship values as DAL objects using DAL factory.
Definition DalObject.cpp:8
std::mutex m_mutex
Used to protect changes of DAL object.
bool get_algo_objects(const std::string &name, std::vector< const DalObject * > &objs) const
Run algorithm and return result as DAL objects using DAL factory.
Definition DalObject.cpp:25
void check_init() const
Check and initialize object if necessary.
virtual std::vector< const dunedaq::conffwk::DalObject * > get(const std::string &name, bool upcast_unregistered=true) const
Get values of relationships and results of some algorithms as a vector of dunedaq::conffwk::DalObject...

◆ get() [4/4]

bool dunedaq::confmodel::NetworkConnection::get ( const std::string & name,
std::vector< const dunedaq::conffwk::DalObject * > & vec,
bool upcast_unregistered,
bool first_call ) const
protected

◆ get_associated_service() [1/2]

const dunedaq::confmodel::Service * dunedaq::confmodel::NetworkConnection::get_associated_service ( ) const
inline

Get "associated_service" relationship value. Service provided by this connection.

Returns
the relationship value
Exceptions
dunedaq::conffwk::Generic,dunedaq::conffwk::DeletedObject

Definition at line 153 of file NetworkConnection.hpp.

154 {
155 std::lock_guard scoped_lock(m_mutex);
156 check();
157 check_init();
159 {
160 std::ostringstream text;
161 text << "relationship \"" << s_associated_service << "\" of object " << this << " is not set";
162 throw dunedaq::conffwk::Generic(ERS_HERE, text.str().c_str());
163 }
165 }
#define ERS_HERE
Generic configuration exception.

◆ get_associated_service() [2/2]

const dunedaq::confmodel::Service * dunedaq::confmodel::NetworkConnection::get_associated_service ( ) const
inline

Get "associated_service" relationship value. Service provided by this connection.

Returns
the relationship value
Exceptions
dunedaq::conffwk::Generic,dunedaq::conffwk::DeletedObject

Definition at line 153 of file NetworkConnection.hpp.

154 {
155 std::lock_guard scoped_lock(m_mutex);
156 check();
157 check_init();
159 {
160 std::ostringstream text;
161 text << "relationship \"" << s_associated_service << "\" of object " << this << " is not set";
162 throw dunedaq::conffwk::Generic(ERS_HERE, text.str().c_str());
163 }
165 }

◆ get_connection_type() [1/2]

const std::string & dunedaq::confmodel::NetworkConnection::get_connection_type ( ) const
inline

Get "connection_type" attribute value. Type of the network connection.

Returns
the attribute value
Exceptions
dunedaq::conffwk::Generic,dunedaq::conffwk::DeletedObject

Definition at line 113 of file NetworkConnection.hpp.

114 {
115 std::lock_guard scoped_lock(m_mutex);
116 check();
117 check_init();
118 return m_connection_type;
119 }

◆ get_connection_type() [2/2]

const std::string & dunedaq::confmodel::NetworkConnection::get_connection_type ( ) const
inline

Get "connection_type" attribute value. Type of the network connection.

Returns
the attribute value
Exceptions
dunedaq::conffwk::Generic,dunedaq::conffwk::DeletedObject

Definition at line 113 of file NetworkConnection.hpp.

114 {
115 std::lock_guard scoped_lock(m_mutex);
116 check();
117 check_init();
118 return m_connection_type;
119 }

◆ init() [1/2]

void dunedaq::confmodel::NetworkConnection::init ( bool init_children)
protectedvirtual

Initialize object (method generated by genconffwk)

Parameters
init_childrenif true, initialize referenced objects

Reimplemented from dunedaq::confmodel::Connection.

Definition at line 72 of file NetworkConnection.cpp.

73 {
74 Connection::init(init_children);
75
76 TLOG_DEBUG(5) << "read object " << this << " (class " << s_class_name << ')';
77
78 try {
81 }
82 catch (dunedaq::conffwk::Exception & ex) {
83 throw_init_ex(ex);
84 }
85 }
void get(const std::string &name, T &value)
Get value of object's attribute or relationship.
void throw_init_ex(dunedaq::conffwk::Exception &ex)
throw object initialisation exception (i.e.
Definition DalObject.cpp:74
DalRegistry & p_registry
Configuration object.
ConfigObject p_obj
Config object used by given template object.
const T * _ref(ConfigObject &obj, const std::string &name, bool read_children)
Get signle value of object's relation and instantiate result with it (multi-thread safe).
virtual void init(bool init_children)
#define TLOG_DEBUG(lvl,...)
Definition Logging.hpp:112

◆ init() [2/2]

virtual void dunedaq::confmodel::NetworkConnection::init ( bool init_children)
protectedvirtual

Initialize object (method generated by genconffwk)

Parameters
init_childrenif true, initialize referenced objects

Reimplemented from dunedaq::confmodel::Connection.

◆ print() [1/2]

void dunedaq::confmodel::NetworkConnection::print ( unsigned int offset,
bool print_header,
std::ostream & s ) const
virtual

Print details of the NetworkConnection object.

Parameters are:

Parameters
offsetnumber of spaces to shift object right (useful to print nested objects)
print_headerif false, do not print object header (to print attributes of base classes)
soutput stream

Reimplemented from dunedaq::confmodel::Connection.

Definition at line 41 of file NetworkConnection.cpp.

42 {
43 check_init();
44
45 try {
46 const std::string str(indent+2, ' ');
47
48 if (print_header)
49 p_hdr(s, indent, s_class_name, "dunedaq::confmodel");
50
51
52 // print direct super-classes
53
55
56
57 // print direct attributes
58
60
61
62 // print direct relationships
63
65 }
66 catch (dunedaq::conffwk::Exception & ex) {
68 }
69 }
void p_hdr(std::ostream &s, unsigned int indent, const std::string &cl, const char *nm=nullptr) const
print object headers
Definition DalObject.cpp:65
static void p_error(std::ostream &s, dunedaq::conffwk::Exception &ex)
print error text
Definition DalObject.cpp:59
virtual void print(unsigned int offset, bool print_header, std::ostream &s) const
Print details of the Connection object.
void p_sv_rel(std::ostream &s, const std::string &str, const std::string &name, const DalObject *obj)
print weak single-value relationship
void p_sv_attr(std::ostream &s, const std::string &str, const std::string &name, const T &val) noexcept
print single-value attribute

◆ print() [2/2]

virtual void dunedaq::confmodel::NetworkConnection::print ( unsigned int offset,
bool print_header,
std::ostream & s ) const
virtual

Print details of the NetworkConnection object.

Parameters are:

Parameters
offsetnumber of spaces to shift object right (useful to print nested objects)
print_headerif false, do not print object header (to print attributes of base classes)
soutput stream

Reimplemented from dunedaq::confmodel::Connection.

◆ set_associated_service() [1/2]

void dunedaq::confmodel::NetworkConnection::set_associated_service ( const dunedaq::confmodel::Service * value)

Set "associated_service" relationship value. Service provided by this connection.

Parameters
valuenew relationship value
Exceptions
dunedaq::conffwk::Generic,dunedaq::conffwk::DeletedObject

Definition at line 122 of file NetworkConnection.cpp.

123 {
125 }
void _set_object(const std::string &name, const T *value)
Helper method for generated set single-value relationship methods.

◆ set_associated_service() [2/2]

void dunedaq::confmodel::NetworkConnection::set_associated_service ( const dunedaq::confmodel::Service * value)

Set "associated_service" relationship value. Service provided by this connection.

Parameters
valuenew relationship value
Exceptions
dunedaq::conffwk::Generic,dunedaq::conffwk::DeletedObject

◆ set_connection_type() [1/2]

void dunedaq::confmodel::NetworkConnection::set_connection_type ( const std::string & value)
inline

Set "connection_type" attribute value. Type of the network connection.

Parameters
valuenew attribute value
Exceptions
dunedaq::conffwk::Generic,dunedaq::conffwk::DeletedObject

Definition at line 129 of file NetworkConnection.hpp.

130 {
131 std::lock_guard scoped_lock(m_mutex);
132 check();
133 clear();
135 }
void set_enum(const std::string &name, const std::string &value)
Set attribute enumeration value.

◆ set_connection_type() [2/2]

void dunedaq::confmodel::NetworkConnection::set_connection_type ( const std::string & value)
inline

Set "connection_type" attribute value. Type of the network connection.

Parameters
valuenew attribute value
Exceptions
dunedaq::conffwk::Generic,dunedaq::conffwk::DeletedObject

Definition at line 129 of file NetworkConnection.hpp.

130 {
131 std::lock_guard scoped_lock(m_mutex);
132 check();
133 clear();
135 }

Friends And Related Symbol Documentation

◆ conffwk::Configuration

Definition at line 34 of file NetworkConnection.hpp.

◆ conffwk::DalFactory

conffwk::DalFactory
friend

Definition at line 36 of file NetworkConnection.hpp.

◆ conffwk::DalObject

Definition at line 35 of file NetworkConnection.hpp.

◆ conffwk::DalRegistry

Definition at line 37 of file NetworkConnection.hpp.

Member Data Documentation

◆ m_associated_service

const dunedaq::confmodel::Service * dunedaq::confmodel::NetworkConnection::m_associated_service
private

Definition at line 84 of file NetworkConnection.hpp.

◆ m_connection_type

std::string dunedaq::confmodel::NetworkConnection::m_connection_type
private

Definition at line 83 of file NetworkConnection.hpp.

◆ s_associated_service

static const std::string dunedaq::confmodel::NetworkConnection::s_associated_service = "associated_service"
inlinestatic

Definition at line 140 of file NetworkConnection.hpp.

◆ s_class_name

static const std::string & dunedaq::confmodel::NetworkConnection::s_class_name
static

The name of the configuration class.

Definition at line 49 of file NetworkConnection.hpp.

◆ s_connection_type

static const std::string dunedaq::confmodel::NetworkConnection::s_connection_type = "connection_type"
inlinestatic

Definition at line 91 of file NetworkConnection.hpp.


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