当前位置: 首页>>代码示例>>C++>>正文


C++ CKContext::GetCurrentLevel方法代码示例

本文整理汇总了C++中CKContext::GetCurrentLevel方法的典型用法代码示例。如果您正苦于以下问题:C++ CKContext::GetCurrentLevel方法的具体用法?C++ CKContext::GetCurrentLevel怎么用?C++ CKContext::GetCurrentLevel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CKContext的用法示例。


在下文中一共展示了CKContext::GetCurrentLevel方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: BehaviourFunction

int GBLCOSetID::BehaviourFunction( const CKBehaviorContext& behContext )
{
    CKBehavior	*behaviour = behContext.Behavior;
    CKContext	*context = behContext.Context;

    behaviour->ActivateInput(ECGBLCOSetLAIDBehInputs::InSetIdentity, FALSE);

    CKAttributeManager*attributeManager = context->GetAttributeManager();
    if (attributeManager != NULL)
    {
        CKLevel *level = context->GetCurrentLevel();
        if ( level != NULL )
        {
            int attributeType = attributeManager->GetAttributeTypeByName("GBLCOLAID");
            if (attributeType == -1)
                attributeType = attributeManager->RegisterNewAttributeType("GBLCOLAID", GUID_TGBLLAID, CKCID_BEOBJECT);
            else if ( level->HasAttribute(attributeType) )
                level->RemoveAttribute(attributeType);

            attributeManager->SetAttributeCategory(attributeType,"GBL");
            level->SetAttribute(attributeType);

            CKParameter*attribute = level->GetAttributeParameter(attributeType);
            if ( attribute != NULL )
            {
                CKParameterIn*pin = behaviour->GetInputParameter(ECGBLCOSetLAIDBehInputs::InSetIdentity);
                CKParameter*laid = pin->GetDirectSource();
                if ( laid != NULL )
                {
                    CKERROR err = attribute->CopyValue(laid);
                    if ( err == CK_OK )
                    {
                        behaviour->ActivateOutput(ECGBLCOSetLAIDBehOutputs::OutIdentitySet, TRUE);
                        behaviour->ActivateOutput(ECGBLCOSetLAIDBehOutputs::OutError, FALSE);
                        return CKBR_OK;
                    }
                }
            }
        }
    }

    CKParameterOut *parameterOutError = behaviour->GetOutputParameter(ECGBLCOSetLAIDParamOutputs::GetError);
    TGBLError::SetTGBLError(parameterOutError,CGBLCOError::EGBLCOErrorType::GBLCO_LOCAL,GBLCO_ERROR_SETID_ATTRIBUTE,GBLCO_ERROR_SETID_ATTRIBUTE_DESC);

    behaviour->ActivateOutput(ECGBLCOSetLAIDBehOutputs::OutIdentitySet, FALSE);
    behaviour->ActivateOutput(ECGBLCOSetLAIDBehOutputs::OutError, TRUE);
    return CKBR_GENERICERROR;
}
开发者ID:gbaumgart,项目名称:GBL_Backup,代码行数:48,代码来源:GBLCOSetID.cpp

示例2: 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 : 
//.........这里部分代码省略.........
开发者ID:gbaumgart,项目名称:GBL_Backup,代码行数:101,代码来源:GBLCICISIterator.cpp


注:本文中的CKContext::GetCurrentLevel方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。