COPASI API  4.16.103
Public Member Functions | Static Public Member Functions | Protected Attributes | Private Member Functions | List of all members
CLStyle Class Reference

#include <CLStyle.h>

Inheritance diagram for CLStyle:
Inheritance graph
[legend]
Collaboration diagram for CLStyle:
Collaboration graph
[legend]

Public Member Functions

void addRole (const std::string &role)
 
void addSBMLAttributes (Style *pStyle) const
 
void addType (const std::string &type)
 
 CLStyle (const std::string &name, CCopasiContainer *pParent=NULL)
 
 CLStyle (const CLStyle &source, CCopasiContainer *pParent=NULL)
 
 CLStyle (const Style &source, const std::string &name, CCopasiContainer *pParent=NULL)
 
const CLGroupgetGroup () const
 
CLGroupgetGroup ()
 
const std::string & getKey () const
 
size_t getNumRoles () const
 
size_t getNumTypes () const
 
const std::set< std::string > & getRoleList () const
 
const std::set< std::string > & getTypeList () const
 
bool isInRoleList (const std::string &role) const
 
bool isInTypeList (const std::string &type) const
 
void removeRole (const std::string &role)
 
void removeType (const std::string &type)
 
void setGroup (const CLGroup *pGroup)
 
void setRoleList (const std::set< std::string > &roleList)
 
void setTypeList (const std::set< std::string > &typeList)
 
 ~CLStyle ()
 
- Public Member Functions inherited from CLBase
 CLBase ()
 
 CLBase (const CLBase &b)
 
 CLBase (const SBase &)
 
const std::string & getTag () const
 
bool hasTag () const
 
virtual void moveBy (const CLPoint &)
 
void setTag (const std::string &tag)
 
virtual ~CLBase ()
 
- Public Member Functions inherited from CCopasiContainer
virtual bool add (CCopasiObject *pObject, const bool &adopt=true)
 
 CCopasiContainer (const std::string &name, const CCopasiContainer *pParent=NULL, const std::string &type="CN", const unsigned C_INT32 &flag=CCopasiObject::Container)
 
 CCopasiContainer (const CCopasiContainer &src, const CCopasiContainer *pParent=NULL)
 
virtual std::string getChildObjectUnits (const CCopasiObject *pObject) const
 
virtual const CObjectInterfacegetObject (const CCopasiObjectName &cn) const
 
virtual const objectMapgetObjects () const
 
virtual std::string getUnits () const
 
virtual const CCopasiObjectgetValueObject () const
 
virtual bool remove (CCopasiObject *pObject)
 
virtual ~CCopasiContainer ()
 
- Public Member Functions inherited from CCopasiObject
void addDirectDependency (const CCopasiObject *pObject)
 
 CCopasiObject (const CCopasiObject &src, const CCopasiContainer *pParent=NULL)
 
void clearDirectDependencies ()
 
void clearRefresh ()
 
bool dependsOn (DataObjectSet candidates, const DataObjectSet &context=DataObjectSet()) const
 
void getAllDependencies (DataObjectSet &dependencies, const DataObjectSet &context) const
 
virtual CCopasiObjectName getCN () const
 
virtual const DataObjectSetgetDirectDependencies (const DataObjectSet &context=DataObjectSet()) const
 
CCopasiContainergetObjectAncestor (const std::string &type) const
 
CCopasiDataModelgetObjectDataModel ()
 
const CCopasiDataModelgetObjectDataModel () const
 
virtual std::string getObjectDisplayName (bool regular=true, bool richtext=false) const
 
const std::string & getObjectName () const
 
CCopasiContainergetObjectParent () const
 
const std::string & getObjectType () const
 
virtual const
CObjectInterface::ObjectSet
getPrerequisites () const
 
virtual RefreshgetRefresh () const
 
UpdateMethodgetUpdateMethod () const
 
virtual voidgetValuePointer () const
 
bool hasCircularDependencies (DataObjectSet &candidates, DataObjectSet &verified, const DataObjectSet &context) const
 
bool hasUpdateMethod () const
 
bool isArray () const
 
bool isContainer () const
 
bool isDataModel () const
 
bool isMatrix () const
 
bool isNameVector () const
 
bool isNonUniqueName () const
 
