COPASI API  4.16.103
Macros | Functions
CAnnotatedMatrix.cpp File Reference

Implementation file of class CCopasiArray and CArrayAnnotation. More...

#include <sstream>
#include "CAnnotatedMatrix.h"
#include "CCopasiVector.h"
#include "report/CKeyFactory.h"
#include "report/CArrayElementReference.h"
#include "CopasiDataModel/CCopasiDataModel.h"
Include dependency graph for CAnnotatedMatrix.cpp:

Go to the source code of this file.

Macros

#define SPC(level)   std::string(level, ' ')
 

Functions

std::ostream & operator<< (std::ostream &os, const CArrayAnnotation &o)
 

Detailed Description

Implementation file of class CCopasiArray and CArrayAnnotation.

Definition in file CAnnotatedMatrix.cpp.

Macro Definition Documentation

#define SPC (   level)    std::string(level, ' ')

Definition at line 382 of file CAnnotatedMatrix.cpp.

Referenced by CArrayAnnotation::printRecursively().

Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const CArrayAnnotation o 
)

Definition at line 438 of file CAnnotatedMatrix.cpp.

References CArrayAnnotation::array(), CArrayAnnotation::dimensionality(), CArrayAnnotation::getAnnotationsString(), CArrayAnnotation::getDescription(), CCopasiObject::getObjectName(), CArrayAnnotation::printRecursively(), and CCopasiAbstractArray::size().

439 {
440  if (!o.array()) return os;
441 
442  //cache the display names
443  std::vector<std::vector<std::string> > displaynames;
444  size_t i;
445 
446  for (i = 0; i < o.dimensionality(); ++i)
447  displaynames.push_back(o.getAnnotationsString(i));
448 
449  os << o.getObjectName() << std::endl;
450  os << o.getDescription() << std::endl;
451 
452  CCopasiAbstractArray::index_type arraysize = o.array()->size();
453 
454  if (o.dimensionality() == 0)
455  {
456  //only one scalar value
457  os << (*o.array())[arraysize] << std::endl;
458  }
459  else
460  {
461  o.printRecursively(os, o.dimensionality() - 1, arraysize, displaynames);
462  }
463 
464  return os;
465 }
const std::string & getObjectName() const
const std::vector< std::string > & getAnnotationsString(size_t d, bool display=true) const
virtual const index_type & size() const =0
CCopasiAbstractArray * array()
std::vector< size_t > index_type
Definition: CCopasiArray.h:34
const std::string & getDescription() const
size_t dimensionality() const
void printRecursively(std::ostream &ostream, size_t level, CCopasiAbstractArray::index_type &index, const std::vector< std::vector< std::string > > &display) const