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 &)
ConfigurationChange & operator= (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 102 of file Change.hpp.

103 : m_class_name(name)
104 {
105 }

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 1617 of file Configuration.cpp.

1621{
1622 ConfigurationChange* class_changes = nullptr;
1623
1624 for (const auto& c : changes)
1625 if (class_name == c->get_class_name()) {
1626 class_changes = c;
1627 break;
1628 }
1629
1630 if (!class_changes) {
1631 class_changes = new ConfigurationChange(class_name);
1632 changes.push_back(class_changes);
1633 }
1634
1635 std::vector<std::string>& clist = (action == '+' ? class_changes->m_created
1636 : action == '-' ? class_changes->m_removed
1637 : class_changes->m_modified);
1638
1639 clist.push_back(obj_name);
1640}
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 1643 of file Configuration.cpp.

1644{
1645 for (const auto& i : changes)
1646 delete i;
1647
1648 changes.clear();
1649}

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

59{ return m_created; }
std::vector< std::string > m_created
Definition Change.hpp:111

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

55{ return m_modified; }
std::vector< std::string > m_modified
Definition Change.hpp:110

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

63{ return m_removed; }
std::vector< std::string > m_removed
Definition Change.hpp:112

◆ operator=()

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

◆ Configuration

friend class Configuration
friend

Definition at line 45 of file Change.hpp.

◆ ConfigurationImpl

friend class ConfigurationImpl
friend

Definition at line 46 of file Change.hpp.

Member Data Documentation

◆ m_class_name

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

Definition at line 108 of file Change.hpp.

◆ m_created

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

Definition at line 111 of file Change.hpp.

◆ m_modified

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

Definition at line 110 of file Change.hpp.

◆ m_removed

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

Definition at line 112 of file Change.hpp.


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