virtual bool isPrerequisiteForContext (const CObjectInterface *pObject, const CMath::SimulationContextFlag &context, const CObjectInterface::ObjectSet &changedObjects) const
 
bool isReference () const
 
bool isRoot () const
 
bool isSeparator () const
 
bool isStaticString () const
 
bool isValueBool () const
 
bool isValueDbl () const
 
bool isValueInt () const
 
bool isValueInt64 () const
 
bool isValueString () const
 
bool isVector () const
 
virtual bool mustBeDeleted (const DataObjectSet &deletedObjects) const
 
virtual void print (std::ostream *ostream) const
 
void removeDirectDependency (const CCopasiObject *pObject)
 
void setDirectDependencies (const DataObjectSet &directDependencies)
 
bool setObjectName (const std::string &name)
 
virtual bool setObjectParent (const CCopasiContainer *pParent)
 
void setObjectValue (const C_FLOAT64 &value)
 
void setObjectValue (const C_INT32 &value)
 
void setObjectValue (const bool &value)
 
template<class CType >
void setRefresh (CType *pType, void(CType::*method)(void))
 
template<class CType >
void setUpdateMethod (CType *pType, void(CType::*method)(const C_FLOAT64 &))
 
template<class CType >
void setUpdateMethod (CType *pType, void(CType::*method)(const C_INT32 &))
 
template<class CType >
void setUpdateMethod (CType *pType, void(CType::*method)(const bool &))
 
virtual ~CCopasiObject ()
 
- Public Member Functions inherited from CObjectInterface
 CObjectInterface ()
 
virtual ~CObjectInterface ()
 

Static Public Member Functions

static std::string createStringFromSet (const std::set< std::string > &set)
 
static void readIntoSet (const std::string &s, std::set< std::string > &set)
 
- Static Public Member Functions inherited from CCopasiObject
static std::vector< Refresh * > buildUpdateSequence (const DataObjectSet &objects, const DataObjectSet &uptoDateObjects, const DataObjectSet &context=DataObjectSet())
 
static void setRenameHandler (CRenameHandler *rh)
 

Protected Attributes

std::string mKey
 
CLGroupmpGroup
 
std::set< std::string > mRoleList
 
std::set< std::string > mTypeList
 
- Protected Attributes inherited from CLBase
std::string mTag
 
- Protected Attributes inherited from CCopasiContainer
objectMap mObjects
 

Private Member Functions

CLStyleoperator= (const CLStyle &source)
 

Additional Inherited Members

- Public Types inherited from CCopasiContainer
typedef std::multimap
< std::string, CCopasiObject * > 
objectMap
 
- Public Types inherited from CCopasiObject
typedef std::set< const
CCopasiObject * > 
DataObjectSet
 
typedef std::vector< Refresh * > DataUpdateSequence
 
- Public Types inherited from CObjectInterface
typedef std::set< const
CObjectInterface * > 
ObjectSet
 
typedef std::vector
< CObjectInterface * > 
UpdateSequence
 
- Static Public Attributes inherited from CCopasiContainer
static const std::vector
< CCopasiContainer * > 
EmptyList
 
- Protected Types inherited from CCopasiObject
enum  Flag {
  Container = 0x1, Vector = 0x2, Matrix = 0x4, NameVector = 0x8,
  Reference = 0x10, ValueBool = 0x20, ValueInt = 0x40, ValueInt64 = 0x80,
  ValueDbl = 0x100, NonUniqueName = 0x200, StaticString = 0x400, ValueString = 0x800,
  Separator = 0x1000, ModelEntity = 0x2000, Array = 0x4000, DataModel = 0x8000,
  Root = 0x10000, Gui = 0x20000
}
 
- Protected Member Functions inherited from CCopasiContainer
template<class CType >
CCopasiObjectaddMatrixReference (const std::string &name, CType &reference, const unsigned C_INT32 &flag=0)
 
template<class CType >
CCopasiObjectaddObjectReference (const std::string &name, CType &reference, const unsigned C_INT32 &flag=0)
 
template<class CType >
CCopasiObjectaddVectorReference (const std::string &name, CType &reference, const unsigned C_INT32 &flag=0)
 
void initObjects ()
 
- Protected Member Functions inherited from CCopasiObject
 CCopasiObject ()
 
 CCopasiObject (const std::string &name, const CCopasiContainer *pParent=NULL, const std::string &type="CN", const unsigned C_INT32 &flag=0)
 
