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


C++ CKBehavior::GetOutputParameter方法代码示例

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


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

示例1: GetLastFileName

int GetLastFileName(const CKBehaviorContext& behcontext)
{

    CKBehavior* beh = behcontext.Behavior;
    CKContext* ctx = behcontext.Context;

    XString Inpath (ctx->GetLastCmoLoaded());



    CKParameterOut *pout = beh->GetOutputParameter(0);
    pout->SetStringValue(Inpath.Str());

    PathRemoveFileSpec(Inpath.Str());


    CKParameterOut *pout2 = beh->GetOutputParameter(1);
    pout2->SetStringValue(Inpath.Str());



    beh->ActivateOutput(0);


    return 0;

}
开发者ID:,项目名称:,代码行数:27,代码来源:

示例2: retx

//************************************
// Method:    vt_SetOutVal
// FullName:  vt_SetOutVal
// Access:    public static 
// Returns:   PyObject *
// Qualifier:
// Parameter: PyObject * self
// Parameter: PyObject * args
//************************************
static PyObject *vt_SetOutVal( PyObject * self, PyObject * args )
{
	
	int size = PyTuple_Size(args);
	PyObject *val;
	int bid, index;
	PyArg_ParseTuple(args, "iiO", &bid, &index,&val); 

	CK_ID cid = bid; 
	CKBehavior *beh = static_cast<CKBehavior*>(pym->m_Context->GetObject(cid)); 
	if (size!=3)
	{

		pym->m_Context->OutputToConsole("PyError : This function only accepts 3 arguments : \n\t bid,index,value ");
		Py_RETURN_NONE;
	}
	
	using namespace vtTools;
	
	if (beh && val &&  index < beh->GetOutputParameterCount() )
	{
		if (PyInt_Check(val))
		{
			long ret = PyInt_AsLong(val);
			int retx = static_cast<int>(ret);
			beh->SetOutputParameterValue(index,&retx);
			Py_RETURN_NONE;
		}
		if (PyFloat_Check(val))
		{
			double ret = PyFloat_AsDouble(val);
			float retx  = static_cast<float>(ret);
			beh->SetOutputParameterValue(index,&retx);
			Py_RETURN_NONE;
		}
		if (PyString_Check(val))
		{
			std::string ret;
			CKParameterOut * pout = beh->GetOutputParameter(index);
			XString retx(ret.c_str());
			pout->SetStringValue(retx.Str());
			Py_RETURN_NONE;
		}
		if (PyTuple_Check(val))
		{
			std::string outList = to_string(val);
			CKParameterOut * pout = beh->GetOutputParameter(index);
			XString retx(outList.c_str());
			pout->SetStringValue(retx.Str());
			Py_RETURN_NONE;
		}

		
	}
	Py_RETURN_NONE;
}
开发者ID:,项目名称:,代码行数:65,代码来源:

示例3: 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 CGBLBuildCommand::BehaviourFunction(const CKBehaviorContext& behaviorContext)
{
	CKBehavior* behavior = behaviorContext.Behavior;
  	CKContext* context = behaviorContext.Context;

	if( behavior->IsInputActive(EGBLBuildCommandBehInputs::BuildCommand) ) 
	{
		DeactivateInputs(behaviorContext);
		DeactivateOutputs(behaviorContext);
		return DoBuildCommand (behaviorContext);
	}

	if( behavior->IsInputActive(EGBLBuildCommandBehInputs::CancelOperation))
	{
		DeactivateInputs(behaviorContext);
		DeactivateOutputs(behaviorContext);
		ClearParameterOutputs (behaviorContext);

		int stateValue = EGBLBuildCommandState::Initial;
		behavior->SetLocalParameterValue (gblBuildCommandStateLocalPos, &stateValue);

		int initialParameterPosition = 0;
		behavior->SetLocalParameterValue (currentParameterPositionLocalPos, &initialParameterPosition);

		char *emptyString = "";
		behavior->SetLocalParameterValue(commandStringLocalPos, emptyString, strlen(emptyString)+1);

		behavior->ActivateOutput (EGBLBuildCommandBehOutputs::Cancelled);
	}

	if( behavior->IsInputActive(EGBLBuildCommandBehInputs::ReadNextParameterValue))
	{
		DeactivateInputs(behaviorContext);
		DeactivateOutputs(behaviorContext);

		int stateValue = 0;
		behavior->GetLocalParameterValue (gblBuildCommandStateLocalPos, &stateValue);

		if (! ( (stateValue == EGBLBuildCommandState::AwaitingParametersForUntargeted) || (stateValue == EGBLBuildCommandState::AwaitingParametersForNetwork) || (stateValue == EGBLBuildCommandState::GetTargets) ) )
		{
			int stateValue = EGBLBuildCommandState::Initial;
			behavior->SetLocalParameterValue (gblBuildCommandStateLocalPos, &stateValue);

			int initialParameterPosition = 0;
			behavior->SetLocalParameterValue (currentParameterPositionLocalPos, &initialParameterPosition);

			char *emptyString = "";
			behavior->SetLocalParameterValue(commandStringLocalPos, emptyString, strlen(emptyString)+1);

			CKParameterOut *parameterOutError = behavior->GetOutputParameter(EGBLBuildCommandParamOutputs::GetError);
			TGBLError::SetTGBLError(parameterOutError,CGBLCOError::EGBLCOErrorType::GBLCO_LOCAL,GBLFC_ERROR_BUILDCOMMAND_INVALID_STATE,GBLFC_ERROR_BUILDCOMMAND_INVALID_STATE_DESC);

			behavior->ActivateOutput (EGBLBuildCommandBehOutputs::Error);
		}

		return DoReadNextParameterValue (behaviorContext);
	}

	return CKBR_OK;
}
开发者ID:gbaumgart,项目名称:GBL_Backup,代码行数:86,代码来源:GBLBuildCommand.cpp

