本文整理汇总了C++中CKContext::CreateObject方法的典型用法代码示例。如果您正苦于以下问题:C++ CKContext::CreateObject方法的具体用法?C++ CKContext::CreateObject怎么用?C++ CKContext::CreateObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CKContext
的用法示例。
在下文中一共展示了CKContext::CreateObject方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BehaviourFunction
/*
*******************************************************************
* Function: int BehaviourFunction( const CKBehaviorContext& behaviorContext )
*
* Description : The execution function is the function that will be called
* during the process loop of the behavior engine, if the behavior
* is defined as using an execution function. This function is not
* called if the behavior is defined as a graph. This function is the
* heart of the behavior: it should compute the essence of the behavior,
* in an incremental way. The minimum amount of computing should be
* done at each call, to leave time for the other behaviors to run.
* The function receives the delay in milliseconds that has elapsed
* since the last behavioral process, and should rely on this value to
* manage the amount of effect it has on its computation, if the effect
* of this computation relies on time.
*
* Parameters :
* behaviourContext r Behavior context reference, which gives access to
* frequently used global objects ( context, level, manager, etc... )
*
* Returns : int, If it is done, it should return CKBR_OK. If it returns
* CKBR_ACTIVATENEXTFRAME, the behavior will again be called
* during the next process loop.
*
*******************************************************************
*/
int GBLPFGetTeamLeader::BehaviourFunction( const CKBehaviorContext& behaviorContext )
{
CKBehavior *behaviour=behaviorContext.Behavior;
CKContext *context = behaviorContext.Context;
CGBLCOError returnValue;
behaviour->ActivateInput(EGBLGetTeamLeaderBehInputs::In, false);
XString FieldName("TeamLeaderID");
CKDataArray* FieldData = (CKDataArray*)context->CreateObject(CKCID_DATAARRAY, "FieldData", CK_OBJECTCREATION_DYNAMIC);
CGBLTeamID TeamId ;
behaviour->GetInputParameterValue(EGBLGetTeamLeaderParamInputs::TeamId, &TeamId);
CGBLUserID PlayerId;
CGBLProfileManager *pm = (CGBLProfileManager *)context->GetManagerByGuid(GBLProfileManagerGUID);
returnValue = pm->GetProfileField((CGBLProfileID)TeamId, FieldName, (CKDataArray*)FieldData);
int value;
if(!FieldData->GetElementValue(0,0,&value))
{
returnValue = CGBLCOError::EGBLCOErrorType::GBLCO_LOCAL;
}
else
{
PlayerId = value;
}
if ((int)returnValue == CGBLCOError::EGBLCOErrorType::GBLCO_OK)
{
behaviour->ActivateOutput(EGBLGetTeamLeaderBehOutputs::Success, true);
behaviour->SetOutputParameterValue(EGBLGetTeamLeaderParamOutputs::UserID, &PlayerId);
}
else
{
CKParameterOut *pOut = behaviour->GetOutputParameter(EGBLGetTeamLeaderParamOutputs::ErrorCode);
CGBLCOError::EGBLCOErrorType tType = CGBLCOError::EGBLCOErrorType::GBLCO_OK ;
switch((CGBLCOError::EGBLCOErrorType)returnValue)
{
case 0:
tType = CGBLCOError::EGBLCOErrorType::GBLCO_OK;
break;
case 1:
tType = CGBLCOError::EGBLCOErrorType::GBLCO_FATAL;
break;
case 2:
tType = CGBLCOError::EGBLCOErrorType::GBLCO_LOCAL;
break;
case 3:
tType = CGBLCOError::EGBLCOErrorType::GBLCO_LOCAL;
break;
}
const char*errorString = returnValue;
TGBLError::SetTGBLError(pOut, tType,returnValue, (CKSTRING)errorString);
behaviour->ActivateOutput(EGBLGetTeamLeaderBehOutputs::Error, true);
}
context->DestroyObject(FieldData);
return CKBR_OK;
}
示例2: BehaviourFunction
/*
*******************************************************************
* Function: int BehaviourFunction( const CKBehaviorContext& behaviorContext )
*
* Description : The execution function is the function that will be called
* during the process loop of the behavior engine, if the behavior
* is defined as using an execution function. This function is not
* called if the behavior is defined as a graph. This function is the
* heart of the behavior: it should compute the essence of the behavior,
* in an incremental way. The minimum amount of computing should be
* done at each call, to leave time for the other behaviors to run.
* The function receives the delay in milliseconds that has elapsed
* since the last behavioral process, and should rely on this value to
* manage the amount of effect it has on its computation, if the effect
* of this computation relies on time.
*
* Paramters :
* behaviourContext r Behavior context reference, which gives access to
* frequently used global objects ( context, level, manager, etc... )
*
* Returns : int, If it is done, it should return CKBR_OK. If it returns
* CKBR_ACTIVATENEXTFRAME, the behavior will again be called
* during the next process loop.
*
*******************************************************************
*/
int CGBLLAEGetLA::BehaviourFunction( const CKBehaviorContext& behaviorContext )
{
CKBehavior* beh = behaviorContext.Behavior;
CKContext* ctx = behaviorContext.Context;
IGBLSMProfileAccess* pin = NULL;
CGBLSMStorageManager *storageManager = (CGBLSMStorageManager *)ctx->GetManagerByGuid(GBLSMStorageManagerGUID);
IGBLSMLAAccess *laInterface = storageManager->GetLAInterface();
char *arrayName = "laList";
CKDataArray* array;
array = (CKDataArray *)ctx->GetObjectByNameAndClass(arrayName,CKCID_DATAARRAY,NULL);
if ( !array )
{
array = (CKDataArray *)ctx->CreateObject(CKCID_DATAARRAY,arrayName, CK_OBJECTCREATION_DYNAMIC);
behaviorContext.CurrentLevel->AddObject( array );
array->InsertColumn( -1, CKARRAYTYPE_INT, "LAID" );
}
else
{
array->Clear();
}
CGBLCOError res = laInterface->RetrieveLAList(array);
if ( res == CGBLCOError::EGBLCOErrorType::GBLCO_OK)
{
beh->ActivateInput(0, FALSE);
beh->SetOutputParameterObject(0, array);
beh->ActivateOutput(0);
}
else
{
beh->ActivateInput(0, FALSE);
CKParameterOut *parameterOutError = beh->GetOutputParameter(1);
TGBLError::SetTGBLError(parameterOutError,CGBLCOError::EGBLCOErrorType::GBLCO_LOCAL,GBLLAE_ERROR_GETLISTOFLAIDS,GBLLAE_ERROR_GETLISTOFLAIDS_DESC);
beh->ActivateOutput(1);
}
return CKBR_OK;
}
示例3: CISIteratorBB
/*
*******************************************************************
* Function: int CISIteratorBB( const CKBehaviorContext& behaviorContext )
*
* Description : The execution function is the function that will be called
* during the process loop of the behavior engine, if the behavior
* is defined as using an execution function. This function is not
* called if the behavior is defined as a graph. This function is the
* heart of the behavior: it should compute the essence of the behavior,
* in an incremental way. The minimum amount of computing should be
* done at each call, to leave time for the other behaviors to run.
* The function receives the delay in milliseconds that has elapsed
* since the last behavioral process, and should rely on this value to
* manage the amount of effect it has on its computation, if the effect
* of this computation relies on time.
*
* Parameters :
* behaviourContext r Behavior context reference, which gives access to
* frequently used global objects ( context, level, manager, etc... )
*
* Returns : int, If it is done, it should return CKBR_OK. If it returns
* CKBR_ACTIVATENEXTFRAME, the behavior will again be called
* during the next process loop.
*
*******************************************************************
*/
int CISIteratorBB(const CKBehaviorContext& behcontext)
{
/************************************************************************/
/* collecting data : */
/* */
CKBehavior* beh = behcontext.Behavior;
CKContext* ctx = behcontext.Context;
CGBLCIConfigurationController* cman=(CGBLCIConfigurationController*)ctx->GetManagerByGuid(CONFIGURATION_MAN_GUID);
/*get the last index */
int index = 0;
beh->GetLocalParameterValue(BEH_LOCAL_PAR_INDEX_INDEX, &index);
BOOL getFromDB = false;
beh->GetLocalParameterValue(BEH_LOCAL_PAR_INDEX_DB_MODE,&getFromDB);
using namespace GBLCommon::BehaviorTools;
using namespace GBLCommon::ParameterTools;
using namespace Customisation::typedefs;
/************************************************************************/
/* behavior trigger event processing : */
/* */
/* */
/* Reset/On : sets the index to zero and save it */
if( beh->IsInputActive(0) )
{
beh->ActivateInput(0,FALSE);
if (getFromDB)
{
CKDataArray * resultArray = NULL;
beh->GetLocalParameterValue(BEH_LOCAL_PAR_INDEX_CIID_LIST,&resultArray);
if (resultArray)
{
resultArray->Clear();
while ( resultArray->GetColumnCount() )
resultArray->RemoveColumn(0);
}
else
{
resultArray = static_cast<CKDataArray*>(ctx->CreateObject( CKCID_DATAARRAY, "IGBLSMConfigurationAccess::CIS_IDLIST", CK_OBJECTCREATION_DYNAMIC ));
}
ctx->GetCurrentLevel()->AddObject( resultArray );
////////////////////////////////////////////////////////////////////////// retrieve list of CI ID's :
CGBLSMStorageManager *storageManager = static_cast<CGBLSMStorageManager *>(ctx->GetManagerByGuid(GBLSMStorageManagerGUID));
IGBLSMConfigurationAccess* smCIS = storageManager->GetConfigurationInterface();
int idCIS = GetInputParameterValue<int>(beh,BEH_IN_PAR_CIS_ID);
smCIS->RetrieveCIList(resultArray,CGBLCISID(idCIS));
beh->SetLocalParameterValue(BEH_LOCAL_PAR_INDEX_CIID_LIST,&resultArray,sizeof(CKDataArray*));
int cis_size = resultArray->GetRowCount();
beh->SetLocalParameterValue(BEH_LOCAL_PAR_INDEX_CIS_SIZE,&cis_size);
}else
{
Customisation::typedefs::CIS* currentCIS = cman->GetCIS();
if(!currentCIS)
Logger::ShowDebugMessage(ctx,Logger::ELOGERROR,"CISIterator : couldn't find CIS");
}
//reset counter :
//.........这里部分代码省略.........
示例4: BehaviourFunction
/*
*******************************************************************
* Function: int BehaviourFunction( const CKBehaviorContext& behaviorContext )
*
* Description : The execution function is the function that will be called
* during the process loop of the behavior engine, if the behavior
* is defined as using an execution function. This function is not
* called if the behavior is defined as a graph. This function is the
* heart of the behavior: it should compute the essence of the behavior,
* in an incremental way. The minimum amount of computing should be
* done at each call, to leave time for the other behaviors to run.
* The function receives the delay in milliseconds that has elapsed
* since the last behavioral process, and should rely on this value to
* manage the amount of effect it has on its computation, if the effect
* of this computation relies on time.
*
* Paramters :
* behaviourContext r Behavior context reference, which gives access to
* frequently used global objects ( context, level, manager, etc... )
*
* Returns : int, If it is done, it should return CKBR_OK. If it returns
* CKBR_ACTIVATENEXTFRAME, the behavior will again be called
* during the next process loop.
*
*******************************************************************
*/
int CGBLLAEGetLAE::BehaviourFunction( const CKBehaviorContext& behaviorContext )
{
CKBehavior* beh = behaviorContext.Behavior;
CKContext* ctx = behaviorContext.Context;
IGBLSMProfileAccess* pin = NULL;
CGBLSMStorageManager *storageManager = (CGBLSMStorageManager *)ctx->GetManagerByGuid(GBLSMStorageManagerGUID);
IGBLSMLAAccess *laInterface = storageManager->GetLAInterface();
IGBLSMLAEAccess *laeInterface = storageManager->GetLAEInterface();
char *laListArrayName = "laList";
CKDataArray* laListArray;
laListArray = (CKDataArray *)ctx->CreateObject(CKCID_DATAARRAY,laListArrayName, CK_OBJECTCREATION_DYNAMIC);
behaviorContext.CurrentLevel->AddObject( laListArray );
laListArray->InsertColumn( -1, CKARRAYTYPE_INT, "LAID" );
char *laeArrayName = "laeidList";
CKDataArray* laeArray;
laeArray = (CKDataArray *)ctx->CreateObject(CKCID_DATAARRAY,laeArrayName, CK_OBJECTCREATION_DYNAMIC);
behaviorContext.CurrentLevel->AddObject( laeArray );
laeArray->InsertColumn( -1, CKARRAYTYPE_INT, "LAEID" );
char *laelaArrayName = "laelaIDList";
CKDataArray* laelaArray;
laelaArray = (CKDataArray *)ctx->GetObjectByNameAndClass(laelaArrayName,CKCID_DATAARRAY,NULL);
if ( !laelaArray )
{
laelaArray = (CKDataArray *)ctx->CreateObject(CKCID_DATAARRAY,laelaArrayName, CK_OBJECTCREATION_DYNAMIC);
behaviorContext.CurrentLevel->AddObject( laelaArray );
laelaArray->InsertColumn( -1, CKARRAYTYPE_INT, "LAEID" );
laelaArray->InsertColumn( -1, CKARRAYTYPE_STRING, "LAID" );
}
else
{
laelaArray->Clear();
}
CGBLCOError res = laInterface->RetrieveLAList(laListArray);
if ( res == CGBLCOError::EGBLCOErrorType::GBLCO_OK)
{
int count = laListArray->GetRowCount();
for (int i=0; i < count; i++)
{
//get list of laes for given la and add it to results list
XString xLAID;
CKSTRING valueField = NULL;
int labelLength = laListArray->GetElementStringValue(i, 0, NULL);
valueField = new CKCHAR[labelLength];
labelLength = laListArray->GetElementStringValue(i, 0, valueField);
xLAID = valueField;
delete valueField;
CGBLLAID laid;
laid.FromString(xLAID);
CGBLCOError res = laeInterface->RetrieveLAEList(laeArray,laid);
if ( res == CGBLCOError::EGBLCOErrorType::GBLCO_OK)
{
int count = laeArray->GetRowCount();
for (int j=0; j < count; j++)
{
CKSTRING valueField = NULL;
int labelLength = laeArray->GetElementStringValue(j, 0, NULL);
valueField = new CKCHAR[labelLength];
labelLength = laeArray->GetElementStringValue(j, 0, valueField);
//.........这里部分代码省略.........
示例5: BehaviourFunction
/*
*******************************************************************
* Function: int BehaviourFunction( const CKBehaviorContext& behaviorContext )
*
* Description : The execution function is the function that will be called
* during the process loop of the behavior engine, if the behavior
* is defined as using an execution function. This function is not
* called if the behavior is defined as a graph. This function is the
* heart of the behavior: it should compute the essence of the behavior,
* in an incremental way. The minimum amount of computing should be
* done at each call, to leave time for the other behaviors to run.
* The function receives the delay in milliseconds that has elapsed
* since the last behavioral process, and should rely on this value to
* manage the amount of effect it has on its computation, if the effect
* of this computation relies on time.
*
* Parameters :
* behaviourContext r Behavior context reference, which gives access to
* frequently used global objects ( context, level, manager, etc... )
*
* Returns : int, If it is done, it should return CKBR_OK. If it returns
* CKBR_ACTIVATENEXTFRAME, the behavior will again be called
* during the next process loop.
*
*******************************************************************
*/
int GBLPFGetPlayers::BehaviourFunction( const CKBehaviorContext& behaviorContext )
{
CKBehavior *behaviour=behaviorContext.Behavior;
CKContext *context = behaviorContext.Context;
CGBLCOError returnValue;
behaviour->ActivateInput(EGBLGetPlayersBehInputs::In, false);
//initialise data array
CKDataArray* FieldData = (CKDataArray*)context->CreateObject(CKCID_DATAARRAY, "FieldData", CK_OBJECTCREATION_DYNAMIC);
CKDataArray *PlayerList;
PlayerList = (CKDataArray*)behaviour->GetInputParameterObject(EGBLGetPlayersParamInputs::GetPlayerList);
if(PlayerList == NULL)
{
behaviour->ActivateOutput(EGBLGetPlayersBehOutputs::Error, true);
CKParameterOut *pOut = behaviour->GetOutputParameter(EGBLGetPlayersParamOutputs::ErrorCode);
CGBLCOError::EGBLCOErrorType tType;
tType= CGBLCOError::EGBLCOErrorType::GBLCO_LOCAL;
TGBLError::SetTGBLError(pOut, tType , 19021, "Missing or incorrect parameter provided");
}
else
{
CGBLProfileManager *pm = (CGBLProfileManager *)context->GetManagerByGuid(GBLProfileManagerGUID);
returnValue = pm->GetPlayers(PlayerList);
if ((int)returnValue == CGBLCOError::EGBLCOErrorType::GBLCO_OK)
{
behaviour->ActivateOutput(EGBLGetPlayersBehOutputs::Success, true);
}
else
{
CKParameterOut *pOut = behaviour->GetOutputParameter(EGBLGetPlayersParamOutputs::ErrorCode);
CGBLCOError::EGBLCOErrorType tType = CGBLCOError::EGBLCOErrorType::GBLCO_OK ;
switch((CGBLCOError::EGBLCOErrorType)returnValue)
{
case 0:
tType = CGBLCOError::EGBLCOErrorType::GBLCO_OK;
break;
case 1:
tType = CGBLCOError::EGBLCOErrorType::GBLCO_FATAL;
break;
case 2:
tType = CGBLCOError::EGBLCOErrorType::GBLCO_LOCAL;
break;
case 3:
tType = CGBLCOError::EGBLCOErrorType::GBLCO_LOCAL;
break;
}
const char*errorString = returnValue;
TGBLError::SetTGBLError(pOut, tType,returnValue, (CKSTRING)errorString);
behaviour->ActivateOutput(EGBLGetPlayersBehOutputs::Error, true);
}
}
return CKBR_OK;
}