- Static Protected Attributes inherited from CCopasiObject
static CRenameHandlersmpRenameHandler = NULL
 

Detailed Description

Definition at line 27 of file CLStyle.h.

Constructor & Destructor Documentation

CLStyle::CLStyle ( const std::string &  name,
CCopasiContainer pParent = NULL 
)

Constructor.

Definition at line 26 of file CLStyle.cpp.

26  :
27  CLBase(),
28  CCopasiContainer(name, pParent),
29  mpGroup(NULL),
30  mKey("")
31 {
32 }
CLBase()
Definition: CLBase.h:36
std::string mKey
Definition: CLStyle.h:41
CLGroup * mpGroup
Definition: CLStyle.h:36
CLStyle::CLStyle ( const CLStyle source,
CCopasiContainer pParent = NULL 
)

Copy Constructor.

Definition at line 37 of file CLStyle.cpp.

References mpGroup.

37  :
38  CLBase(source),
39  CCopasiContainer(source, pParent),
40  mRoleList(source.mRoleList),
41  mTypeList(source.mTypeList),
42  mpGroup(NULL),
43  mKey("")
44 {
45  if (source.mpGroup != NULL)
46  {
47  this->mpGroup = new CLGroup(*source.mpGroup, this);
48  }
49 }
CLBase()
Definition: CLBase.h:36
std::string mKey
Definition: CLStyle.h:41
CLGroup * mpGroup
Definition: CLStyle.h:36
std::set< std::string > mTypeList
Definition: CLStyle.h:35
std::set< std::string > mRoleList
Definition: CLStyle.h:34
CLStyle::CLStyle ( const Style &  source,
const std::string &  name,
CCopasiContainer pParent = NULL 
)

Constructor to generate object from the corresponding SBML object.

Definition at line 54 of file CLStyle.cpp.

References createStringFromSet(), mRoleList, mTypeList, and readIntoSet().

54  :
55  CLBase(),
56  CCopasiContainer(name, pParent),
57  mpGroup(new CLGroup(*source.getGroup(), this)),
58  mKey("")
59 {
60  CLStyle::readIntoSet(CLStyle::createStringFromSet(source.getRoleList()), this->mRoleList);
61  CLStyle::readIntoSet(CLStyle::createStringFromSet(source.getTypeList()), this->mTypeList);
62 }
CLBase()
Definition: CLBase.h:36
static void readIntoSet(const std::string &s, std::set< std::string > &set)
Definition: CLStyle.cpp:168
std::string mKey
Definition: CLStyle.h:41
CLGroup * mpGroup
Definition: CLStyle.h:36
std::set< std::string > mTypeList
Definition: CLStyle.h:35
static std::string createStringFromSet(const std::set< std::string > &set)
Definition: CLStyle.cpp:182
std::set< std::string > mRoleList
Definition: CLStyle.h:34
CLStyle::~CLStyle ( )

Destructor

Definition at line 67 of file CLStyle.cpp.

References CCopasiRootContainer::getKeyFactory(), mKey, and CKeyFactory::remove().

68 {
70 }
bool remove(const std::string &key)
std::string mKey
Definition: CLStyle.h:41
static CKeyFactory * getKeyFactory()

Member Function Documentation

void CLStyle::addRole ( const std::string &  role)

Adds an role to the role list.

Definition at line 115 of file CLStyle.cpp.

References mRoleList.

116 {
117  this->mRoleList.insert(role);
118 }
std::set< std::string > mRoleList
Definition: CLStyle.h:34
void CLStyle::addSBMLAttributes ( Style *  pStyle) const

Adds the attributes for a style object to the passed in. object.

Definition at line 237 of file CLStyle.cpp.

References createStringFromSet(), mpGroup, mRoleList, mTypeList, readIntoSet(), and CLGroup::toSBML().

Referenced by CLGlobalStyle::toSBML(), and CLLocalStyle::toSBML().

