本文整理汇总了C++中CCopasiObject类的典型用法代码示例。如果您正苦于以下问题:C++ CCopasiObject类的具体用法?C++ CCopasiObject怎么用?C++ CCopasiObject使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CCopasiObject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SliderSettingsDialog
void SliderDialog::editSlider()
{
SliderSettingsDialog* pSettingsDialog = new SliderSettingsDialog(this);
// set the list of sliders that is already known
CCopasiObject* object = (CCopasiObject*)getTaskForFolderId(mCurrentFolderId);
if (!object) return;
CCopasiDataModel * pDataModel = object->getObjectDataModel();
assert(pDataModel != NULL);
pSettingsDialog->setModel(pDataModel->getModel());
std::vector<CSlider*>* pVector = getCSlidersForCurrentFolderId();
pSettingsDialog->setDefinedSliders(*pVector);
//pSettingsDialog->disableObjectChoosing(true);
pSettingsDialog->setSlider(mpCurrSlider->getCSlider());
if (pSettingsDialog->exec() == QDialog::Accepted)
{
addSlider(pSettingsDialog->getSlider());
mpCurrSlider->updateSliderData();
/*
if ((!mpCurrSlider->isEnabled()) && mpCurrSlider->getCSlider()->compile())
{
mpCurrSlider->setEnabled(true);
}
*/
}
delete pSettingsDialog;
delete pVector;
}
示例2: hasValidModelReference
/**
* This method is used for the export of several layout elements.
* Layout elements can reference model elements, but when a referenced model element
* is deleted, the layout is not infomred about this yet, so we end up with dnagling
* references.
* In order to not write these dangling references to file, we check if the reference
* belongs to a valid object in the same datamodel. If not, we issue a warning.
* This warning is only issued once during a save process.
*
* If the key belongs to an object in the same datamodel, true is returned, else false is returned.
*/
bool CLGraphicalObject::hasValidModelReference() const
{
bool result = false;
// check if the object for this key actually exists
// TODO This is only a workaround because it is theoretically
// TODO possible that the key no longer belongs to the same object it
// TODO originally did.
CCopasiObject* pObj = CCopasiRootContainer::getKeyFactory()->get(this->mModelObjectKey);
if (pObj != NULL)
{
// check if the object actually belongs to the same
// model as the text glyph
const CCopasiDataModel* pDM1 = NULL;
const CCopasiDataModel* pDM2 = NULL;
const CCopasiContainer* pParent = pObj->getObjectParent();
while (pParent != NULL)
{
pDM1 = dynamic_cast<const CCopasiDataModel*>(pParent);
if (pDM1 != NULL)
{
break;
}
pParent = pParent->getObjectParent();
}
pParent = this->getObjectParent();
while (pParent != NULL)
{
pDM2 = dynamic_cast<const CCopasiDataModel*>(pParent);
if (pDM2 != NULL)
{
break;
}
pParent = pParent->getObjectParent();
}
//assert(pDM2 != NULL);
if (pDM1 != NULL && pDM2 == NULL)
{
// if we have been able to resolve the model reference, but
// don't have a datamodel parent, that is good enough
return true;
}
if (pDM1 != NULL && pDM1 == pDM2)
{
result = true;
}
}
return result;
}
示例3: getModelObject
std::string CLGraphicalObject::getModelObjectName() const
{
CCopasiObject * tmp = getModelObject();
if (tmp)
return tmp->getObjectName();
else
return "";
}
示例4: getXPathAndName
std::string
SEDMLUtils::getXPathForObject(const CCopasiObject& object)
{
const std::string& type = object.getObjectName();
const CCopasiDataModel* dm = object.getObjectDataModel();
std::string yAxis = object.getObjectDisplayName();
std::string targetXPathString = getXPathAndName(yAxis, type,
dm->getModel(), *dm);
return targetXPathString;
}
示例5: CExpression
bool CModelAdd::copyInitialExpression(const CModelEntity * sourceEntity, CModelEntity * newEntity)
{
bool info = false;
const CExpression* pExpression = sourceEntity->getInitialExpressionPtr();
if (pExpression == NULL) return info;
CExpression* tmp;
tmp = new CExpression(*pExpression, mmModel);
const std::vector<CEvaluationNode*>& objectNodes = tmp->getNodeList();
size_t j, jmax = objectNodes.size();
for (j = 0; j < jmax; ++j)
{
if (CEvaluationNode::type(objectNodes[j]->getType()) == CEvaluationNode::OBJECT)
{
CEvaluationNodeObject* pObjectNode = dynamic_cast<CEvaluationNodeObject*>(objectNodes[j]);
if (pObjectNode == NULL) return info;
CCopasiObjectName cn = pObjectNode->getObjectCN();
const CCopasiObject* mObject =
static_cast< const CCopasiObject * >(mmModel->getObjectDataModel()->getObject(cn));
if (mObject == NULL) return info;
std::string host = "";
if (mObject->isReference())
{
host = ",Reference=" + mObject->getObjectName();
mObject = mObject->getObjectParent();
}
if (mObject == NULL) return info;
std::string key = keyMap[(dynamic_cast<const CModelEntity * >(mObject))->getKey()];
CCopasiObject* pObject = (CCopasiRootContainer::getKeyFactory()->get(key));
cn = pObject->getCN() + host;
pObjectNode->setData("<" + cn + ">");
}
}
tmp->updateTree();
newEntity->setInitialExpression(tmp->getInfix().c_str());
return info;
}
示例6: mergeInExpression
bool CModelMerging::mergeInExpression(std::string toKey, std::string key, CExpression *pExpression)
{
bool info = false;
if (pExpression == NULL) return info;
const std::vector<CEvaluationNode*>& objectNodes = pExpression->getNodeList();
size_t j, jmax = objectNodes.size();
for (j = 0; j < jmax; ++j)
{
if (CEvaluationNode::type(objectNodes[j]->getType()) == CEvaluationNode::OBJECT)
{
CEvaluationNodeObject* pObjectNode = dynamic_cast<CEvaluationNodeObject*>(objectNodes[j]);
if (pObjectNode == NULL) return info;
CCopasiObjectName cn = pObjectNode->getObjectCN();
const CCopasiObject* mObject =
static_cast< const CCopasiObject * >(mpModel->getObjectDataModel()->getObject(cn));
if (mObject == NULL) return info;
std::string host = "";
if (mObject->isReference())
{
host = ",Reference=" + mObject->getObjectName();
mObject = mObject->getObjectParent();
}
if (mObject == NULL) return info;
CCopasiObject* pObject;
std::string ikey = (dynamic_cast<const CModelEntity * >(mObject))->getKey();
if (ikey == key)
{
pObject = (CCopasiRootContainer::getKeyFactory()->get(toKey));
cn = pObject->getCN() + host;
pObjectNode->setData("<" + cn + ">");
}
}
}
pExpression->updateTree();
return true;
}
示例7: CTotalNumberReference
void CMoiety::initObjects()
{
mpINumberReference = new CTotalNumberReference("InitialValue", this, mINumber);
mpNumberReference = new CTotalNumberReference("Value", this, mNumber);
mpDNumberReference = new CDependentNumberReference("DependentValue", this, mNumber);
mpDNumberReference->addDirectDependency(this);
CCopasiObject * pObject = addObjectReference("Amount", mIAmount, CCopasiObject::ValueDbl);
pObject->addDirectDependency(mpNumberReference);
return;
}
示例8: getObjectDataModel
/**
* Returns a pointer to the CCopasiDataModel the element belongs to.
* If there is no instance of CCopasiDataModel in the ancestor tree, NULL
* is returned.
*/
CCopasiDataModel* CCopasiObject::getObjectDataModel()
{
CCopasiObject * pObject = this;
while (pObject != NULL)
{
if (pObject->isDataModel())
return static_cast<CCopasiDataModel *>(pObject);
pObject = pObject->getObjectParent();
}
return NULL;
}
示例9: pdelete
void CMIRIAMInfo::load(const std::string& key)
{
pdelete(mpRDFGraph);
mKey = key;
CCopasiObject * pCopasiObject = dynamic_cast< CCopasiObject * >(CCopasiRootContainer::getKeyFactory()->get(mKey));
if (pCopasiObject != NULL)
{
const std::string * pMiriamAnnotation = NULL;
CAnnotation * pAnnotation = CAnnotation::castObject(pCopasiObject);
if (pAnnotation != NULL)
{
pMiriamAnnotation = &pAnnotation->getMiriamAnnotation();
}
if (pMiriamAnnotation && *pMiriamAnnotation != "")
mpRDFGraph = CRDFParser::graphFromXml(*pMiriamAnnotation);
}
if (mpRDFGraph == NULL)
mpRDFGraph = new CRDFGraph;
// We make sure that we always have an about node.
if (pCopasiObject != NULL)
mTriplet.pObject = mpRDFGraph->createAboutNode(pCopasiObject->getKey());
else
mTriplet.pObject = mpRDFGraph->createAboutNode("");
// Load the created date if set;
CRDFPredicate::Path Path = mTriplet.pObject->getPath();
std::set< CRDFTriplet > Triples =
mTriplet.pObject->getDescendantsWithPredicate(CRDFPredicate::dcterms_created);
if (Triples.size() > 0)
mCreated = *Triples.begin();
else
mCreated = CRDFTriplet(); // This is an invalid triplet, i.e., !mCreated is true.
loadCreators();
loadReferences();
loadModifications();
loadBiologicalDescriptions();
return;
}
示例10: while
void ObjectBrowserWidget::loadField(ObjectBrowserItem* parent, CCopasiVector <CCopasiObject>* copaParent)
{
unsigned int i;
ObjectBrowserItem* lastFieldItem = NULL;
CCopasiObject* currentFieldObject = NULL;
ObjectBrowserItem* lastObjectItem = NULL;
CCopasiObject* currentObject = NULL;
if ((copaParent->size() < 1) || (!(*copaParent)[0]->isContainer())) return; //empty list
const CCopasiContainer::objectMap * pFieldList =
&(static_cast< CCopasiContainer * >((*copaParent)[0])->getObjects());
CCopasiContainer::objectMap::const_iterator fieldIt = pFieldList->begin();
CCopasiContainer::objectMap::const_iterator fieldEnd = pFieldList->end();
while (fieldIt != fieldEnd)
{
currentFieldObject = fieldIt->second;
ObjectBrowserItem* currentFieldItem = new ObjectBrowserItem(parent, lastFieldItem, NULL, objectItemList);
currentFieldItem->attachKey();
currentFieldItem->setObjectType(FIELDATTR);
currentFieldItem->setText(0, FROM_UTF8(currentFieldObject->getObjectName()));
lastFieldItem = currentFieldItem;
lastObjectItem = NULL;
for (i = 0; i < copaParent->size(); i++)
{
CCopasiObject* pSubField;
currentObject = (*static_cast< CCopasiVector < CCopasiObject > * >(copaParent))[i];
if (currentObject->isContainer())
pSubField =
getFieldCopasiObject(static_cast< CCopasiContainer * >(currentObject),
FROM_UTF8(currentFieldObject->getObjectName()));
else
{
pSubField = NULL; // this shall be an exception error
}
ObjectBrowserItem* currentItem = new ObjectBrowserItem(currentFieldItem, lastObjectItem, pSubField, objectItemList);
currentItem->setText(0, FROM_UTF8(currentObject->getObjectName()));
// if ((pSubField)&&(pSubField->isVector()))
// currentItem->setText(0, currentItem->text(0) + "[]");
currentItem->setObjectType(FIELDATTR);
currentItem->attachKey();
if (pSubField)
if (pSubField->isContainer()) //container field recursively to find all possible items
{
loadChild(currentItem, static_cast< CCopasiContainer * >(pSubField), false); // wont show the attribute and field list
}
lastObjectItem = currentItem;
}
fieldIt++;
}
}
示例11: size
bool CExperimentObjectMap::compile(const std::vector< CCopasiContainer * > listOfContainer)
{
size_t i, imax = size();
size_t Column;
// We need to find out the size of the object map
if (imax == 0)
mLastColumn = C_INVALID_INDEX;
else
{
mLastColumn = strtoul(getName(0).c_str(), NULL, 0);
for (i = 1; i < imax; i++)
{
Column = strtoul(getName(i).c_str(), NULL, 0);
if (mLastColumn < Column)
mLastColumn = Column;
}
}
mObjects.resize(mLastColumn + 1);
mObjects = NULL;
CCopasiObject * pObject = NULL;
std::string CN;
for (i = 0; i < imax; i++)
{
if ((CN = getObjectCN(i)) == "") continue;
if ((pObject =
getObjectDataModel()->ObjectFromName(listOfContainer, CN)) != NULL &&
pObject->isValueDbl())
{
Column = strtoul(getName(i).c_str(), NULL, 0);
mObjects[Column] = pObject;
}
else
return false;
}
return true;
}
示例12: getText
/**
* Since labels are not part of the model, we can't use the new method for
* getting the text but have to fall back to the old
* behavior.
* Hopefully I can get rid of this implementation sonner than later.
*/
std::string CLabel::getText() const
{
if (mIsTextSet)
{
return mText;
}
else
{
CCopasiObject* pObject = CCopasiRootContainer::getKeyFactory()->get(this->mModelObjectKey);
if (pObject)
{
return pObject->getObjectName();
}
else
{
return "unset";
}
}
}
示例13: printNameForKey
void printNameForKey(std::ostringstream& stream, CKeyFactory* kf, const std::string& key, const std::string prefix = "")
{
CCopasiObject* obj = kf->get(key);
if (obj != NULL)
{
stream << "\"" << prefix << obj->getObjectName() << "\", ";
}
else if (startsWith(key, "sm_"))
{
printNameForKey(stream, kf, key.substr(3), "");
}
else if (startsWith(key, "ode_"))
{
printNameForKey(stream, kf, key.substr(4), "ODE ");
}
else
{
stream << "\"" << prefix << key << "\", ";
}
}
示例14:
std::vector<CCopasiObject*> CSensItem::getVariablesPointerList(CCopasiDataModel* pDataModel)
{
std::vector<CCopasiObject*> ret;
if (isSingleObject())
{
CCopasiObject * tmpObject = const_cast<CCopasiObject *>(pDataModel->getObject(getSingleObjectCN()));
if (!tmpObject) {return ret;} //return empty list
if (!tmpObject->isValueDbl()) {return ret;} //return empty list
ret.push_back(tmpObject);
}
else
{
ret = CObjectLists::getListOfObjects(getListType(), pDataModel->getModel());
}
return ret;
}
示例15: assert
void DefaultPlotDialog::slotCreate()
{
if (!mpTask) return;
CCopasiDataModel* pDataModel = ListViews::dataModel(parent());
assert(pDataModel != NULL);
CCopasiObject* result = COutputAssistant::createDefaultOutput(mIndex, mpTask, pDataModel);
if (result != NULL)
{
QString current = lineEditTitle->text();
int count = 0;
while (!result->setObjectName(TO_UTF8(current)))
current = QString("%1 %2").arg(lineEditTitle->text()).arg(++count);
this->accept();
}
else
this->reject();
}