COPASI API  4.16.103
COutputDefinitionVector.cpp
Go to the documentation of this file.
1 /* Begin CVS Header
2  $Source: /Volumes/Home/Users/shoops/cvs/copasi_dev/copasi/plot/COutputDefinitionVector.cpp,v $
3  $Revision: 1.6 $
4  $Name: $
5  $Author: shoops $
6  $Date: 2011/09/16 12:10:08 $
7  End CVS Header */
8 
9 // Copyright (C) 2011 - 2010 by Pedro Mendes, Virginia Tech Intellectual
10 // Properties, Inc., University of Heidelberg, and The University
11 // of Manchester.
12 // All rights reserved.
13 
14 // Copyright (C) 2008 by Pedro Mendes, Virginia Tech Intellectual
15 // Properties, Inc., EML Research, gGmbH, University of Heidelberg,
16 // and The University of Manchester.
17 // All rights reserved.
18 
19 // Copyright (C) 2001 - 2007 by Pedro Mendes, Virginia Tech Intellectual
20 // Properties, Inc. and EML Research, gGmbH.
21 // All rights reserved.
22 
24 #include "report/CKeyFactory.h"
26 
28  const CCopasiContainer * pParent):
29  CCopasiVectorN< CPlotSpecification >(name, pParent),
30  mKey(CCopasiRootContainer::getKeyFactory()->add("COutputDefinitionVector", this))
31 {}
32 
34 {
35  cleanup();
36 }
37 
39 {
41 }
42 
43 const std::string& COutputDefinitionVector::getKey() const
44 {
45  return mKey;
46 }
47 
49  CPlotItem::Type type)
50 {
51  size_t i;
52 
53  for (i = 0; i < size(); i++)
54  if ((*this)[i]->getObjectName() == name)
55  return NULL; // duplicate name
56 
57  CPlotSpecification* pNewPlotSpec = new CPlotSpecification(name, this, type);
58  pNewPlotSpec->setObjectName(name);
59 
60  add(pNewPlotSpec);
61  return pNewPlotSpec;
62 }
63 
64 bool COutputDefinitionVector::removePlotSpec(const std::string & key)
65 {
66  CPlotSpecification* pPl =
68  size_t index = this->CCopasiVector<CPlotSpecification>::getIndex(pPl);
69 
70  if (index == C_INVALID_INDEX)
71  return false;
72 
74 
75  return true;
76 }
bool remove(const std::string &key)
virtual size_t size() const
CCopasiObject * get(const std::string &key)
#define C_INVALID_INDEX
Definition: copasi.h:222
const std::string & getKey() const
virtual bool add(const CPlotSpecification &src)
bool removePlotSpec(const std::string &key)
CPlotSpecification * createPlotSpec(const std::string &name, CPlotItem::Type type=CPlotItem::plot2d)
virtual void remove(const size_t &index)
virtual size_t getIndex(const CCopasiObject *pObject) const
static CKeyFactory * getKeyFactory()
COutputDefinitionVector(const std::string &name="OutputDefinitions", const CCopasiContainer *pParent=NULL)
bool setObjectName(const std::string &name)