238 {
239  RenderGroup* pG = this->mpGroup->toSBML(pStyle->getLevel(), pStyle->getVersion());
240  pStyle->setGroup(pG);
241  delete pG;
242  std::set<std::string> s;
244  pStyle->setRoleList(s);
245  s.clear();
247  pStyle->setTypeList(s);
248 }
static void readIntoSet(const std::string &s, std::set< std::string > &set)
Definition: CLStyle.cpp:168
CLGroup * mpGroup
Definition: CLStyle.h:36
std::set< std::string > mTypeList
Definition: CLStyle.h:35
static std::string createStringFromSet(const std::set< std::string > &set)
Definition: CLStyle.cpp:182
std::set< std::string > mRoleList
Definition: CLStyle.h:34
RenderGroup * toSBML(unsigned int level, unsigned int version) const
Definition: CLGroup.cpp:799
void CLStyle::addType ( const std::string &  type)

Adds a type to the type list.

Adds an type to the type list.

Definition at line 147 of file CLStyle.cpp.

References mTypeList.

148 {
149  this->mTypeList.insert(type);
150 }
std::set< std::string > mTypeList
Definition: CLStyle.h:35
std::string CLStyle::createStringFromSet ( const std::set< std::string > &  set)
static

Definition at line 182 of file CLStyle.cpp.

Referenced by addSBMLAttributes(), CLLocalStyle::CLLocalStyle(), CLStyle(), CCopasiXML::saveLocalStyle(), CCopasiXML::saveStyleAttributes(), and CLLocalStyle::toSBML().

183 {
184  std::ostringstream os;
185  std::set<std::string>::const_iterator it = set.begin(), endit = set.end();
186 
187  while (it != endit)
188  {
189  os << *it << " ";
190  ++it;
191  }
192 
193  if (!os.str().empty())
194  {
195  os.str(os.str().substr(0, os.str().size() - 1));
196  }
197 
198  return os.str();
199 }
const CLGroup * CLStyle::getGroup ( ) const
CLGroup * CLStyle::getGroup ( )

Returns the group.

Definition at line 99 of file CLStyle.cpp.

References mpGroup.

100 {
101  return this->mpGroup;
102 }
CLGroup * mpGroup
Definition: CLStyle.h:36
const std::string & CLStyle::getKey ( ) const
virtual

Returns the key of the style

Reimplemented from CCopasiObject.

Definition at line 228 of file CLStyle.cpp.

References mKey.

Referenced by CCopasiXML::saveStyleAttributes().

229 {
230  return this->mKey;
231 }
std::string mKey
Definition: CLStyle.h:41
size_t CLStyle::getNumRoles ( ) const

Returns the number of roles in the role list.

Returns the number roles ids in the role list.

Definition at line 107 of file CLStyle.cpp.

References mRoleList.

Referenced by CCopasiXML::saveStyleAttributes().

108 {
109  return this->mRoleList.size();
110 }
std::set< std::string > mRoleList
Definition: CLStyle.h:34
size_t CLStyle::getNumTypes ( ) const

Returns the number of types in the type list.

Definition at line 139 of file CLStyle.cpp.

References mTypeList.

Referenced by CCopasiXML::saveStyleAttributes().

140 {
141  return this->mTypeList.size();
142 }
std::set< std::string > mTypeList
Definition: CLStyle.h:35
const std::set< std::string > & CLStyle::getRoleList ( ) const

Returns the role list.

Definition at line 201 of file CLStyle.cpp.

References mRoleList.

Referenced by CLRenderFlattener::convertGlobalToLocalStyle(), CLRenderResolver::fill_global_maps(), CLRenderResolver::fill_local_maps(), CLRenderFlattener::flatten(), and CCopasiXML::saveStyleAttributes().

202 {
203  return this->mRoleList;
204 }
std::set< std::string > mRoleList
Definition: CLStyle.h:34
const std::set< std::string > & CLStyle::getTypeList ( ) const

Returns the type list.

Definition at line 206 of file CLStyle.cpp.

References mTypeList.

Referenced by CLRenderFlattener::convertGlobalToLocalStyle(), CLRenderResolver::fill_global_maps(), CLRenderResolver::fill_local_maps(), CLRenderFlattener::flatten(), and CCopasiXML::saveStyleAttributes().

207 {
208  return this->mTypeList;
209 }
std::set< std::string > mTypeList
Definition: CLStyle.h:35
bool CLStyle::isInRoleList ( const std::string &  role) const

Checks whether a given role is in the role list.

Definition at line 123 of file CLStyle.cpp.

References mRoleList.