示例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 CGBLLAESetLoadState::BehaviourFunction( const CKBehaviorContext& behaviorContext )
{
	CKBehavior* beh = behaviorContext.Behavior;
  	CKContext* ctx = behaviorContext.Context;

	CGBLLAEManager *laeManager = (CGBLLAEManager *)ctx->GetManagerByGuid(GBLLAEManagerGUID);

	if (laeManager)
	{
		int state = 0;
		beh->GetInputParameterValue(0, &state);
		laeManager->SetLoadState(state);
		
		beh->ActivateInput(0, FALSE);
		beh->ActivateOutput(0);
	}
	else
	{
		beh->ActivateInput(0, FALSE);
		CKParameterOut *parameterOutError = beh->GetOutputParameter(0);
		TGBLError::SetTGBLError(parameterOutError,CGBLCOError::EGBLCOErrorType::GBLCO_LOCAL,GBLLAE_ERROR_CANTSETLAEIDENTITY,GBLLAE_ERROR_CANTSETLAEIDENTITY_DESC);
		beh->ActivateOutput(1);
	}

    return CKBR_OK;
}
开发者ID:gbaumgart,项目名称:GBL_Backup,代码行数:52,代码来源:GBLLAESetLoadState.cpp

示例5: RetrieveCICB

/*
*******************************************************************
* Function: int RetrieveCICB( const CKBehaviorContext& behaviorContext )
*
* Description : The Behavior Callback function is called by Virtools when various events happen 
*               in the life of a BuildingBlock. Exactly which events trigger a call to the 
*               Behavior Callback function is defined in the Behavior Prototype, along with the 
*               declaration of the function pointer 
*
* Parameters :
*    behaviourContext    r   Behavior context reference, which gives 
*                            access to frequently used global objects 
*                            ( context, level, manager, etc... )
*
* Returns : int, The return value of the callback function should be one of the CK_BEHAVIOR_RETURN values.
*
*******************************************************************
*/
CKERROR RetrieveCICB(const CKBehaviorContext& behcontext)
{
	/************************************************************************/
	/*  collecting data :													*/
	/*  																	*/
	CKBehavior *beh = behcontext.Behavior;
	CKContext* ctx = beh->GetCKContext();
	CKParameterManager *pm = static_cast<CKParameterManager*>(ctx->GetParameterManager());
	/************************************************************************/
	/*	process virtools callbacks		:																			*/
	/*  																														*/

	switch(behcontext.CallbackMessage)
	{
	
		
		case CKM_BEHAVIOREDITED:
		case CKM_BEHAVIORSETTINGSEDITED:
		{
	
			assert(beh && ctx);
			BOOL getAsString,outputAttriubtes = false;
			beh->GetLocalParameterValue(BEH_SETTINGS_GET_AS_STRING,&getAsString);
			beh->GetLocalParameterValue(BEH_SETTINGS_GET_CUSTOM_ATTRIBUTES,&outputAttriubtes);
	       

			//////////////////////////////////////////////////////////////////////////
			// get ci by string
			if(getAsString)
			{
				CKParameterOut* ciValue = beh->GetOutputParameter(0);
				ciValue->SetType(pm->ParameterGuidToType(CKPGUID_STRING));
			}
			
			if(outputAttriubtes)
			{
				beh->CreateOutputParameter("Default Value",CKPGUID_STRING);
                beh->CreateOutputParameter("Unique name",CKPGUID_STRING);                
				beh->CreateOutputParameter("Description",CKPGUID_STRING);
				beh->CreateOutputParameter("Runtime flags",CIPRTFLAGSGUID);
				beh->CreateOutputParameter("Type",CKPGUID_PARAMETERTYPE);

			}

			int p_count  =  beh->GetOutputParameterCount();

			while(   (outputAttriubtes ? BEH_OUT_MAX_COUNT : BEH_OUT_MIN_COUNT )   < p_count )
			{ 
				CKDestroyObject( beh->RemoveOutputParameter( --p_count) );
			}
		
			
			
		}
	}
	return CKBR_OK;
}
开发者ID:gbaumgart,项目名称:GBL_Backup,代码行数:75,代码来源:GBLCIRetrieveCI.cpp

