Chemical Data Processing Library C++ API - Version 1.1.1
|
#include <BasicReaction.hpp>
Public Types | |
typedef std::shared_ptr< BasicReaction > | SharedPointer |
A reference-counted smart pointer [SHPTR] for dynamically allocated BasicReaction instances. More... | |
typedef boost::indirect_iterator< ComponentList::iterator, BasicMolecule > | ComponentIterator |
typedef boost::indirect_iterator< ComponentList::const_iterator, const BasicMolecule > | ConstComponentIterator |
Public Types inherited from CDPL::Chem::Reaction | |
typedef std::shared_ptr< Reaction > | SharedPointer |
A reference-counted smart pointer [SHPTR] for dynamically allocated Reaction instances. More... | |
typedef Util::IndexedElementIterator< const Molecule, ConstComponentAccessor > | ConstComponentIterator |
A constant random access iterator used to iterate over the components of the reaction. More... | |
typedef Util::IndexedElementIterator< Molecule, ComponentAccessor > | ComponentIterator |
A mutable random access iterator used to iterate over the components of the reaction. More... | |
typedef std::function< void(Reaction &, const Reaction &)> | CopyPostprocessingFunction |
Public Types inherited from CDPL::Base::PropertyContainer | |
typedef PropertyMap::value_type | PropertyEntry |
A Base::LookupKey / Base::Any pair that stores the property value for a given property key. More... | |
typedef PropertyMap::const_iterator | ConstPropertyIterator |
A constant iterator used to iterate over the property entries. More... | |
Public Member Functions | |
BasicReaction () | |
Constructs an empty BasicReaction instance. More... | |
BasicReaction (const BasicReaction &rxn) | |
Constructs a copy of the BasicReaction instance rxn. More... | |
BasicReaction (const Reaction &rxn) | |
Constructs a copy of the Chem::Reaction instance rxn. More... | |
~BasicReaction () | |
Destructor. More... | |
unsigned int | getComponentRole (const Molecule &mol) const |
Returns the reaction role of the specified component. More... | |
std::size_t | getComponentIndex (const Molecule &mol) const |
Returns the index of the specified reaction component. More... | |
bool | containsComponent (const Molecule &mol) const |
Tells whether the specified molecule is a component of this reaction. More... | |
void | clear () |
Removes all components and clears all properties of the reaction. More... | |
std::size_t | getNumComponents () const |
Returns the number of reaction components. More... | |
std::size_t | getNumComponents (unsigned int role) const |
Returns the number of reaction components with the specified role. More... | |
ConstComponentIterator | getComponentsBegin () const |
ComponentIterator | getComponentsBegin () |
ConstComponentIterator | getComponentsEnd () const |
ComponentIterator | getComponentsEnd () |
ConstComponentIterator | getComponentsBegin (unsigned int role) const |
ComponentIterator | getComponentsBegin (unsigned int role) |
ConstComponentIterator | getComponentsEnd (unsigned int role) const |
ComponentIterator | getComponentsEnd (unsigned int role) |
const BasicMolecule & | getComponent (std::size_t idx) const |
Returns a const reference to the reaction component at index idx. More... | |
BasicMolecule & | getComponent (std::size_t idx) |
Returns a non-const reference to the reaction component at index idx. More... | |
const BasicMolecule & | getComponent (std::size_t idx, unsigned int role) const |
Returns a const reference to the reaction component at index idx in the list of components with the specified role. More... | |
BasicMolecule & | getComponent (std::size_t idx, unsigned int role) |
Returns a non-const reference to the reaction component at index idx in the list of components with the specified role. More... | |
BasicMolecule & | addComponent (unsigned int role) |
Creates a new reaction component with the specified role. More... | |
BasicMolecule & | addComponent (unsigned int role, const Molecule &mol) |
Creates a new reaction component with the specified role that is a copy of the molecule mol. More... | |
void | swapComponentRoles (unsigned int role1, unsigned int role2) |
Swaps the reaction roles of the component sets specified by role1 and role2. More... | |
void | removeComponent (std::size_t idx) |
Removes the reaction component at the specified index. More... | |
void | removeComponent (std::size_t idx, unsigned int role) |
Removes the reaction component at index idx in the list of components with the specified role. More... | |
ComponentIterator | removeComponent (const ComponentIterator &it) |
void | removeComponents (unsigned int role) |
Removes all components with the specified role. More... | |
Reaction::SharedPointer | clone () const |
Creates a copy of the current reaction state. More... | |
BasicReaction & | operator= (const BasicReaction &rxn) |
Replaces the current set of reaction components and properties by a copy of the components and properties of the reaction rxn. More... | |
void | copy (const BasicReaction &rxn) |
Replaces the current set of reaction components and properties by a copy of the components and properties of the reaction rxn. More... | |
void | copy (const Reaction &rxn) |
Replaces the current set of reaction components and properties by a copy of the components and properties of the reaction rxn. More... | |
Reaction & | operator= (const Reaction &rxn) |
Replaces the current set of reaction components and properties by a copy of the components and properties of the reaction rxn. More... | |
Public Member Functions inherited from CDPL::Chem::Reaction | |
virtual | ~Reaction () |
Virtual destructor. More... | |
ConstComponentIterator | getComponentsBegin () const |
Returns a constant iterator pointing to the beginning of the reaction components. More... | |
ComponentIterator | getComponentsBegin () |
Returns a mutable iterator pointing to the beginning of the reaction components. More... | |
ConstComponentIterator | getComponentsEnd () const |
Returns a constant iterator pointing to the end of the reaction components. More... | |
ComponentIterator | getComponentsEnd () |
Returns a mutable iterator pointing to the end of the reaction components. More... | |
ConstComponentIterator | begin () const |
Returns a constant iterator pointing to the beginning of the reaction components. More... | |
ComponentIterator | begin () |
Returns a mutable iterator pointing to the beginning of the reaction components. More... | |
ConstComponentIterator | end () const |
Returns a constant iterator pointing to the end of the reaction components. More... | |
ComponentIterator | end () |
Returns a mutable iterator pointing to the end of the reaction components. More... | |
ConstComponentIterator | getComponentsBegin (unsigned int role) const |
Returns a constant iterator pointing to the beginning of the reaction components with the specified role. More... | |
ComponentIterator | getComponentsBegin (unsigned int role) |
Returns a mutable iterator pointing to the beginning of the reaction components with the specified role. More... | |
ConstComponentIterator | getComponentsEnd (unsigned int role) const |
Returns a constant iterator pointing to the end of the reaction components with the specified role. More... | |
ComponentIterator | getComponentsEnd (unsigned int role) |
Returns a mutable iterator pointing to the end of the reaction components with the specified role. More... | |
ComponentIterator | removeComponent (const ComponentIterator &it) |
Removes the reaction component specified by the iterator it. More... | |
Reaction & | operator= (const Reaction &rxn) |
Replaces the current set of reaction components and properties by a copy of the components and properties of the reaction rxn. More... | |
Public Member Functions inherited from CDPL::Base::PropertyContainer | |
std::size_t | getNumProperties () const |
Returns the number of property entries. More... | |
template<typename T > | |
void | setProperty (const LookupKey &key, T &&val) |
Sets the value of the property specified by key to val. More... | |
template<typename T > | |
const T & | getProperty (const LookupKey &key) const |
Returns the value of the property specified by key as a const reference to an object of type T. More... | |
template<typename T > | |
const T & | getPropertyOrDefault (const LookupKey &key, const T &def_val) const |
Returns the value of the property specified by key as a const reference to an object of type T, or the default value def_val if a stored value does not exist. More... | |
const Any & | getProperty (const LookupKey &key, bool throw_=false) const |
Returns the value of the property specified by key. More... | |
bool | isPropertySet (const LookupKey &key) const |
Tells whether or not a value has been assigned to the property specified by key. More... | |
ConstPropertyIterator | getPropertiesBegin () const |
Returns a constant iterator pointing to the beginning of the property entries. More... | |
ConstPropertyIterator | getPropertiesEnd () const |
Returns a constant iterator pointing to the end of the property entries. More... | |
ConstPropertyIterator | begin () const |
Returns a constant iterator pointing to the beginning of the property entries. More... | |
ConstPropertyIterator | end () const |
Returns a constant iterator pointing to the end of the property entries. More... | |
bool | removeProperty (const LookupKey &key) |
Clears the value of the property specified by key. More... | |
void | clearProperties () |
Clears all property values. More... | |
void | addProperties (const PropertyContainer &cntnr) |
Adds the property value entries in the PropertyContainer instance cntnr. More... | |
void | copyProperties (const PropertyContainer &cntnr) |
Replaces the current set of properties by a copy of the entries in cntnr. More... | |
void | swap (PropertyContainer &cntnr) |
Exchanges the properties of this container with the properties of the container cntnr. More... | |
const PropertyContainer & | getProperties () const |
Returns a const reference to itself. More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from CDPL::Chem::Reaction | |
static void | registerCopyPostprocessingFunction (const CopyPostprocessingFunction &func) |
Protected Member Functions inherited from CDPL::Chem::Reaction | |
void | invokeCopyPostprocessingFunctions (const Reaction &src_rxn) |
Protected Member Functions inherited from CDPL::Base::PropertyContainer | |
PropertyContainer () | |
Constructs an empty PropertyContainer instance. More... | |
PropertyContainer (const PropertyContainer &cntnr) | |
Constructs a copy of the PropertyContainer instance cntnr. More... | |
virtual | ~PropertyContainer () |
Virtual destructor. More... | |
PropertyContainer & | operator= (const PropertyContainer &cntnr) |
Assignment operator. More... | |
typedef std::shared_ptr<BasicReaction> CDPL::Chem::BasicReaction::SharedPointer |
A reference-counted smart pointer [SHPTR] for dynamically allocated BasicReaction
instances.
typedef boost::indirect_iterator<ComponentList::iterator, BasicMolecule> CDPL::Chem::BasicReaction::ComponentIterator |
typedef boost::indirect_iterator<ComponentList::const_iterator, const BasicMolecule> CDPL::Chem::BasicReaction::ConstComponentIterator |
CDPL::Chem::BasicReaction::BasicReaction | ( | ) |
Constructs an empty BasicReaction
instance.
CDPL::Chem::BasicReaction::BasicReaction | ( | const BasicReaction & | rxn | ) |
Constructs a copy of the BasicReaction
instance rxn.
rxn | The other Reaction instance to copy. |
CDPL::Chem::BasicReaction::BasicReaction | ( | const Reaction & | rxn | ) |
Constructs a copy of the Chem::Reaction instance rxn.
rxn | The other Chem::Reaction instance to copy. |
CDPL::Chem::BasicReaction::~BasicReaction | ( | ) |
Destructor.
Destroys the BasicReaction
instance and frees all allocated resources.
|
virtual |
Returns the reaction role of the specified component.
If the specified molecule is not a component of this reaction, Chem::ReactionRole::NONE will be returned.
mol | The component for which to return the reaction role. |
Implements CDPL::Chem::Reaction.
|
virtual |
Returns the index of the specified reaction component.
mol | The component for which to return the index. |
Base::ItemNotFound | if the specified molecule is not a component of this reaction. |
Implements CDPL::Chem::Reaction.
Tells whether the specified molecule is a component of this reaction.
mol | The molecule to look for. |
true
if the specified molecule is a component of this reaction, and false
otherwise. Implements CDPL::Chem::Reaction.
|
virtual |
Removes all components and clears all properties of the reaction.
Implements CDPL::Chem::Reaction.
|
virtual |
Returns the number of reaction components.
Implements CDPL::Chem::Reaction.
|
virtual |
Returns the number of reaction components with the specified role.
role | A flag that specifies the reaction role (see namespace Chem::ReactionRole). |
Base::ValueError | if the value of role is not equal to Chem::ReactionRole::REACTANT, Chem::ReactionRole::AGENT or Chem::ReactionRole::PRODUCT. |
Implements CDPL::Chem::Reaction.
ConstComponentIterator CDPL::Chem::BasicReaction::getComponentsBegin | ( | ) | const |
ComponentIterator CDPL::Chem::BasicReaction::getComponentsBegin | ( | ) |
ConstComponentIterator CDPL::Chem::BasicReaction::getComponentsEnd | ( | ) | const |
ComponentIterator CDPL::Chem::BasicReaction::getComponentsEnd | ( | ) |
ConstComponentIterator CDPL::Chem::BasicReaction::getComponentsBegin | ( | unsigned int | role | ) | const |
ComponentIterator CDPL::Chem::BasicReaction::getComponentsBegin | ( | unsigned int | role | ) |
ConstComponentIterator CDPL::Chem::BasicReaction::getComponentsEnd | ( | unsigned int | role | ) | const |
ComponentIterator CDPL::Chem::BasicReaction::getComponentsEnd | ( | unsigned int | role | ) |
|
virtual |
Returns a const
reference to the reaction component at index idx.
idx | The zero-based index of the reaction component to return. |
const
reference to the reaction component at the specified index. Base::IndexError | if the number of components is zero or idx is not in the range [0, getNumComponents() - 1]. |
Implements CDPL::Chem::Reaction.
|
virtual |
Returns a non-const
reference to the reaction component at index idx.
idx | The zero-based index of the reaction component to return. |
const
reference to the reaction component at the specified index. Base::IndexError | if the number of components is zero or idx is not in the range [0, getNumComponents() - 1]. |
Implements CDPL::Chem::Reaction.
|
virtual |
Returns a const
reference to the reaction component at index idx in the list of components with the specified role.
idx | The zero-based index of the reaction component to return. |
role | A flag indicating the reaction role of the component (see namespace Chem::ReactionRole). |
const
reference to the reaction component with the specified role and index. Base::IndexError | if the number of components with the specified role is zero or idx is not in the range [0, getNumComponents(role) - 1 ]. Base::ValueError if the value of role is not equal to Chem::ReactionRole::REACTANT, Chem::ReactionRole::AGENT or Chem::ReactionRole::PRODUCT. |
Implements CDPL::Chem::Reaction.
|
virtual |
Returns a non-const
reference to the reaction component at index idx in the list of components with the specified role.
idx | The zero-based index of the reaction component to return. |
role | A flag indicating the reaction role of the component (see namespace Chem::ReactionRole). |
const
reference to the reaction component with the specified role and index. Base::IndexError | if the number of components with the specified role is zero or idx is not in the range [0, getNumComponents(role) - 1 ]. Base::ValueError if the value of role is not equal to Chem::ReactionRole::REACTANT, Chem::ReactionRole::AGENT or Chem::ReactionRole::PRODUCT. |
Implements CDPL::Chem::Reaction.
|
virtual |
Creates a new reaction component with the specified role.
role | A flag specifying the reaction role of the new component (see namespace Chem::ReactionRole). |
Base::ValueError | if the value of role is not Chem::ReactionRole::REACTANT, Chem::ReactionRole::AGENT or Chem::ReactionRole::PRODUCT. |
Implements CDPL::Chem::Reaction.
BasicMolecule& CDPL::Chem::BasicReaction::addComponent | ( | unsigned int | role, |
const Molecule & | mol | ||
) |
Creates a new reaction component with the specified role that is a copy of the molecule mol.
role | A flag specifying the reaction role of the new component (see namespace Chem::ReactionRole). |
mol | Specifies a molecule that provides the data for the new reaction component (note that only explicitly assigned molecule, atom and bond properties will be copied). |
Base::ValueError | if the value of role is not Chem::ReactionRole::REACTANT, Chem::ReactionRole::AGENT or Chem::ReactionRole::PRODUCT. |
|
virtual |
Swaps the reaction roles of the component sets specified by role1 and role2.
If role1 is equal to role2, the method has no effect.
role1 | A flag specifying the reaction role of the first component set (see namespace Chem::ReactionRole). |
role2 | A flag specifying the reaction role of the second component set (see namespace Chem::ReactionRole). |
Base::ValueError | if the value of role1 and/or role2 is not equal to Chem::ReactionRole::REACTANT, Chem::ReactionRole::AGENT or Chem::ReactionRole::PRODUCT. |
Implements CDPL::Chem::Reaction.
|
virtual |
Removes the reaction component at the specified index.
idx | The zero-based index of the component to remove. |
Base::IndexError | if the number of components is zero or idx is not in the range [0, getNumComponents() - 1]. |
Implements CDPL::Chem::Reaction.
|
virtual |
Removes the reaction component at index idx in the list of components with the specified role.
idx | The zero-based index of the component to remove. |
role | The reaction role of the components |
Base::IndexError | if the number of components with the specified role is zero or idx is not in the range [0, getNumComponents(role) - 1 ]. Base::ValueError if the value of role is not Chem::ReactionRole::REACTANT, Chem::ReactionRole::AGENT or Chem::ReactionRole::PRODUCT. |
Implements CDPL::Chem::Reaction.
ComponentIterator CDPL::Chem::BasicReaction::removeComponent | ( | const ComponentIterator & | it | ) |
|
virtual |
Removes all components with the specified role.
role | A flag specifying the reaction role of the components to remove (see namespace Chem::ReactionRole). |
Base::ValueError | if the value of role is not Chem::ReactionRole::REACTANT, Chem::ReactionRole::AGENT or Chem::ReactionRole::PRODUCT. |
Implements CDPL::Chem::Reaction.
|
virtual |
Creates a copy of the current reaction state.
Implements CDPL::Chem::Reaction.
BasicReaction& CDPL::Chem::BasicReaction::operator= | ( | const BasicReaction & | rxn | ) |
Replaces the current set of reaction components and properties by a copy of the components and properties of the reaction rxn.
Internally calls copy() to perform the actual work.
rxn | The reaction to copy. |
void CDPL::Chem::BasicReaction::copy | ( | const BasicReaction & | rxn | ) |
Replaces the current set of reaction components and properties by a copy of the components and properties of the reaction rxn.
rxn | The reaction to copy. |
|
virtual |
Replaces the current set of reaction components and properties by a copy of the components and properties of the reaction rxn.
rxn | The reaction to copy. |
Implements CDPL::Chem::Reaction.
Reaction& CDPL::Chem::Reaction::operator= |
Replaces the current set of reaction components and properties by a copy of the components and properties of the reaction rxn.
Internally calls copy() to perform the actual work.
rxn | The reaction to copy. |