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 42 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 108 of file Change.hpp.

108: 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 1768 of file Configuration.cpp.

1769{
1770 ConfigurationChange *class_changes = nullptr;
1771
1772 for (const auto &c : changes)
1773 if (class_name == c->get_class_name())
1774 {
1775 class_changes = c;
1776 break;
1777 }
1778
1779 if (!class_changes)
1780 {
1781 class_changes = new ConfigurationChange(class_name);
1782 changes.push_back(class_changes);
1783 }
1784
1785 std::vector<std::string>& clist = (
1786 action == '+' ? class_changes->m_created :
1787 action == '-' ? class_changes->m_removed :
1788 class_changes->m_modified
1789 );
1790
1791 clist.push_back(obj_name);
1792}
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 1796 of file Configuration.cpp.

1797{
1798 for (const auto &i : changes)
1799 delete i;
1800
1801 changes.clear();
1802}

◆ 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 51 of file Change.hpp.

51{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 61 of file Change.hpp.

61{return m_created;}
std::vector< std::string > m_created
Definition Change.hpp:116

◆ 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 56 of file Change.hpp.

56{return m_modified;}
std::vector< std::string > m_modified
Definition Change.hpp:115

◆ 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 66 of file Change.hpp.

66{return m_removed;}
std::vector< std::string > m_removed
Definition Change.hpp:117

◆ operator=()

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

◆ Configuration

friend class Configuration
friend

Definition at line 44 of file Change.hpp.

◆ ConfigurationImpl

friend class ConfigurationImpl
friend

Definition at line 45 of file Change.hpp.

Member Data Documentation

◆ m_class_name

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

Definition at line 113 of file Change.hpp.

◆ m_created

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

Definition at line 116 of file Change.hpp.

◆ m_modified

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

Definition at line 115 of file Change.hpp.

◆ m_removed

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

Definition at line 117 of file Change.hpp.


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