# gcp::Reactant Class Reference

Class for reactants and products of a chemical reaction. More...

`#include <gcp/reactant.h>`

Inheritance diagram for gcp::Reactant:

List of all members.

## Public Member Functions

| Reactant ()
virtual | ~Reactant ()
| Reactant (ReactionStep *step, gcu::Object *object) throw (std::invalid_argument)
virtual xmlNodePtr | Save (xmlDocPtr xml) const
virtual bool | Load (xmlNodePtr node)
unsigned | GetStoichiometry () const
void | SetStoichiometry (unsigned coef)
virtual double | GetYAlign ()
bool | BuildContextualMenu (GtkUIManager *UIManager, gcu::Object *object, double x, double y)
bool | OnSignal (gcu::SignalId Signal, gcu::Object *Child)
void | AddStoichiometry ()
gcu::Object * | GetChild ()
gcu::Object * | GetStoichChild ()

## Detailed Description

Class for reactants and products of a chemical reaction.

Objects of these class embed either a molecule or a text representing a reactant or a product for a chemical reaction. They can have a stoichiometry coefficient.

Definition at line 41 of file reactant.h.

## Constructor & Destructor Documentation

gcp::Reactant::Reactant | ( |  | ) |

The default constructor.

virtual gcp::Reactant::~Reactant | ( |  | ) | `[virtual]`

The destructor.

gcp::Reactant::Reactant | ( | ReactionStep * | step,
|  | gcu::Object * | object |
| ) |  |  | throw (std::invalid_argument)

Parameters:

  | step | the parent reaction step.
  | object | the molecule formula or text to use as reactant.

## Member Function Documentation

virtual xmlNodePtr gcp::Reactant::Save | ( | xmlDocPtr | xml | ) | const`[virtual]`

Parameters:

  | xml | the xmlDoc used to save the document.

Used to save the reactant to the xmlDoc.

Returns:
  the xmlNode containing the serialized reactant.

Reimplemented from gcu::Object.

virtual bool gcp::Reactant::Load | ( | xmlNodePtr | node | ) | `[virtual]`

Parameters:

  | node | a pointer to the xmlNode containing the serialized reactant.

Used to load a reactant in memory. The Reactant instance must already exist.

Returns:
  true on succes, false otherwise.

Reimplemented from gcu::Object.

unsigned gcp::Reactant::GetStoichiometry | ( |  | ) | const`[inline]`

Returns:
  the reactants stoichiometry coefficient.

Definition at line 78 of file reactant.h.

void gcp::Reactant::SetStoichiometry | ( | unsigned | coef | ) | `[inline]`

Parameters:

  | coef | the new stoichiometry coefficient.

Sets the stoichiometry coefficient for the reactant.

Definition at line 84 of file reactant.h.

virtual double gcp::Reactant::GetYAlign | ( |  | ) | `[virtual]`

Used to retrieve the y coordinate for alignment.

Returns:
  y coordinate used for reactant alignment.

Reimplemented from gcu::Object.

bool gcp::Reactant::BuildContextualMenu | ( | GtkUIManager * | UIManager,
|  | gcu::Object * | object,
|  | double | x,
|  | double | y |
| ) |  |  | `[virtual]`

Parameters:

  | UIManager | the GtkUIManager to populate.
  | object | the Object on which occured the mouse click.
  | x | x coordinate of the mouse click.
  | y | y coordinate of the mouse click.

This method is called to build a contextual menu for the reactant.

Returns:
  true if something is added to the UIManager, false otherwise.

Reimplemented from gcu::Object.

bool gcp::Reactant::OnSignal | ( | gcu::SignalId | Signal,
|  | gcu::Object * | Child |
| ) |  |  | `[virtual]`

Parameters:

  | Signal | the appropriate SignalId
  | Child | the child which emitted the signal or NULL

This function is called by the framework when a signal has been emitted for the reactant, when the embedded text or molecule changed. It should not be called by a program; call Object::EmitSignal instead.

Returns:
  true to propagate the signal to the parent.

Reimplemented from gcu::Object.

void gcp::Reactant::AddStoichiometry | ( |  | ) |

Adds a text item to display the reactants stoichiometry coefficient. This coefficient does not need to be an integer, but should always be positive.

gcu::Object* gcp::Reactant::GetChild | ( |  | ) | `[inline]`

Returns:
  the molecule or text embedded in this instance.

Definition at line 120 of file reactant.h.

gcu::Object* gcp::Reactant::GetStoichChild | ( |  | ) | `[inline]`

Returns:
  the text representing the stoichiometry coefficient of this instance.

Definition at line 124 of file reactant.h.

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

- reactant.h