124 {
125  return (this->mRoleList.find(role) != this->mRoleList.end());
126 }
std::set< std::string > mRoleList
Definition: CLStyle.h:34
bool CLStyle::isInTypeList ( const std::string &  type) const

Checks whether a given type is in the type list.

Definition at line 155 of file CLStyle.cpp.

References mTypeList.

156 {
157  return (this->mTypeList.find(type) != this->mTypeList.end());
158 }
std::set< std::string > mTypeList
Definition: CLStyle.h:35
CLStyle& CLStyle::operator= ( const CLStyle source)
private
void CLStyle::readIntoSet ( const std::string &  s,
std::set< std::string > &  set 
)
static

Definition at line 168 of file CLStyle.cpp.

Referenced by addSBMLAttributes(), CLLocalStyle::CLLocalStyle(), CLStyle(), CCopasiXMLParser::LocalStyleElement::start(), CCopasiXMLParser::GlobalStyleElement::start(), and CLLocalStyle::toSBML().

169 {
170  std::string delimiter = "\n\r\t ";
171  std::size_t lastPos = s.find_first_not_of(delimiter);
172  std::size_t pos;
173 
174  while (lastPos != std::string::npos)
175  {
176  pos = s.find_first_of(delimiter, lastPos);
177  set.insert(s.substr(lastPos, pos - lastPos));
178  lastPos = s.find_first_not_of(delimiter, pos);
179  }
180 }
void CLStyle::removeRole ( const std::string &  role)

Removes a role from the role list.

Removes an role from the role list.

Definition at line 131 of file CLStyle.cpp.

References mRoleList.

132 {
133  this->mRoleList.erase(role);
134 }
std::set< std::string > mRoleList
Definition: CLStyle.h:34
void CLStyle::removeType ( const std::string &  type)

Removes an type from the type list.

Definition at line 163 of file CLStyle.cpp.

References mTypeList.

164 {
165  this->mTypeList.erase(type);
166 }
std::set< std::string > mTypeList
Definition: CLStyle.h:35
void CLStyle::setGroup ( const CLGroup pGroup)

Sets the group.

Definition at line 75 of file CLStyle.cpp.

References mpGroup.

Referenced by CLRenderFlattener::convertGlobalToLocalStyle(), and CCopasiXMLParser::GroupElement::start().

76 {
77  if (pGroup)
78  {
79  if (this->mpGroup != NULL)
80  {
81  delete this->mpGroup;
82  }
83 
84  this->mpGroup = new CLGroup(*pGroup, this);
85  }
86 }
CLGroup * mpGroup
Definition: CLStyle.h:36
void CLStyle::setRoleList ( const std::set< std::string > &  roleList)

Sets the role list.

Definition at line 211 of file CLStyle.cpp.

References mRoleList.

Referenced by CLRenderFlattener::convertGlobalToLocalStyle(), CCopasiXMLParser::LocalStyleElement::start(), and CCopasiXMLParser::GlobalStyleElement::start().

212 {
213  // I do not check roles on purpose since this is more versatil in the light
214  // of future extensions
215  this->mRoleList = roleList;
216 }
std::set< std::string > mRoleList
Definition: CLStyle.h:34
void CLStyle::setTypeList ( const std::set< std::string > &  typeList)

Sets the type list.

Definition at line 218 of file CLStyle.cpp.

References mTypeList.

Referenced by CLRenderFlattener::convertGlobalToLocalStyle(), CCopasiXMLParser::LocalStyleElement::start(), and CCopasiXMLParser::GlobalStyleElement::start().

219 {
220  // I do not check types on purpose since this is more versatil in the light
221  // of future extensions
222  this->mTypeList = typeList;
223 }
std::set< std::string > mTypeList
Definition: CLStyle.h:35

Member Data Documentation

std::string CLStyle::mKey
protected

key string for the style.

Definition at line 41 of file CLStyle.h.

Referenced by CLGlobalStyle::CLGlobalStyle(), CLLocalStyle::CLLocalStyle(), getKey(), and ~CLStyle().

CLGroup* CLStyle::mpGroup
protected

Definition at line 36 of file CLStyle.h.

Referenced by addSBMLAttributes(), CLStyle(), getGroup(), and setGroup().

std::set<std::string> CLStyle::mRoleList
protected
std::set<std::string> CLStyle::mTypeList
protected

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