示例6: GetCIS

/*
 *******************************************************************
 * Function: int GetCIS( 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 GetCIS(const CKBehaviorContext& behcontext)
{

	////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
	//						Retrieving min data : 
	
	CKBehavior* beh = behcontext.Behavior;
  	CKContext* ctx = behcontext.Context;

	CGBLCIConfigurationController* cman=static_cast<CGBLCIConfigurationController*>(ctx->GetManagerByGuid(CONFIGURATION_MAN_GUID));
	IGBLCIAccessInterface *accessInterface   =  cman->GetCISAccessInterface();

	CGBLSMStorageManager *storageManager = static_cast<CGBLSMStorageManager *>(ctx->GetManagerByGuid(GBLSMStorageManagerGUID));
	IGBLSMConfigurationAccess* smCIS = storageManager->GetConfigurationInterface();
		
	CKParameterOut *parameterOutError = beh->GetOutputParameter(BEH_OUT_INDEX_ERROR);

	int idCIS = GBLCommon::BehaviorTools::GetInputParameterValue<int>(beh,BEH_IN_INDEX_CIS);
	
	CGBLCOError  returnValue = accessInterface->GetCIS(idCIS);


	// check results and output error
	if (returnValue == CGBLCOError::EGBLCOErrorType::GBLCO_OK)
	{
		TGBLError::SetTGBLError(parameterOutError,returnValue.GetType(),returnValue.GetCode(),(CKSTRING)returnValue.GetDescription());
		beh->ActivateOutput(BEH_PIN_OUT_INDEX_SUCCESS, true);
	}
	else
	{

		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;
		}
		TGBLError::SetTGBLError(parameterOutError,tType,returnValue.GetCode(),(CKSTRING)returnValue.GetDescription());
		beh->ActivateOutput(BEH_PIN_OUT_INDEX_ERROR, true);
	}
	return CKBR_OK;

}
开发者ID:gbaumgart,项目名称:GBL_Backup,代码行数:79,代码来源:GBLCIGetCIS.cpp

示例7: DirToArray

int DirToArray(const CKBehaviorContext& behcontext)
{
	CKBehavior* beh = behcontext.Behavior;
  	CKContext* ctx = behcontext.Context;

	XString filename((CKSTRING) beh->GetInputParameterReadDataPtr(0));
	XString Mask((CKSTRING) beh->GetInputParameterReadDataPtr(1));
		
	int rec;

	beh->GetInputParameterValue(2,&rec);

	

	if( beh->IsInputActive(0) ){
		beh->ActivateInput(0,FALSE);

		flist.erase(flist.begin(),flist.end());

		CKDirectoryParser MyParser(filename.Str(),Mask.Str(),rec);
		char* str = NULL;
		while(str = MyParser.GetNextFile())
			flist.push_back(XString(str));

		counter = 0;
		beh->ActivateInput(1,TRUE);

		
	}


	if( beh->IsInputActive(1) ){
		beh->ActivateInput(1,FALSE);

		if ( counter < flist.size() ){
			XString entry = flist.at(counter);
			CKParameterOut * pout = beh->GetOutputParameter(0);
			pout->SetStringValue(entry.Str() );
				
			counter++;
			beh->SetOutputParameterValue(1,&counter);
			beh->ActivateOutput(1);

		}else{

			beh->SetOutputParameterValue(1,&counter);
			counter = 0 ; 
			beh->ActivateOutput(0);
		}
	}
	return 0;
}
开发者ID:,项目名称:,代码行数:52,代码来源:

示例8: 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

示例9: 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;
}
开发者ID:gbaumgart,项目名称:GBL_Backup,代码行数:70,代码来源:GBLLAEGetLA.cpp

示例10: 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 CGBLLAESetLAEData::BehaviourFunction( const CKBehaviorContext& behaviorContext )
{
    CKBehavior* beh = behaviorContext.Behavior;
    CKContext* ctx = behaviorContext.Context;

    IGBLSMProfileAccess* pin = NULL;
    CGBLSMStorageManager *storageManager = (CGBLSMStorageManager *)ctx->GetManagerByGuid(GBLSMStorageManagerGUID);
    IGBLSMLAEAccess *laeInterface = storageManager->GetLAEInterface();

    int cisid;
    CGBLLAID laid;
    XString xlaid;
    XString laeName;
    int laeState = 0;

    CKDataArray *userIDList = NULL;

    CGBLLAEID laeid = 0;

    int dlaeid;
    beh->GetInputParameterValue(1, &dlaeid);
    laeid = dlaeid;

    GBLLAEDataType::GetGBLLAEData(beh->GetInputParameter(0)->GetRealSource(), cisid, laeName, laeState, xlaid, &userIDList );

    laid.FromString(xlaid);

    CGBLCOError res = laeInterface->StoreLAE (laeState, cisid, laid, laeName, &laeid);
    if ( res == CGBLCOError::EGBLCOErrorType::GBLCO_OK)
    {
        beh->ActivateInput(0, FALSE);
        beh->ActivateOutput(0);
    }
    else
    {
        CKParameterOut *parameterOutError = beh->GetOutputParameter(0);
        TGBLError::SetTGBLError(parameterOutError,CGBLCOError::EGBLCOErrorType::GBLCO_LOCAL,GBLLAE_ERROR_STORELAE,GBLLAE_ERROR_STORELAE_DESC);
        beh->ActivateOutput(1);

    }

    return CKBR_OK;
}
开发者ID:gbaumgart,项目名称:GBL_Backup,代码行数:69,代码来源:GBLLAESetLAEData.cpp

示例11: GetNextArgument

/*
*******************************************************************
* Function: int CGBLBuildCommand::GetNextArgument (CKParameter* nextArgument,CKBehavior* targetBB, const CKBehaviorContext& behaviorContext)
*
* Description : This function sets corresponding outputs with requested argument's 
*				name, type and if the type of arguments is TGBLFCStringFromList, it also
*				provides designer specified list array with GetDesignerSpecifiedList output.
*
* Parameters :
*    behaviourContext    r   Behavior context reference, which gives 
*                            access to frequently used global objects 
*                            ( context, level, manager, etc... )
*
*	nextArgument	    r	Required argument to have parameters provided by the command
*
*	targetBB			r	Target GBLWaitForCommand building block
*
* Returns : int, The return value is 0 if no error occured or -1 on error 
*
*******************************************************************
*/
int CGBLBuildCommand::GetNextArgument (CKParameter* nextArgument,CKBehavior* targetBB, const CKBehaviorContext& behaviorContext)
{
	CKBehavior* behavior = behaviorContext.Behavior;
	CKContext*  context = behaviorContext.Context;

	XString typeName = context->GetParameterManager()->ParameterTypeToName(nextArgument->GetType());
	XString argumentName = nextArgument->GetName();

	if (typeName == "TGBLFCStringFromList")
	{
		int inputs = targetBB->GetInputParameterCount();

		for (int i=0; i<inputs; i++)
		{
			CKParameterIn *parameterInput = targetBB->GetInputParameter(i);

			if ( argumentName == parameterInput->GetName() )
			{
				CKParameterOut *parameterOutput = behavior->GetOutputParameter(EGBLBuildCommandParamOutputs::GetDesignerSpecifiedList);

				context->OutputToConsole(context->GetParameterManager()->ParameterTypeToName(parameterOutput->GetType()), FALSE);
				context->OutputToConsole(context->GetParameterManager()->ParameterTypeToName(parameterInput->GetType()), FALSE);
				
				parameterOutput->CopyValue (parameterInput->GetDirectSource());
				break;
			}
		}
	}

	behavior->SetOutputParameterValue (EGBLBuildCommandParamOutputs::GetArgumentType, typeName.Str(), strlen (typeName.Str()) + 1 );
	behavior->SetOutputParameterValue (EGBLBuildCommandParamOutputs::GetArgumentName, argumentName.Str(), strlen (argumentName.Str()) + 1 );

	behavior->ActivateOutput (EGBLBuildCommandBehOutputs::GetNextParameterValue);

	return 0;
}
开发者ID:gbaumgart,项目名称:GBL_Backup,代码行数:57,代码来源:GBLBuildCommand.cpp

