本文整理汇总了C++中Program::Id方法的典型用法代码示例。如果您正苦于以下问题:C++ Program::Id方法的具体用法?C++ Program::Id怎么用?C++ Program::Id使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Program
的用法示例。
在下文中一共展示了Program::Id方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: StopProgram
int ProgramManager::StopProgram( int programId )
{
Process* process = this->runningPrograms[programId];
if ( process == NULL )
{
EventLogger::Instance()->WriteVerbose( "Program with id %d is not started!", programId );
return ERROR_PRNOTSTARTED_ID;
}
Program* program = process->GetProgram();
if ( program == NULL )
{
EventLogger::Instance()->WriteVerbose( "Program with id %d is not started!", programId );
return ERROR_PRNOTSTARTED_ID;
}
process->Stop();
// to do !!!
MappingManager::Instance()->FinalizeProgram( program );
// delete process & program;
// delete this->runningPrograms[program->Id()];
this->runningPrograms[program->Id()] = NULL;
this->runningPrograms.erase( program->Id() );
return 0;
}
示例2: Remove
bool Programs::Remove(const Program& program)
{
Programs::iterator it = std::find(m_programs.begin(), m_programs.end(), program.Id());
if (it != m_programs.end())
{
m_programs.erase(it);
return true;
}
return false;
}
示例3: LoadProgram
void ProgramManager::LoadProgram( string programName, string mappingName )
{
string storageFolderPath = Configuration::Instance()->GetStringParam(
PROGRAMS_STORAGE_DIR );
string programSavePath = storageFolderPath + "/" + programName;
string mappingSavePath = storageFolderPath + "/" + mappingName;
string programDefinition = DataSerializationManager::Load( programSavePath.c_str() );
string mappingDefinition = DataSerializationManager::Load( mappingSavePath.c_str() );
Program* program = UpcbJsonParser::Instance()->ParseProgram( programDefinition );
if( program == NULL )
return;
this->availablePrograms[program->Id()] = programDefinition;
this->programMappings[program->Id()] = mappingDefinition;
//delete program;
}
示例4: HandleError
void ProgramManager::HandleError( void* sender, ErrorItem* error)
{
Process* process = ( Process* )sender;
if( process == NULL )
return;
Program* program = process->GetProgram();
if ( program == NULL )
{
EventLogger::Instance()->WriteVerbose( "Program with id %d is still not started but an Error in the process with the same id is found!", program->Id() );
return;
}
process->Stop();
// to do !!!
MappingManager::Instance()->FinalizeProgram( program );
// delete process & program;
// delete this->runningPrograms[program->Id()];
this->runningPrograms[program->Id()] = NULL;
this->runningPrograms.erase( program->Id() );
}
示例5: AddProgram
void ProgramManager::AddProgram( string json )
{
Program* program = UpcbJsonParser::Instance()->ParseProgram( json );
if( program == NULL )
return;
this->availablePrograms[program->Id()] = json;
//delete program;
//Save Program & Mapping:
string storageFolderPath = Configuration::Instance()->GetStringParam( PROGRAMS_STORAGE_DIR );
struct stat st;
if ( stat( storageFolderPath.c_str(), &st ) != 0 )
mkdir( storageFolderPath.c_str(), 0777 );
string programSavePath = storageFolderPath + "/" + program->Name() + ".xml";
DataSerializationManager::Save( json, programSavePath.c_str() );
}