DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
dbe::inner::configobject::gref< typename > Class Template Reference

#include <config_reference_copy.hpp>

Public Types

typedef T t_extractor
 
typedef std::function< void(dref const) > config_action_notifiable
 

Public Member Functions

bool is_null () const
 
void notify (config_action_notifiable tele)
 

Private Types

typedef std::deque< t_extractortype_extractor_stack
 
typedef std::vector< dbe::treftype_ref_container
 

Private Member Functions

tref rebuild ()
 
void record (tref const &obj)
 
void post ()
 

Private Attributes

type_extractor_stack this_remove_stack
 
type_ref_container this_notify_stack
 

Friends

class inner::dbcontroller
 

Detailed Description

template<typename>
class dbe::inner::configobject::gref< typename >

Holds a graph copy of the subgraph associated with the referenced object, which is the result of a deletion operation in dbcontroller. It can only be used to attempt reviving the object

The object copy can only be used for passing it to a dbcontroller for recreation of the associated objects. A gref does not support querying the underlying copy.

Definition at line 26 of file tref.hpp.

Member Typedef Documentation

◆ config_action_notifiable

template<typename >
std::function<void ( dref const ) > dbe::inner::configobject::gref< typename >::config_action_notifiable

Definition at line 71 of file config_reference_copy.hpp.

◆ t_extractor

template<typename >
T dbe::inner::configobject::gref< typename >::t_extractor

Definition at line 70 of file config_reference_copy.hpp.

◆ type_extractor_stack

template<typename >
std::deque<t_extractor> dbe::inner::configobject::gref< typename >::type_extractor_stack
private

Definition at line 90 of file config_reference_copy.hpp.

◆ type_ref_container

template<typename >
std::vector<dbe::tref> dbe::inner::configobject::gref< typename >::type_ref_container
private

Definition at line 91 of file config_reference_copy.hpp.

Member Function Documentation

◆ is_null()

template<typename T >
bool dbe::inner::configobject::gref< T >::is_null ( ) const

Checks if the front of the queue is valid

Returns
true / false on condition evaluation of the state of the object at front

Definition at line 131 of file dbcontroller.cpp.

132{
133 return this_remove_stack.front().is_null();
134}

◆ notify()

template<typename T >
void dbe::inner::configobject::gref< T >::notify ( config_action_notifiable tele)

Passing a notifiable to permits to make a callback with the object and notify of it having been in different states in the the program structure. The notifiable actually determines what type of modification may be sent.

Parameters
teleis a notifiable that receives an object descriptor

Definition at line 91 of file dbcontroller.cpp.

92{
93 if (this_notify_stack.empty())
94 {
95 for (typename type_extractor_stack::value_type const & val : this_remove_stack)
96 {
97 tele(val.ref);
98 }
99 }
100 else
101 {
102 for (typename type_ref_container::value_type const & val : this_notify_stack)
103 {
104 tele(val);
105 }
106 }
107}

◆ post()

template<typename T >
void dbe::inner::configobject::gref< T >::post ( )
private

Filtering function checks after deletion of objects and keep only those that have been removed

Definition at line 73 of file dbcontroller.cpp.

74{
76 std::swap(acopy, this_remove_stack);
77
78 while (not acopy.empty())
79 {
80 t_extractor candidate = acopy.front();
81 // Keep only objects that have been deleted
82 if (not dbe::config::api::info::has_obj(candidate.ref.class_name(),
83 candidate.ref.UID()))
84 {
85 this_remove_stack.push_back(candidate);
86 }
87 acopy.pop_front();
88 }
89}
std::deque< t_extractor > type_extractor_stack
bool has_obj(std::string const &classname, std::string const &object_uid)

◆ rebuild()

template<typename T >
tref dbe::inner::configobject::gref< T >::rebuild ( )
private

Create the objects in the in the queue and return the last object created , i.e. the bottom of the queue.

Returns
the last object created

Definition at line 109 of file dbcontroller.cpp.

110{
111 if (not this_remove_stack.empty())
112 {
113 for (;;)
114 {
117 this_remove_stack.pop_front();
118 if (not last.is_null())
119 {
120 this_notify_stack.push_back(last);
121 }
122 if (this_remove_stack.empty())
123 {
124 return last;
125 }
126 }
127 }
128 throw daq::dbe::gref_empty_internal_queue_is_invalid_state(ERS_HERE);
129}
#define ERS_HERE
void record(tref const &obj)
static configobject::tref create_object_request(dbe::t_config_object_preimage const &rep)
inner::configobject::tref tref
Definition tref.hpp:30

◆ record()

template<typename T >
void dbe::inner::configobject::gref< T >::record ( tref const & obj)
private

Include a ConfigObject and all its descendants

Parameters
obj

Definition at line 60 of file dbcontroller.cpp.

61{
63 for (auto const & linked : obj.relations)
64 {
65 for (auto const & candidate : linked.second)
66 {
67 record(candidate.ref());
68 }
69 }
70 this_remove_stack.push_back(obj);
71}

Friends And Related Symbol Documentation

◆ inner::dbcontroller

template<typename >
friend class inner::dbcontroller
friend

Definition at line 118 of file config_reference_copy.hpp.

Member Data Documentation

◆ this_notify_stack

template<typename >
type_ref_container dbe::inner::configobject::gref< typename >::this_notify_stack
private

Definition at line 116 of file config_reference_copy.hpp.

◆ this_remove_stack

template<typename >
type_extractor_stack dbe::inner::configobject::gref< typename >::this_remove_stack
private

Definition at line 115 of file config_reference_copy.hpp.


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