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

Describes changes inside a class returned by the notification mechanism. More...

#include <Change.hpp>

Public Member Functions

const std::string & get_class_name () const
 Get name of class which objects were modified.
 
const std::vector< std::string > & get_modified_objs () const
 Return vector of identies of modified objects.
 
const std::vector< std::string > & get_created_objs () const
 Return vector of identies of created objects.
 
const std::vector< std::string > & get_removed_objs () const
 Return vector of identies of removed objects.
 

Static Public Member Functions

static void add (std::vector< ConfigurationChange * > &changes, const std::string &class_name, const std::string &obj_id, const char action)
 Helper method to add object to the vector of existing changes.
 
static void clear (std::vector< ConfigurationChange * > &changes)
 Helper method to clear vector of changes (pointers).
 

Private Member Functions

 ConfigurationChange (const ConfigurationChange &)
 
ConfigurationChangeoperator= (const ConfigurationChange &)
 
 ConfigurationChange (const std::string &name)
 

Private Attributes

std::string m_class_name
 
std::vector< std::string > m_modified
 
std::vector< std::string > m_created
 
std::vector< std::string > m_removed
 

Friends

class Configuration
 
class ConfigurationImpl
 

Detailed Description

Describes changes inside a class returned by the notification mechanism.

All changes received by the notification mechanism after commit of database modification are passed to subscribed client in one go. This is more preferred way than passing changes for each class or object in a separate callback. In the latter case user need to be sure at some moment that (s)he read all changes, keep changes already read, etc.

The changes are passed to a client as a vector of objects of this class. For each class there are three vectors of object identities:

  • modified objects (i.e. one or more attributes/relationships values were modified)
  • created objects
  • removed objects

Definition at line 35 of file Change.hpp.

Constructor & Destructor Documentation

◆ ConfigurationChange() [1/2]

dunedaq::conffwk::ConfigurationChange::ConfigurationChange ( const ConfigurationChange & )
private

◆ ConfigurationChange() [2/2]

dunedaq::conffwk::ConfigurationChange::ConfigurationChange ( const std::string & name)
inlineprivate

Definition at line 101 of file Change.hpp.

101: m_class_name(name) {}

Member Function Documentation

◆ add()

void dunedaq::ConfigurationChange::add ( std::vector< ConfigurationChange * > & changes,
const std::string & class_name,
const std::string & obj_id,
const char action )
static

Helper method to add object to the vector of existing changes.

Note that this is the only method available to create new changes description since the constructor is private.

The method adds object described by the 'class_name' and 'obj_name' to the changes. New ConfigurationChange object is created if required.

Parameters
changesdescription of existing changes
class_namename of the object's class
obj_idobject's id
actionrequested action:
  • '+' created
  • '~' changed
  • '-' removed

Definition at line 1761 of file Configuration.cpp.

1762{
1763 ConfigurationChange *class_changes = nullptr;
1764
1765 for (const auto &c : changes)
1766 if (class_name == c->get_class_name())
1767 {
1768 class_changes = c;
1769 break;
1770 }
1771
1772 if (!class_changes)
1773 {
1774 class_changes = new ConfigurationChange(class_name);
1775 changes.push_back(class_changes);
1776 }
1777
1778 std::vector<std::string>& clist = (
1779 action == '+' ? class_changes->m_created :
1780 action == '-' ? class_changes->m_removed :
1781 class_changes->m_modified
1782 );
1783
1784 clist.push_back(obj_name);
1785}
ConfigurationChange(const ConfigurationChange &)

◆ clear()

void dunedaq::ConfigurationChange::clear ( std::vector< ConfigurationChange * > & changes)
static

Helper method to clear vector of changes (pointers).

Destroy ConfigurationChange objects referenced by the container.

Parameters
changesdescription of existing changes

Definition at line 1789 of file Configuration.cpp.

1790{
1791 for (const auto &i : changes)
1792 delete i;
1793
1794 changes.clear();
1795}

◆ get_class_name()

const std::string & dunedaq::conffwk::ConfigurationChange::get_class_name ( ) const
inline

Get name of class which objects were modified.

Definition at line 44 of file Change.hpp.

44{return m_class_name;}

◆ get_created_objs()

const std::vector< std::string > & dunedaq::conffwk::ConfigurationChange::get_created_objs ( ) const
inline

Return vector of identies of created objects.

Definition at line 54 of file Change.hpp.

54{return m_created;}
std::vector< std::string > m_created
Definition Change.hpp:109

◆ get_modified_objs()

const std::vector< std::string > & dunedaq::conffwk::ConfigurationChange::get_modified_objs ( ) const
inline

Return vector of identies of modified objects.

Definition at line 49 of file Change.hpp.

49{return m_modified;}
std::vector< std::string > m_modified
Definition Change.hpp:108

◆ get_removed_objs()

const std::vector< std::string > & dunedaq::conffwk::ConfigurationChange::get_removed_objs ( ) const
inline

Return vector of identies of removed objects.

Definition at line 59 of file Change.hpp.

59{return m_removed;}
std::vector< std::string > m_removed
Definition Change.hpp:110

◆ operator=()

ConfigurationChange & dunedaq::conffwk::ConfigurationChange::operator= ( const ConfigurationChange & )
private

Friends And Related Symbol Documentation

◆ Configuration

friend class Configuration
friend

Definition at line 37 of file Change.hpp.

◆ ConfigurationImpl

friend class ConfigurationImpl
friend

Definition at line 38 of file Change.hpp.

Member Data Documentation

◆ m_class_name

std::string dunedaq::conffwk::ConfigurationChange::m_class_name
private

Definition at line 106 of file Change.hpp.

◆ m_created

std::vector<std::string> dunedaq::conffwk::ConfigurationChange::m_created
private

Definition at line 109 of file Change.hpp.

◆ m_modified

std::vector<std::string> dunedaq::conffwk::ConfigurationChange::m_modified
private

Definition at line 108 of file Change.hpp.

◆ m_removed

std::vector<std::string> dunedaq::conffwk::ConfigurationChange::m_removed
private

Definition at line 110 of file Change.hpp.


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