copasi API
0.1
|
#include <CAnnotatedMatrix.h>
Public Types | |
enum | Mode { OBJECTS, VECTOR, VECTOR_ON_THE_FLY, STRINGS, NUMBERS } |
Public Member Functions | |
CArrayAnnotation (const std::string &name, const CCopasiContainer *pParent, CCopasiAbstractArray *array, const bool &adopt) | |
~CArrayAnnotation () | |
void | setArray (CCopasiAbstractArray *a) |
CCopasiAbstractArray * | array () |
const CCopasiAbstractArray * | array () const |
void | setMode (unsigned int d, Mode m) |
void | setMode (Mode m) |
Mode | getMode (unsigned int d) const |
Mode | getDefaultMode () const |
unsigned int | dimensionality () const |
CCopasiAbstractArray::index_type | size () const |
void | setCopasiVector (unsigned int d, const CCopasiContainer *v) |
void | setAnnotationCN (unsigned int d, unsigned int i, const std::string cn) |
void | setAnnotationString (unsigned int d, unsigned int i, const std::string s) |
const std::vector < CRegisteredObjectName > & | getAnnotationsCN (unsigned int d) const |
const std::vector< std::string > & | getAnnotationsString (unsigned int d, bool display=true) const |
const std::string & | getDimensionDescription (unsigned int d) const |
void | setDimensionDescription (unsigned int d, const std::string &s) |
const std::string & | getDescription () const |
void | setDescription (const std::string &s) |
void | resize () |
const CCopasiObject * | addElementReference (CCopasiAbstractArray::index_type index) const |
const CCopasiObject * | addElementReference (C_INT32 u, C_INT32 v) const |
const CCopasiObject * | addElementReference (C_INT32 u) const |
void | appendElementReferences (std::set< const CCopasiObject * > &objects) const |
virtual const CCopasiObject * | getObject (const CCopasiObjectName &cn) const |
bool | isEmpty () |
void | reDimensionalize (unsigned int d) |
void | resizeOneDimension (unsigned int d) |
bool | createAnnotationsCNFromCopasiVector (unsigned int d, const CCopasiContainer *v) const |
void | createNumbers (unsigned int d) const |
void | printRecursively (std::ostream &ostream, C_INT32 level, CCopasiAbstractArray::index_type &index, const std::vector< std::vector< std::string > > &display) const |
virtual std::string | getObjectDisplayName (bool regular=true, bool richtext=false) const |
virtual void | print (std::ostream *ostream) const |
Friends | |
std::ostream & | operator<< (std::ostream &os, const CArrayAnnotation &o) |
This class contains the annotations to a n-dimensional array. Annotations can be provided for the array as such, for each of the dimensions, and for each of the indices (rows, columns, ...)
The annotation to an array can work in different modes. The mode for each dimension can be changed independently.
OBJECTS: The CNs for the rows, cols, ... of the array are given explicitly
VECTOR: A CCopasiVector is provided from which the CNs are generated at the time the vector is set
VECTOR_ON_THE_FLY: A CCopasiVector is provided, but the CNs are generated every time the annotations are retrieved (so that they are always up to date).
STRINGS: The annotations for the rows, cols, ... are given explicitly as strings.
NUMBERS: The rows, cols, ... of the array are only annotation with running numbers (starting with 0)-
CArrayAnnotation::CArrayAnnotation | ( | const std::string & | name, |
const CCopasiContainer * | pParent, | ||
CCopasiAbstractArray * | array, | ||
const bool & | adopt | ||
) |
CArrayAnnotation::~CArrayAnnotation | ( | ) |
const CCopasiObject * CArrayAnnotation::addElementReference | ( | CCopasiAbstractArray::index_type | index | ) | const |
an object that will act as a reference to one element of an array will be created and inserted as a child of the array annotation. Basically most of the work will be done by getObject(). If the element already exists, the existing element will be returned.
const CCopasiObject * CArrayAnnotation::addElementReference | ( | C_INT32 | u, |
C_INT32 | v | ||
) | const |
a convenience function for 2-dimensional arrays.
const CCopasiObject * CArrayAnnotation::addElementReference | ( | C_INT32 | u | ) | const |
a convenience function for 1-dimensional arrays.
void CArrayAnnotation::appendElementReferences | ( | std::set< const CCopasiObject * > & | objects | ) | const |
Appends all element references to the set of objects
std::set< | const CCopasiObject * > & objects |
CCopasiAbstractArray* CArrayAnnotation::array | ( | ) | [inline] |
const CCopasiAbstractArray* CArrayAnnotation::array | ( | ) | const [inline] |
bool CArrayAnnotation::createAnnotationsCNFromCopasiVector | ( | unsigned int | d, |
const CCopasiContainer * | v | ||
) | const |
generate the list of CNs from the COPASI vector v. v needs to be a CCopasiVector (or derived from it)!
void CArrayAnnotation::createNumbers | ( | unsigned int | d | ) | const |
unsigned int CArrayAnnotation::dimensionality | ( | ) | const |
const std::vector< CRegisteredObjectName > & CArrayAnnotation::getAnnotationsCN | ( | unsigned int | d | ) | const |
returns the vector of CNs that correspond to the rows, columns, ... of the array. This method must not be called if the mode for the dimension d is STRINGS or NUMBERS
const std::vector< std::string > & CArrayAnnotation::getAnnotationsString | ( | unsigned int | d, |
bool | display = true |
||
) | const |
This returns strings that annotate the rows, columns, ... of the array. If the mode is OBJECTS, VECTOR, or VECTOR_ON_THE_FLY the display argument determines if the object name or the object display name is used. Note that this method returns a reference. The content that the reference points to may be changes by later calls to the getAnnotationsCN() method with the same value for d. Specifically if you use this method to obtain a reference to the list of display names and then call the method again to get the plain object names, the first reference will after that also point to the plain object names.
Mode CArrayAnnotation::getDefaultMode | ( | ) | const [inline] |
const std::string & CArrayAnnotation::getDescription | ( | ) | const |
const std::string & CArrayAnnotation::getDimensionDescription | ( | unsigned int | d | ) | const |
Mode CArrayAnnotation::getMode | ( | unsigned int | d | ) | const [inline] |
const CCopasiObject * CArrayAnnotation::getObject | ( | const CCopasiObjectName & | cn | ) | const [virtual] |
Resolve a cn. Since this is an array, the CN can start with an index like "[2][3]". Since this is also a container, this is not necessarily the case.
Reimplemented from CCopasiContainer.
std::string CArrayAnnotation::getObjectDisplayName | ( | bool | regular = true , |
bool | richtext = false |
||
) | const [virtual] |
generate a display name for the array annotation.
Reimplemented from CCopasiObject.
bool CArrayAnnotation::isEmpty | ( | ) |
Check whether the size of array is greater than 0 for each dimension. Return true, if so. Otherwise, false.
void CArrayAnnotation::print | ( | std::ostream * | ostream | ) | const [virtual] |
This is the output method for any object. The default implementation provided with CCopasiObject uses the ostream operator<< of the object to print the object.To override this default behavior one needs to reimplement the virtual print function.
std::ostream | * ostream |
Reimplemented from CCopasiObject.
void CArrayAnnotation::printRecursively | ( | std::ostream & | ostream, |
C_INT32 | level, | ||
CCopasiAbstractArray::index_type & | index, | ||
const std::vector< std::vector< std::string > > & | display | ||
) | const |
void CArrayAnnotation::reDimensionalize | ( | unsigned int | d | ) |
resize the internal vectors according to the dimensionality of the array
void CArrayAnnotation::resize | ( | ) |
adjust the dimensionality and size to that of the array
void CArrayAnnotation::resizeOneDimension | ( | unsigned int | d | ) |
void CArrayAnnotation::setAnnotationCN | ( | unsigned int | d, |
unsigned int | i, | ||
const std::string | cn | ||
) |
void CArrayAnnotation::setAnnotationString | ( | unsigned int | d, |
unsigned int | i, | ||
const std::string | s | ||
) |
void CArrayAnnotation::setArray | ( | CCopasiAbstractArray * | a | ) |
let the ArrayAnnotation point to a different array. If you use this method without updating the annotations afterwards it is your responsibility to make sure the new array fits the existing annotation (in dimensionality and, if not in VECTOR_ON_THE_FLY mode, in size).
void CArrayAnnotation::setCopasiVector | ( | unsigned int | d, |
const CCopasiContainer * | v | ||
) |
Associates a dimension d of the array with a CCopasiVector of CCopasiObjects. If the mode of the dimension d is VECTOR than the CNs of the objects in the vector are generated and stored immediately. If the mode is VECTOR_ON_THE_FLY the CNs are generated when getAnnotationsCN() or getAnnotationsString() is called.
void CArrayAnnotation::setDescription | ( | const std::string & | s | ) |
void CArrayAnnotation::setDimensionDescription | ( | unsigned int | d, |
const std::string & | s | ||
) |
void CArrayAnnotation::setMode | ( | unsigned int | d, |
Mode | m | ||
) |
set the mode for the dimension d
void CArrayAnnotation::setMode | ( | Mode | m | ) |
set the mode for all dimensions, this also sets the default mode that is used when resizing the ArrayAnnotion to a larger dimensionality
CCopasiAbstractArray::index_type CArrayAnnotation::size | ( | ) | const [inline] |
std::ostream& operator<< | ( | std::ostream & | os, |
const CArrayAnnotation & | o | ||
) | [friend] |