COPASI API  4.16.103
CLLocalStyle.cpp
Go to the documentation of this file.
1 // Begin CVS Header
2 // $Source: /Volumes/Home/Users/shoops/cvs/copasi_dev/copasi/layout/CLLocalStyle.cpp,v $
3 // $Revision: 1.6 $
4 // $Name: $
5 // $Author: shoops $
6 // $Date: 2012/04/23 15:44:51 $
7 // End CVS Header
8 
9 // Copyright (C) 2012 - 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 #include <assert.h>
15 
16 #include <sbml/packages/render/sbml/LocalStyle.h>
17 
18 #include "CLLocalStyle.h"
19 
22 
23 /**
24  * Constructor.
25  */
26 CLLocalStyle::CLLocalStyle(CCopasiContainer* pParent): CLStyle("LocalStyle", pParent)
27 {
28  this->mKey = CCopasiRootContainer::getKeyFactory()->add("LocalStyle", this);
29 }
30 
31 /**
32  * Copy Constructor.
33  */
35  CLStyle(source, pParent),
36  mKeyList(source.mKeyList)
37 {
38  this->mKey = CCopasiRootContainer::getKeyFactory()->add("LocalStyle", this);
39 }
40 
41 /**
42  * Constructor to generate object from the corresponding SBML object.
43  */
44 CLLocalStyle::CLLocalStyle(const LocalStyle& source, CCopasiContainer* pParent):
45  CLStyle(source, "LocalStyle", pParent)
46 {
47  this->mKey = CCopasiRootContainer::getKeyFactory()->add("LocalStyle", this);
49 }
50 
51 /**
52  * Returns the number of keys in the key set.
53  */
55 {
56  return this->mKeyList.size();
57 }
58 
59 /**
60  * Sets the key list.
61  */
62 void CLLocalStyle::setKeyList(const std::set<std::string>& keyList)
63 {
64  this->mKeyList = keyList;
65 }
66 
67 /**
68  * Returns the key list.
69  */
70 const std::set<std::string>& CLLocalStyle::getKeyList() const
71 {
72  return this->mKeyList;
73 }
74 
75 /**
76  * Checks if a certain key is in the set or not.
77  */
78 bool CLLocalStyle::isKeyInSet(const std::string& key) const
79 {
80  return (this->mKeyList.find(key) != this->mKeyList.end());
81 }
82 
83 /**
84  * Adds another key to the set.
85  */
86 void CLLocalStyle::addKey(const std::string& key)
87 {
88  this->mKeyList.insert(key);
89 }
90 
91 /**
92  * Removes an key from the set.
93  */
94 void CLLocalStyle::removeKey(const std::string& key)
95 {
96  this->mKeyList.erase(key);
97 }
98 
99 /**
100  * Converts this object to the corresponding SBML object.
101  */
102 LocalStyle* CLLocalStyle::toSBML(unsigned int level, unsigned int version) const
103 {
104  LocalStyle* pLS = new LocalStyle(level, version);
105  this->addSBMLAttributes(pLS);
106  std::set<std::string> s;
108  pLS->setIdList(s);
109  return pLS;
110 }
void addKey(const std::string &key)
LocalStyle * toSBML(unsigned int level, unsigned int version) const
static void readIntoSet(const std::string &s, std::set< std::string > &set)
Definition: CLStyle.cpp:168
void removeKey(const std::string &key)
const std::set< std::string > & getKeyList() const
size_t getNumKeys() const
std::string mKey
Definition: CLStyle.h:41
void addSBMLAttributes(Style *pStyle) const
Definition: CLStyle.cpp:237
bool isKeyInSet(const std::string &key) const
std::string add(const std::string &prefix, CCopasiObject *pObject)
std::set< std::string > mKeyList
Definition: CLLocalStyle.h:27
static CKeyFactory * getKeyFactory()
static std::string createStringFromSet(const std::set< std::string > &set)
Definition: CLStyle.cpp:182
void setKeyList(const std::set< std::string > &keyList)
CLLocalStyle(CCopasiContainer *pParent=NULL)