COPASI API  4.16.103
Public Member Functions | Protected Attributes | List of all members
CModelExpansion::ElementsMap Class Reference

#include <CModelExpansion.h>

Collaboration diagram for CModelExpansion::ElementsMap:
Collaboration graph
[legend]

Public Member Functions

void add (const CCopasiObject *source, CCopasiObject *copy)
 add a source->duplicate mapping More...
 
bool exists (const CCopasiObject *source) const
 does a copy of the source object exist? More...
 
bool exists (const std::string &sourceKey) const
 
std::string getDuplicateKey (const std::string &sourceKey) const
 find the key of the duplicated object from the source object (if it exists) More...
 
CCopasiObjectgetDuplicatePtr (const CCopasiObject *source) const
 find the pointer of the duplicated object from the pointer to the source object (if it exists) More...
 
const std::map< const
CCopasiObject *, CCopasiObject * > & 
getMap () const
 

Protected Attributes

std::map< const CCopasiObject
*, CCopasiObject * > 
mMap
 

Detailed Description

This class contains a map from original to duplicated sets of model elements

Definition at line 90 of file CModelExpansion.h.

Member Function Documentation

void CModelExpansion::ElementsMap::add ( const CCopasiObject source,
CCopasiObject copy 
)
bool CModelExpansion::ElementsMap::exists ( const CCopasiObject source) const

does a copy of the source object exist?

Definition at line 209 of file CModelExpansion.cpp.

Referenced by CModelExpansion::duplicateCompartment(), CModelExpansion::duplicateEvent(), CModelExpansion::duplicateGlobalQuantity(), CModelExpansion::duplicateMetab(), CModelExpansion::duplicateReaction(), CModelExpansion::replaceInMetab(), and CModelExpansion::updateExpression().

210 {
211  std::map<const CCopasiObject*, CCopasiObject*>::const_iterator it;
212  it = mMap.find(source);
213  return (it != mMap.end() && it->second != NULL);
214 }
std::map< const CCopasiObject *, CCopasiObject * > mMap
bool CModelExpansion::ElementsMap::exists ( const std::string &  sourceKey) const

Definition at line 216 of file CModelExpansion.cpp.

References CKeyFactory::get(), and CCopasiRootContainer::getKeyFactory().

217 {
218  const CCopasiObject* tmp = CCopasiRootContainer::getKeyFactory()->get(sourceKey);
219  return exists(tmp);
220 }
CCopasiObject * get(const std::string &key)
static CKeyFactory * getKeyFactory()
bool exists(const CCopasiObject *source) const
does a copy of the source object exist?
std::string CModelExpansion::ElementsMap::getDuplicateKey ( const std::string &  sourceKey) const

find the key of the duplicated object from the source object (if it exists)

Definition at line 238 of file CModelExpansion.cpp.

References CKeyFactory::get(), CCopasiObject::getKey(), and CCopasiRootContainer::getKeyFactory().

Referenced by CQSpeciesDetail::copy(), CQCompartment::copy(), ReactionsWidget1::copy(), CModelExpansion::duplicateEvent(), CModelExpansion::duplicateReaction(), CModelExpansion::replaceInEvent(), CModelExpansion::replaceInReaction(), and CModelExpansion::simpleCall().

239 {
240  const CCopasiObject* tmp = CCopasiRootContainer::getKeyFactory()->get(sourceKey);
241 
242  if (tmp)
243  {
244  const CCopasiObject* retObj = getDuplicatePtr(tmp);
245 
246  if (retObj)
247  return retObj->getKey();
248  else
249  return "";
250  }
251  else
252  return "";
253 }
CCopasiObject * get(const std::string &key)
virtual const std::string & getKey() const
static CKeyFactory * getKeyFactory()
CCopasiObject * getDuplicatePtr(const CCopasiObject *source) const
find the pointer of the duplicated object from the pointer to the source object (if it exists) ...
CCopasiObject * CModelExpansion::ElementsMap::getDuplicatePtr ( const CCopasiObject source) const

find the pointer of the duplicated object from the pointer to the source object (if it exists)

Definition at line 227 of file CModelExpansion.cpp.

Referenced by CModelExpansion::duplicateMetab(), CModelExpansion::duplicateReaction(), CModelExpansion::replaceInExpression(), CModelExpansion::replaceInMetab(), CModelExpansion::replaceInReaction(), and CModelExpansion::updateExpression().

228 {
229  std::map<const CCopasiObject*, CCopasiObject*>::const_iterator it;
230  it = mMap.find(source);
231 
232  if (it != mMap.end())
233  return it->second;
234  else
235  return NULL;
236 }
std::map< const CCopasiObject *, CCopasiObject * > mMap
const std::map< const CCopasiObject *, CCopasiObject * > & CModelExpansion::ElementsMap::getMap ( ) const

Definition at line 255 of file CModelExpansion.cpp.

Referenced by CModelExpansion::copyCompleteModel(), and CModelExpansion::replaceInModel().

256 {
257  return mMap;
258 }
std::map< const CCopasiObject *, CCopasiObject * > mMap

Member Data Documentation

std::map<const CCopasiObject*, CCopasiObject*> CModelExpansion::ElementsMap::mMap
protected

Definition at line 111 of file CModelExpansion.h.


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