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

#include <SBMLReference.h>

Collaboration diagram for SBMLReference:
Collaboration graph
[legend]

Public Types

typedef std::map< std::string,
std::string >::const_iterator 
const_iterator
 

Public Member Functions

bool add (const std::string &id, const std::string &key)
 
const_iterator beginCOPASIkey () const
 
const_iterator beginSBMLid () const
 
const_iterator endCOPASIkey () const
 
const_iterator endSBMLid () const
 
const std::string & getCOPASIkey (const std::string &id) const
 
const std::string & getSBMLid (const std::string &key) const
 
const std::string & getURL () const
 
bool removeCOPASIkey (const std::string &key)
 
bool removeSBMLid (const std::string &id)
 
 SBMLReference ()
 
 SBMLReference (const SBMLReference &src)
 
bool setURL (const std::string &url)
 
 ~SBMLReference ()
 

Private Attributes

std::map< std::string,
std::string > 
mIdToKey
 
std::map< std::string,
std::string > 
mKeyToId
 
std::string mURL
 

Static Private Attributes

static std::string NotFound = ""
 

Detailed Description

Definition at line 19 of file SBMLReference.h.

Member Typedef Documentation

typedef std::map<std::string, std::string>::const_iterator SBMLReference::const_iterator

Definition at line 22 of file SBMLReference.h.

Constructor & Destructor Documentation

SBMLReference::SBMLReference ( )

Default constructor

Definition at line 19 of file SBMLReference.cpp.

19  :
20  mURL(""),
21  mIdToKey(),
22  mKeyToId()
23 {}
std::map< std::string, std::string > mIdToKey
std::map< std::string, std::string > mKeyToId
std::string mURL
SBMLReference::SBMLReference ( const SBMLReference src)

copy constructor

Definition at line 25 of file SBMLReference.cpp.

25  :
26  mURL(src.mURL),
27  mIdToKey(src.mIdToKey),
28  mKeyToId(src.mKeyToId)
29 {}
std::map< std::string, std::string > mIdToKey
std::map< std::string, std::string > mKeyToId
std::string mURL
SBMLReference::~SBMLReference ( )

Default constructor

Definition at line 31 of file SBMLReference.cpp.

32 {}

Member Function Documentation

bool SBMLReference::add ( const std::string &  id,
const std::string &  key 
)

Add an associated SBMLid, COPASIkey pair to the references.

Parameters
conststd::string & id
conststd::string & key
Returns
bool success

Definition at line 61 of file SBMLReference.cpp.

References mIdToKey, and mKeyToId.

62 {
63  if (mIdToKey.find(id) != mIdToKey.end() ||
64  mKeyToId.find(key) != mKeyToId.end()) return false;
65 
66  mIdToKey[id] = key;
67  mKeyToId[key] = id;
68 
69  return true;
70 }
std::map< std::string, std::string > mIdToKey
std::map< std::string, std::string > mKeyToId
const char * id
Definition: stdsoap2.h:1262
SBMLReference::const_iterator SBMLReference::beginCOPASIkey ( ) const

Definition at line 105 of file SBMLReference.cpp.

References mKeyToId.

106 {return mKeyToId.begin();}
std::map< std::string, std::string > mKeyToId
SBMLReference::const_iterator SBMLReference::beginSBMLid ( ) const

Definition at line 111 of file SBMLReference.cpp.

References mIdToKey.

112  {return mIdToKey.begin();}
std::map< std::string, std::string > mIdToKey
SBMLReference::const_iterator SBMLReference::endCOPASIkey ( ) const

Definition at line 108 of file SBMLReference.cpp.

References mKeyToId.

109  {return mKeyToId.end();}
std::map< std::string, std::string > mKeyToId
SBMLReference::const_iterator SBMLReference::endSBMLid ( ) const

Definition at line 114 of file SBMLReference.cpp.

References mIdToKey.

