int KMonster::Init(MONSTER_PARAM &rParam) { int nResult = FALSE; int nRetCode = FALSE; m_MonsterParam = rParam; m_piOperator = CreateSimulator(ostGeneral, this); KG_PROCESS_ERROR(m_piOperator); nRetCode = m_Eyeshot.Init(this); KG_PROCESS_ERROR(nRetCode); nRetCode = m_PlayerClient.Init(this); KG_PROCESS_ERROR(nRetCode); nRetCode = m_BishopClient.Init(this); KG_PROCESS_ERROR(nRetCode); m_nExitFlag = FALSE; nRetCode = m_WorkThread.Create(WorkThreadFunction, (void *)this); KG_PROCESS_ERROR(nRetCode); m_nThreadFlag = TRUE; nResult = TRUE; Exit0: return nResult; }
CStdSerialize *RbClassFactory::CreateObject(std::string strClassType, std::string strObjectType, bool bThrowError) { CStdSerialize *lpObject=NULL; strClassType = Std_ToUpper(Std_Trim(strClassType)); if(strClassType == "RIGIDBODY") lpObject = CreateRigidBody(strObjectType, bThrowError); else if(strClassType == "JOINT") lpObject = CreateJoint(strObjectType, bThrowError); else if(strClassType == "ORGANISM") lpObject = CreateStructure(strObjectType, bThrowError); else if(strClassType == "STRUCTURE") lpObject = CreateStructure(strObjectType, bThrowError); else if(strClassType == "SIMULATOR") lpObject = CreateSimulator(strObjectType, bThrowError); else if(strClassType == "KEYFRAME") lpObject = CreateKeyFrame(strObjectType, bThrowError); else if(strClassType == "DATACHART") lpObject = CreateDataChart(strObjectType, bThrowError); else if(strClassType == "DATACOLUMN") lpObject = CreateDataColumn(strObjectType, bThrowError); else if(strClassType == "EXTERNALSTIMULUS") lpObject = CreateExternalStimulus(strObjectType, bThrowError); else if(strClassType == "ADAPTER") lpObject = CreateAdapter(strObjectType, bThrowError); else if(strClassType == "GAIN") lpObject = CreateGain(strObjectType, bThrowError); else if(strClassType == "HUDITEM") lpObject = CreateHudItem(strObjectType, bThrowError); else if(strClassType == "HUD") lpObject = CreateHud(strObjectType, bThrowError); else if(strClassType == "MATERIAL") lpObject = CreateMaterialItem(strObjectType, bThrowError); else if(strClassType == "SIMULATIONWINDOW") lpObject = CreateWindowItem(strObjectType, bThrowError); else if(strClassType == "LIGHT") lpObject = CreateLight(strObjectType, bThrowError); else if(strClassType == "NEURALMODULE") lpObject = CreateNeuralModule(strObjectType, bThrowError); else if(strClassType == "CONSTRAINTRELAXATION") lpObject = CreateConstraintRelaxation(strObjectType, bThrowError); else if(strClassType == "CONSTRAINTFRICTION") lpObject = CreateConstraintFriction(strObjectType, bThrowError); else if(strClassType == "ROBOTINTERFACE") lpObject = CreateRobotInterface(strObjectType, bThrowError); else if(strClassType == "ROBOTIOCONTROL") lpObject = CreateRobotIOControl(strObjectType, bThrowError); else if(strClassType == "ROBOTPARTINTERFACE") lpObject = CreateRobotPartInterface(strObjectType, bThrowError); else if(strClassType == "REMOTECONTROLLINKAGE") lpObject = CreateRemoteControlLinkage(strObjectType, bThrowError); else { lpObject = NULL; if(bThrowError) THROW_PARAM_ERROR(Std_Err_lInvalidClassType, Std_Err_strInvalidClassType, "ClassType", strClassType); } return lpObject; }