本文整理汇总了C++中Application::GetCurrentUser方法的典型用法代码示例。如果您正苦于以下问题:C++ Application::GetCurrentUser方法的具体用法?C++ Application::GetCurrentUser怎么用?C++ Application::GetCurrentUser使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Application
的用法示例。
在下文中一共展示了Application::GetCurrentUser方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InitHandler
bool PowerHandler::InitHandler(const char* prj_name, const char* case_name, double sim_time, double sim_period)
{
_instance = _api_fixture->GetInstance(); //ApiFixture is responsible for creation/destruction api instance
if (!_instance) {
//std::cout << "InitHandler, error:ApiFixture::GetInstance()" << std::endl;
return false;
}
int ret = 0;
Application* app = _instance->GetApplication();
DataObject* user = app->GetCurrentUser();
DataObject* prj = GetProject(user, prj_name);
DataObject* e_case = GetCaseObject(prj, case_name);
Value v_prj(prj);
Value v_case(e_case);
if (prj != app->GetActiveProject()){
app->Execute("Activate", &v_prj, &ret); //激活项目
if (ret > 0){
//std::cout << "InitHandler, error: Execute v_prj" << std::endl;
return false;
}
}
if (e_case != app->GetActiveStudyCase()){
app->Execute("Activate", &v_case, &ret);//激活项目
if (ret > 0){
// std::cout << "InitHandler, error: Execute v_case" << std::endl;
return false;
}
}
//delete the last EvtParam for no influencing the next simulation
Value v_ev("IntEvt");
ValueGuard int_ev(app->Execute("GetCaseObject", &v_ev));
DataObject* events = int_ev->GetDataObject();
DataObjVec folders = Utils::GetChildren(events, "EvtParam");
DataObjVec::iterator it = folders.begin();
for (; it != folders.end(); ++it) {
DataObject* folder = *it;
folder->DeleteObject();
}
_sim_time = sim_time;
_sim_period = sim_period;
//std::cout << "InitHandler, success." << std::endl;
return true;
}