115  {return mIdToKey.end();}
std::map< std::string, std::string > mIdToKey
const std::string & SBMLReference::getCOPASIkey ( const std::string &  id) const

Retrieve the COPASI key which is mapped to the given SBML Id.

Parameters
conststd::string & id
Returns
const std::string & key ("" if no map is found)

Definition at line 52 of file SBMLReference.cpp.

References mIdToKey, and NotFound.

53  {
54  const_iterator it = mIdToKey.find(id);
55  if (it != mIdToKey.end())
56  return it->second;
57  else
58  return NotFound;
59  }
static std::string NotFound
std::map< std::string, std::string >::const_iterator const_iterator
Definition: SBMLReference.h:22
std::map< std::string, std::string > mIdToKey
const std::string & SBMLReference::getSBMLid ( const std::string &  key) const

Retrieve the SBML Id which is mapped to the given COPASI key.

Parameters
conststd::string & key
Returns
const std::string & id ("" if no map is found)

Definition at line 43 of file SBMLReference.cpp.

References mKeyToId, and NotFound.

44  {
45  const_iterator it = mKeyToId.find(key);
46  if (it != mKeyToId.end())
47  return it->second;
48  else
49  return NotFound;
50  }
static std::string NotFound
std::map< std::string, std::string >::const_iterator const_iterator
Definition: SBMLReference.h:22
std::map< std::string, std::string > mKeyToId
const std::string & SBMLReference::getURL ( ) const

Retrieve the URL of the referenced SBML file

Returns
const std::string & url

Definition at line 40 of file SBMLReference.cpp.

References mURL.

41  {return mURL;}
std::string mURL
bool SBMLReference::removeCOPASIkey ( const std::string &  key)

Remove the reference of the given key

Parameters
conststd::string & key
Returns
bool success

Definition at line 88 of file SBMLReference.cpp.

References mIdToKey, and mKeyToId.

89 {
90  std::map<std::string, std::string>::iterator itKey = mKeyToId.find(key);
91 
92  if (itKey == mKeyToId.end()) return false;
93 
94  std::map<std::string, std::string>::iterator itId = mIdToKey.find(itKey->second);
95 
96  mKeyToId.erase(itKey);
97 
98  if (itId == mIdToKey.end()) return false;
99 
100  mIdToKey.erase(itId);
101 
102  return true;
103 }
std::map< std::string, std::string > mIdToKey
std::map< std::string, std::string > mKeyToId
bool SBMLReference::removeSBMLid ( const std::string &  id)

Remove the reference of the given id

Parameters
conststd::string & id
Returns
bool success

Definition at line 72 of file SBMLReference.cpp.

References mIdToKey, and mKeyToId.

73 {
74  std::map<std::string, std::string>::iterator itId = mIdToKey.find(id);
75  if (itId == mIdToKey.end()) return false;
76 
77  std::map<std::string, std::string>::iterator itKey = mKeyToId.find(itId->second);
78 
79  mIdToKey.erase(itId);
80 
81  if (itKey == mKeyToId.end()) return false;
82 
83  mKeyToId.erase(itKey);
84 
85  return true;
86 }
std::map< std::string, std::string > mIdToKey
std::map< std::string, std::string > mKeyToId
bool SBMLReference::setURL ( const std::string &  url)

Set URL of the refernced SBML file.

Parameters
conststd::string & id
Returns
bool success

Definition at line 34 of file SBMLReference.cpp.

References mURL.

35 {
36  mURL = url;
37  return true;
38 }
std::string mURL

Member Data Documentation

std::map<std::string, std::string> SBMLReference::mIdToKey
private
std::map<std::string, std::string> SBMLReference::mKeyToId
private
std::string SBMLReference::mURL
private

Definition at line 115 of file SBMLReference.h.

Referenced by getURL(), and setURL().

std::string SBMLReference::NotFound = ""
staticprivate

Definition at line 127 of file SBMLReference.h.

Referenced by getCOPASIkey(), and getSBMLid().


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