示例12: DoReadNextParameterValue

/*
*******************************************************************
* Function: int CGBLBuildCommand::DoReadNextParameterValue (const CKBehaviorContext& behaviorContext)
*
* Description : Read next provided argument from SetParameterString p-in and add it to command string
*
* Parameters :
*    behaviourContext    r   Behavior context reference, which gives 
*                            access to frequently used global objects 
*                            ( context, level, manager, etc... )
*
*******************************************************************
*/
int CGBLBuildCommand::DoReadNextParameterValue (const CKBehaviorContext& behaviorContext)
{
	CKBehavior* behavior = behaviorContext.Behavior;
  	CKContext* context = behaviorContext.Context;

	int gblBuildCommandState;
	behavior->GetLocalParameterValue (gblBuildCommandStateLocalPos, &gblBuildCommandState);

	switch (gblBuildCommandState)
	{
		case EGBLBuildCommandState::Initial:
		{
			CKParameterOut *parameterOutError = behavior->GetOutputParameter(EGBLBuildCommandParamOutputs::GetError);
			TGBLError::SetTGBLError(parameterOutError,CGBLCOError::EGBLCOErrorType::GBLCO_LOCAL,GBLFC_ERROR_BUILDCOMMAND_INVALID_STATE,GBLFC_ERROR_BUILDCOMMAND_INVALID_STATE_DESC);
			behavior->ActivateOutput (EGBLBuildCommandBehOutputs::Error);
			return CKBR_OK;
		}
		break;

		case EGBLBuildCommandState::GetTargets:
		{
			//check if the array of recipients is provided
			void* recipients = NULL;
			recipients = behavior->GetInputParameter (EGBLBuildCommandParamInputs::SetDests)->GetDirectSource()->GetValueObject();
			if (recipients == NULL)
			{
				CKParameterOut *parameterOutError = behavior->GetOutputParameter(EGBLBuildCommandParamOutputs::GetError);
				TGBLError::SetTGBLError(parameterOutError,CGBLCOError::EGBLCOErrorType::GBLCO_LOCAL,GBLFC_ERROR_BUILDCOMMAND_NO_DESTS,GBLFC_ERROR_BUILDCOMMAND_NO_DESTS_DESC);
				behavior->ActivateOutput (EGBLBuildCommandBehOutputs::Error);
				return CKBR_OK;
			}

			int targetID = 0;
			behavior->GetInputParameterValue (EGBLBuildCommandParamInputs::SetCommandID, &targetID);

			XString commandString;
			commandString << targetID << CGBLCommandUtil::commandSeparator;
			
			behavior->SetLocalParameterValue(commandStringLocalPos, commandString.Str(), strlen(commandString.Str()) + 1 );

			//check if there are more arguments
			return DoHandleNextNetworkArgument (behaviorContext);
		}
		break;

		case EGBLBuildCommandState::AwaitingParametersForNetwork:
		case EGBLBuildCommandState::AwaitingParametersForUntargeted:
		{

			CKSTRING commandString = (CKSTRING) behavior->GetLocalParameter(commandStringLocalPos)->GetReadDataPtr();
			CKSTRING argumentString = (CKSTRING) behavior->GetInputParameter(EGBLBuildCommandParamInputs::SetParameterString)->GetReadDataPtr();

			//char commandString[512];
			//char argumentString[512];
			//behavior->GetLocalParameterValue(commandStringLocalPos,&commandString);

			//behavior->GetInputParameterValue (EGBLBuildCommandParamInputs::SetParameterString, &argumentString);

			if (strlen (argumentString) == 0)
			{
				behavior->ActivateOutput (EGBLBuildCommandBehOutputs::InvalidValue);
				return CKBR_OK;
			}

			CKSTRING argumentType = (CKSTRING) behavior->GetOutputParameter(EGBLBuildCommandParamOutputs::GetArgumentType)->GetReadDataPtr(); 
			if (  (strcmp (argumentType, "Integer") == 0) || (strcmp (argumentType, "Float") == 0))
			{
				bool isArgumentNumeric = CGBLCommandUtil::IsNumeric(argumentString);
				if (!isArgumentNumeric)
				{
					behavior->ActivateOutput (EGBLBuildCommandBehOutputs::InvalidValue);
					return CKBR_OK;
				}
			}

			XString updatedCommandString;
			updatedCommandString << commandString << argumentString << CGBLCommandUtil::commandSeparator;
			
			behavior->SetLocalParameterValue(commandStringLocalPos, updatedCommandString.Str(), strlen(updatedCommandString.Str()) + 1 );

			if (gblBuildCommandState == EGBLBuildCommandState::AwaitingParametersForUntargeted)
			{
				return DoHandleNextLocalArgument (behaviorContext);
			}

			return DoHandleNextNetworkArgument (behaviorContext);

//.........这里部分代码省略.........
开发者ID:gbaumgart,项目名称:GBL_Backup,代码行数:101,代码来源:GBLBuildCommand.cpp

示例13: DoHandleNextNetworkArgument

/*
*******************************************************************
* Function: int CGBLBuildCommand::DoHandleNextNetworkArgument (const CKBehaviorContext& behaviorContext)
*
* Description : Checks if there are more arguments to be specified for network command
*				and takes corresponded actions
*
* Parameters :
*    behaviourContext    r   Behavior context reference, which gives 
*                            access to frequently used global objects 
*                            ( context, level, manager, etc... )
*
*******************************************************************
*/
int CGBLBuildCommand::DoHandleNextNetworkArgument (const CKBehaviorContext& behaviorContext)
{
	CKBehavior* behavior = behaviorContext.Behavior;
  	CKContext* context = behaviorContext.Context;

	int gblBuildCommandState;

	CKBehavior* targetBB = NULL;
	CK_ID targetID;
	behavior->GetLocalParameterValue (targetBBLocalPos, &targetID);
	targetBB = (CKBehavior*)behaviorContext.Context->GetObject(targetID);

	if (targetBB == NULL)
	{
		CKParameterOut *parameterOutError = behavior->GetOutputParameter(EGBLBuildCommandParamOutputs::GetError);
		TGBLError::SetTGBLError(parameterOutError,CGBLCOError::EGBLCOErrorType::GBLCO_LOCAL,GBLFC_ERROR_BUILDCOMMAND_TARGET_NOT_FOUND,GBLFC_ERROR_BUILDCOMMAND_TARGET_NOT_FOUND_DESC);

		behavior->ActivateOutput (EGBLBuildCommandBehOutputs::Error);
		return CKBR_OK;
	}

	int currentParameterPosition = 0;
	behavior->GetLocalParameterValue (currentParameterPositionLocalPos, &currentParameterPosition);
	CKParameter* nextArgument = CGBLCommandUtil::GetCommandArgument(*targetBB, currentParameterPosition);

	currentParameterPosition++;
	behavior->SetLocalParameterValue (currentParameterPositionLocalPos, &currentParameterPosition);

	if (nextArgument == NULL)
	{
		//no arguments required, build finished
		CKParameter *outputCommandString, *localCommandString;
		CKParameter *outputDests;
		CKParameterIn *inputDests;

		ClearParameterOutputs(behaviorContext);

		outputCommandString = (CKParameter*) behavior->GetOutputParameter (EGBLBuildCommandParamOutputs::GetCommandString);
		localCommandString = (CKParameter*) behavior->GetLocalParameter (commandStringLocalPos);
		outputCommandString->CopyValue(localCommandString);

		// Copy list of recipients from input to output
		outputDests = (CKParameter*) (behavior->GetOutputParameter (EGBLBuildCommandParamOutputs::GetDests));
		inputDests =  behavior->GetInputParameter (EGBLBuildCommandParamInputs::SetDests);
		outputDests->CopyValue(inputDests->GetDirectSource());

		gblBuildCommandState = EGBLBuildCommandState::Completed;
		behavior->SetLocalParameterValue (gblBuildCommandStateLocalPos, &gblBuildCommandState);

        behavior->ActivateOutput (EGBLBuildCommandBehOutputs::HandleTargetedCommand);
		return CKBR_OK;
	}
	else
	{
		//get next argument
		gblBuildCommandState = EGBLBuildCommandState::AwaitingParametersForNetwork;
		behavior->SetLocalParameterValue (gblBuildCommandStateLocalPos, &gblBuildCommandState);

		GetNextArgument (nextArgument, targetBB, behaviorContext);

		return CKBR_OK;
	}
}
开发者ID:gbaumgart,项目名称:GBL_Backup,代码行数:77,代码来源:GBLBuildCommand.cpp

示例14: RetrieveCI

/*
 *******************************************************************
 * 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 RetrieveCI(const CKBehaviorContext& behcontext)
{
	/************************************************************************/
	/*  collecting data :													*/
	/*  																	*/
	CKBehavior* beh = behcontext.Behavior;
  	CKContext* ctx = behcontext.Context;
	CGBLCIConfigurationController* cman=(CGBLCIConfigurationController*)ctx->GetManagerByGuid(CONFIGURATION_MAN_GUID);
	IGBLCIManageInterface *cisFac   =  cman->GetCISFactoryInterface();
	IGBLCIAccessInterface * accessInterface  = cman->GetCISAccessInterface(); 

	

	BOOL getAsString,outputAttriubtes = false;
	beh->GetLocalParameterValue(BEH_SETTINGS_GET_AS_STRING,&getAsString);
	beh->GetLocalParameterValue(BEH_SETTINGS_GET_CUSTOM_ATTRIBUTES,&outputAttriubtes);

	using namespace GBLCommon::BehaviorTools;
	using namespace GBLCommon::ParameterTools;
	using namespace Customisation::typedefs;

	int idCI = GetInputParameterValue<int>(beh,BEH_PAR_INDEX_CI);

	CGBLCI *currentCI = NULL;

	CGBLSMStorageManager *storageManager = static_cast<CGBLSMStorageManager *>(ctx->GetManagerByGuid(GBLSMStorageManagerGUID));
	IGBLSMConfigurationAccess* smCIS = storageManager->GetConfigurationInterface();

	
	currentCI = new CGBLCI("temp",CKPGUID_INT);
	
	CGBLCOError returnValue  = 	accessInterface->GetCI(currentCI,idCI);

	//get error parameter
	CKParameterOut *parameterOutError = beh->GetOutputParameter(BEH_PIN_OUT_INDEX_ERROR);
	// check results and output error
	if (returnValue == CGBLCOError::EGBLCOErrorType::GBLCO_OK)
	{
		//////////////////////////////////////////////////////////////////////////
		// output values :
		CKParameterOut *pout = beh->GetOutputParameter(1);
		if(getAsString)
		{
			//output  the value 
			VxScratch sbuffer(currentCI->realValue->GetDataSize());
			CKSTRING buffer = (CKSTRING)sbuffer.Mem();
			currentCI->realValue->GetStringValue(buffer);
			pout->SetStringValue(buffer);
		}else
		{

			CKParameterManager *pm = static_cast<CKParameterManager*>(ctx->GetParameterManager());
			if ( beh->GetOutputParameter(0)->GetType() == currentCI->realValue->GetType() )
			{
				pout->CopyValue(currentCI->realValue);
			}else
			{
				pout->SetType(currentCI->realValue->GetType());
				return CKBR_PARAMETERERROR;
			}
		}



		//////////////////////////////////////////////////////////////////////////
		// output custom attributes :
		if(outputAttriubtes)
		{
			//output unique name : 
			CKParameterOut *poutName = beh->GetOutputParameter(BEH_OUT_INDEX_UNAME);
			poutName->SetStringValue(currentCI->name.Str());		
			//output description : 
			CKParameterOut *poutDescription = beh->GetOutputParameter(BEH_OUT_INDEX_DESCRIPTION);
			poutDescription->SetStringValue(currentCI->description.Str());
//.........这里部分代码省略.........
开发者ID:gbaumgart,项目名称:GBL_Backup,代码行数:101,代码来源:GBLCIRetrieveCI.cpp

示例15: BehaviourFunction


//.........这里部分代码省略.........
                localError.SetCode(GBLCH_ERRORCODE_UNABLETOGETPROFILEINFORMATION);
                localError.SetDescription((XString)"An error occurred while attempting to retrieve profile information: " + (const char*)localError);
                break;
            }

            // Place team name into destination array
            stringBuffer = new char[tmpTeamNameArray->GetElementStringValue(0, 0, NULL) + 1];
            tmpTeamNameArray->GetElementStringValue(0, 0, stringBuffer);

            availableRecipientsArray->SetElementStringValue(row, AVAILABLERECIPIENTSARRAY_COLUMN_USERNAME, stringBuffer);

            delete stringBuffer;
            stringBuffer = NULL;

            // Set user ID as 0
            int virtoolsUserID = 0;
            availableRecipientsArray->SetElementValue(row, AVAILABLERECIPIENTSARRAY_COLUMN_VIRTOOLSUSERID, &virtoolsUserID);

            // Set team ID
            availableRecipientsArray->SetElementValue(row, AVAILABLERECIPIENTSARRAY_COLUMN_GBLTEAMID, &arrayOfTeamIDs[team]);
        }
    }
    if (localError == CGBLCOError::EGBLCOErrorType::GBLCO_OK)
    {
        CGBLTeamID teamID;
        char* stringBuffer = NULL;
        int virtoolsUserID;

        // Now copy players (which includes facilitators) into the destination array
        for (int row = 0;row < tmpActivePlayersArray->GetRowCount();row++)
        {
            // Get User ID
            virtoolsUserID = 0;
            if (tmpActivePlayersArray->GetElementValue(row, GETACTIVEPLAYERSARRAY_COLUMN_VIRTOOLSUSERID, &virtoolsUserID))
            {
                // Check this user ID valid
                if (virtoolsUserID)
                {
                    // Add new row to destination array
                    availableRecipientsArray->AddRow();
                    int row = availableRecipientsArray->GetRowCount() - 1;

                    // Set Virtools user ID
                    availableRecipientsArray->SetElementValue(row, AVAILABLERECIPIENTSARRAY_COLUMN_VIRTOOLSUSERID, &virtoolsUserID);

                    // Get name and put into dest array
                    stringBuffer = new char[tmpActivePlayersArray->GetElementStringValue(row, GETACTIVEPLAYERSARRAY_COLUMN_USERNAME, NULL) + 1];
                    tmpActivePlayersArray->GetElementStringValue(row, GETACTIVEPLAYERSARRAY_COLUMN_USERNAME, stringBuffer);
                    
                    availableRecipientsArray->SetElementStringValue(row, AVAILABLERECIPIENTSARRAY_COLUMN_USERNAME, stringBuffer);
                    delete stringBuffer;
                    stringBuffer = NULL;

                    // Set team ID to 0
                    teamID = 0;
                    availableRecipientsArray->SetElementValue(row, AVAILABLERECIPIENTSARRAY_COLUMN_GBLTEAMID, &teamID);
                }
            }
        }
    }
    if (localError == CGBLCOError::EGBLCOErrorType::GBLCO_OK)
    {
        // Remove the current user from the array

        // Get current Virtools User ID from GBL Loader
        int currentVirtoolsUserID = loaderManager->GetVirtoolsUserID();        

        for (int row = availableRecipientsArray->GetRowCount() - 1;row >= 0;row--)
        {
            int virtoolsUserId = 0;
            availableRecipientsArray->GetElementValue(row, AVAILABLERECIPIENTSARRAY_COLUMN_VIRTOOLSUSERID, &virtoolsUserId);

            if (virtoolsUserId == currentVirtoolsUserID)
            {
                // This row is the current user. Remove it
                availableRecipientsArray->RemoveRow(row);
            }
        }
    }

    // Free temporary arrays
    beh->GetCKContext()->DestroyObject(tmpActivePlayersArray);
    beh->GetCKContext()->DestroyObject(tmpTeamNameArray);

    // Did an error occur?
    if (localError == CGBLCOError::EGBLCOErrorType::GBLCO_OK)
    {
        // Output success
        beh->ActivateOutput(eBehOutputDone);
    }
    else
    {
        // Output the error
        TGBLError::SetTGBLError(beh->GetOutputParameter(eParamOutputError), localError, localError, (CKSTRING)(const char*)localError);
        beh->ActivateOutput(eBehOutputError);
    }

    // All done
    return CKBR_OK;
}
开发者ID:gbaumgart,项目名称:GBL_Backup,代码行数:101,代码来源:GBLCHPopulateAvailableRecipients.cpp


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