本文整理汇总了C++中ObjRef::componentName方法的典型用法代码示例。如果您正苦于以下问题:C++ ObjRef::componentName方法的具体用法?C++ ObjRef::componentName怎么用?C++ ObjRef::componentName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ObjRef
的用法示例。
在下文中一共展示了ObjRef::componentName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getReport
std::wstring CompactorReport::getReport() const
{
std::wstringstream report;
report << L"Model Compaction Report\n"
<< L"=======================\n\n";
if (! mErrorMessage.empty()) report << L"Error message: " << mErrorMessage << L"\n\n";
std::wstring indent = L"";
if (mVariableForCompaction.size() > 0)
{
report << L"Some variables have not been compacted.\n"
<< L"Uncompacted variables are given below.\n\n";
for (size_t i=0; i<mVariableForCompaction.size(); ++i)
{
ObjRef<iface::cellml_api::CellMLVariable> variable = mVariableForCompaction[i].first;
ObjRef<iface::cellml_api::CellMLVariable> srcVariable = mVariableForCompaction[i].second;
std::wstring modelUri = variable->modelElement()->base_uri()->asText();
std::wstring srcModelUri = srcVariable->modelElement()->base_uri()->asText();
for (size_t j=0;j<i;++j) indent += L"\t";
report << indent << L"Compaction requested for variable: " << modelUri << L" # "
<< variable->componentName() << L" / "
<< variable->name() << L";\n" << indent << L"with the actual source variable being: "
<< srcModelUri << L" # " << srcVariable->componentName() << L" / " << srcVariable->name() << L"\n";
}
}
report.flush();
return report.str();
}
示例2: if
void
WriteCode(iface::cellml_services::CodeInformation* cci, uint32_t useida)
{
iface::cellml_services::ModelConstraintLevel mcl =
cci->constraintLevel();
if (mcl == iface::cellml_services::UNDERCONSTRAINED)
{
ObjRef<iface::cellml_services::ComputationTarget> ctMissingIV(cci->missingInitial());
if (ctMissingIV != NULL)
{
ObjRef<iface::cellml_api::CellMLVariable> v = ctMissingIV->variable();
std::wstring n = v->name();
std::wstring c = v->componentName();
std::wstring str;
uint32_t deg = ctMissingIV->degree();
if (deg != 0)
{
str += L"d^";
wchar_t buf[20];
any_swprintf(buf, 20, L"%u", deg);
str += buf;
str += L"/dt^";
str += buf;
str += L" ";
}
str += n;
str += L" (in ";
str += c;
str += L")\n";
printf("/* Model is underconstrained due to missing initial_value on %S\n", str.c_str());
}
else
{
printf("/* Model is underconstrained.\n"
" * List of undefined targets follows...\n");
iface::cellml_services::ComputationTargetIterator* cti = cci->iterateTargets();
iface::cellml_services::ComputationTarget* ct;
std::vector<std::wstring> messages;
while (true)
{
ct = cti->nextComputationTarget();
if (ct == NULL)
break;
if (ct->type() != iface::cellml_services::FLOATING)
{
ct->release_ref();
continue;
}
iface::cellml_api::CellMLVariable* v = ct->variable();
std::wstring n = v->name();
std::wstring c = v->componentName();
std::wstring str = L" * * ";
uint32_t deg = ct->degree();
if (deg != 0)
{
str += L"d^";
wchar_t buf[20];
any_swprintf(buf, 20, L"%u", deg);
str += buf;
str += L"/dt^";
str += buf;
str += L" ";
}
str += n;
str += L" (in ";
str += c;
str += L")\n";
messages.push_back(str);
v->release_ref();
ct->release_ref();
}
cti->release_ref();
// Sort the messages...
std::sort(messages.begin(), messages.end());
std::vector<std::wstring>::iterator msgi;
for (msgi = messages.begin(); msgi != messages.end(); msgi++)
printf("%S", (*msgi).c_str());
printf(" */\n");
}
return;
}
else if (mcl == iface::cellml_services::OVERCONSTRAINED)
{
printf("/* Model is overconstrained.\n"
" * List variables defined at time of error follows...\n");
iface::cellml_services::ComputationTargetIterator* cti = cci->iterateTargets();
iface::cellml_services::ComputationTarget* ct;
std::vector<std::wstring> messages;
while (true)
{
ct = cti->nextComputationTarget();
if (ct == NULL)
break;
if (ct->type() == iface::cellml_services::FLOATING)
{
ct->release_ref();
continue;
}
iface::cellml_api::CellMLVariable* v = ct->variable();
std::wstring n = v->name();
//.........这里部分代码省略.........