本文整理汇总了C++中CKContext::GetObjectByNameAndClass方法的典型用法代码示例。如果您正苦于以下问题:C++ CKContext::GetObjectByNameAndClass方法的具体用法?C++ CKContext::GetObjectByNameAndClass怎么用?C++ CKContext::GetObjectByNameAndClass使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CKContext
的用法示例。
在下文中一共展示了CKContext::GetObjectByNameAndClass方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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.
*
* 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;
}
示例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 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);
//.........这里部分代码省略.........