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


C++ BEHAVIAC_ASSERT函数代码示例

本文整理汇总了C++中BEHAVIAC_ASSERT函数的典型用法代码示例。如果您正苦于以下问题:C++ BEHAVIAC_ASSERT函数的具体用法?C++ BEHAVIAC_ASSERT怎么用?C++ BEHAVIAC_ASSERT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: BEHAVIAC_ASSERT

	char* Workspace::ReadFileToBuffer(const char* file)
	{
		IFile* fp = CFileManager::GetInstance()->FileOpen(file, CFileSystem::EOpenAccess_Read);

		if (!fp)
		{
			return 0;
		}

		//fp->Seek(0, CFileSystem::ESeekMoveMode_End);
		uint32_t fileSize = (uint32_t)fp->GetSize();

		BEHAVIAC_ASSERT(ms_fileBufferTop < kFileBufferDepth - 1);
		uint32_t offset = ms_fileBufferOffset[ms_fileBufferTop++];
		uint32_t offsetNew = offset + fileSize + 1;
		ms_fileBufferOffset[ms_fileBufferTop] = offsetNew;

		if (ms_fileBuffer == 0 || offsetNew > ms_fileBufferLength)
		{
			//to allocate extra 10k 
			ms_fileBufferLength = offsetNew + 10 * 1024;
			if (ms_fileBufferLength < 50 * 1024)
			{
				ms_fileBufferLength = 50 * 1024;
			}

			ms_fileBuffer = (char*)BEHAVIAC_REALLOC(ms_fileBuffer, ms_fileBufferLength);
		}

		BEHAVIAC_ASSERT(ms_fileBuffer);
		BEHAVIAC_ASSERT(offsetNew < ms_fileBufferLength);

		char* pBuffer = ms_fileBuffer + offset;

		fp->Read(pBuffer, sizeof(char) * fileSize);
		pBuffer[fileSize] = 0;

		CFileManager::GetInstance()->FileClose(fp);

		return pBuffer;
	}
开发者ID:panyihua,项目名称:behaviac,代码行数:41,代码来源:workspace.cpp

示例2: BEHAVIAC_UNUSED_VAR

    EBTStatus ActionTask::update(Agent* pAgent, EBTStatus childStatus)
    {
        BEHAVIAC_UNUSED_VAR(pAgent);
        BEHAVIAC_UNUSED_VAR(childStatus);

        BEHAVIAC_ASSERT(Action::DynamicCast(this->GetNode()));
        Action* pActionNode = (Action*)(this->GetNode());

        EBTStatus result = pActionNode->Execute(pAgent, childStatus);

        return result;
    }
开发者ID:Evilcoolkings,项目名称:behaviac,代码行数:12,代码来源:action.cpp

示例3: _impl

    Mutex::Mutex() : _impl(0)
    {
        // uint32_t s = sizeof(MutexImpl);
        // printf("size of MutexImpl %d\n", s);
        // Be sure that the shadow is large enough
        BEHAVIAC_ASSERT(sizeof(m_Shadow) >= sizeof(MutexImpl));

        // Use the shadow as memory space for the platform specific implementation
        _impl = (MutexImpl*)m_Shadow;

        pthread_mutex_init(&_impl->_mutex, 0);
    }
开发者ID:xubingyue,项目名称:tencent-behaviac-cocos3.x,代码行数:12,代码来源:mutex_gcc.cpp

示例4: BEHAVIAC_ASSERT

int CFunctionHandler::EndFunction(IScriptObject* pObj)
{
    if (!pObj)
    {
        BEHAVIAC_ASSERT(!"CFunctionHandler::EndFunction - Invalid object reference");
        lua_pushnil(m_pLS);
        return 0;
    }

    lua_xgetref(m_pLS, pObj->GetRef());
    return 1;
}
开发者ID:CodeBees,项目名称:behaviac,代码行数:12,代码来源:functionhandler.cpp

示例5: BEHAVIAC_ASSERT

    int ConnectorInterface::GetBufferIndex(bool bReserve)
    {
#if BEHAVIAC_COMPILER_MSVC
        BEHAVIAC_ASSERT(t_packetBufferIndex != TLS_OUT_OF_INDEXES);
		uint32_t bufferIndex = (uint32_t)(uint64_t)TlsGetValue(t_packetBufferIndex);
#else
        BEHAVIAC_ASSERT(t_packetBufferIndex != (unsigned int) - 1);
		uint32_t bufferIndex = t_packetBufferIndex;
#endif
        //WHEN bReserve is false, it is unsafe to allocate memory as other threads might be allocating
        //you can avoid the following assert to malloc a block of memory in your thread at the very beginning
        BEHAVIAC_ASSERT(bufferIndex > 0 || bReserve);

        //bufferIndex initially is 0
        if (bufferIndex <= 0 && bReserve)
        {
            bufferIndex = ReserveThreadPacketBuffer();
        }

        return (int)bufferIndex;
    }
开发者ID:AdamHyl,项目名称:behaviac,代码行数:21,代码来源:socketconnect_base.cpp

示例6: lua_gettop

void CScriptSystem::CheckStackOnEndCall()
{
    m_CurrentDeep = (m_CurrentDeep == 0) ? 0 : --m_CurrentDeep;
    int aLocal = lua_gettop(m_pLS);

    if (m_BeginStackTop != aLocal && m_CurrentDeep == 0)
    {
        BEHAVIAC_ASSERT(false && "Last invoked LUA script has corrupted the LUA stack (don't ignore all)");
        // Set new top (even if corrupted)
        m_BeginStackTop = aLocal;
    }
}
开发者ID:CodeBees,项目名称:behaviac,代码行数:12,代码来源:scriptsystem.cpp

示例7: BEHAVIAC_ASSERT

    bool TaskTask::onenter(Agent* pAgent) {
        this->m_activeChildIndex = CompositeTask::InvalidChildIndex;
        BEHAVIAC_ASSERT(this->m_activeChildIndex == CompositeTask::InvalidChildIndex);
        Task* pMethodNode = (Task*)(this->GetNode());

#if BEHAVIAC_USE_HTN
        _planner->Init(pAgent, pMethodNode);
#endif //BEHAVIAC_USE_HTN
        BEHAVIAC_UNUSED_VAR(pMethodNode);

        return super::onenter(pAgent);
    }
开发者ID:YaleCheung,项目名称:behaviac,代码行数:12,代码来源:task.cpp

示例8: BEHAVIAC_UNUSED_VAR

    void PlannerTaskReference::onexit(Agent* pAgent, EBTStatus status)
    {
        BEHAVIAC_UNUSED_VAR(pAgent);
        BEHAVIAC_UNUSED_VAR(status);

        BEHAVIAC_ASSERT(ReferencedBehavior::DynamicCast(this->m_node) != 0);
        ReferencedBehavior* pNode = (ReferencedBehavior*)this->m_node;
        BEHAVIAC_UNUSED_VAR(pNode);

        BEHAVIAC_ASSERT(pNode != NULL);

		this->m_subTree = 0;

#if !BEHAVIAC_RELEASE
        pAgent->LogReturnTree(pNode->GetReferencedTree());
#endif

        BEHAVIAC_ASSERT(this->currentState != NULL);
        this->currentState->Pop();
		this->currentState = 0;
    }
开发者ID:1414648814,项目名称:behaviac,代码行数:21,代码来源:plannertask.cpp

示例9: Workspace

    Workspace* Workspace::GetInstance()
    {
        if (ms_instance == NULL)
        {
            //if new  an Workspace class ,then the staict variable will be set value
            Workspace* _workspace = BEHAVIAC_NEW Workspace();
            BEHAVIAC_UNUSED_VAR(_workspace);
            BEHAVIAC_ASSERT(ms_instance != NULL);
        }

        return ms_instance;
    }
开发者ID:xubingyue,项目名称:tencent-behaviac-cocos3.x,代码行数:12,代码来源:workspace.cpp

示例10: BEHAVIAC_ASSERT

	void ReferencedBehavior::Attach(BehaviorNode* pAttachment, bool bIsPrecondition, bool bIsEffector, bool bIsTransition)
	{
		if (bIsTransition)
		{
			BEHAVIAC_ASSERT(!bIsEffector && !bIsPrecondition);

			if (this->m_transitions == 0)
			{
				this->m_transitions = BEHAVIAC_NEW behaviac::vector<Transition*>();
			}

			BEHAVIAC_ASSERT(Transition::DynamicCast(pAttachment) != 0);
			Transition* pTransition = (Transition*)pAttachment;
			this->m_transitions->push_back(pTransition);

			return;
		}

		BEHAVIAC_ASSERT(bIsTransition == false);
		super::Attach(pAttachment, bIsPrecondition, bIsEffector, bIsTransition);
	}
开发者ID:pjkui,项目名称:behaviac,代码行数:21,代码来源:referencebehavior.cpp

示例11: BEHAVIAC_ASSERT

    void SingeChildTask::copyto(BehaviorTask* target) const
    {
        super::copyto(target);

        BEHAVIAC_ASSERT(SingeChildTask::DynamicCast(target));
        SingeChildTask* ttask = (SingeChildTask*)target;

        if (this->m_root)
        {
            //referencebehavior/query, etc.
            if (!ttask->m_root)
            {
                const BehaviorNode* pNode = this->m_root->GetNode();
                BEHAVIAC_ASSERT(BehaviorTree::DynamicCast(pNode));
                ttask->m_root = pNode->CreateAndInitTask();
            }

            BEHAVIAC_ASSERT(ttask->m_root);
            this->m_root->copyto(ttask->m_root);
        }
    }
开发者ID:xfw5,项目名称:behaviac,代码行数:21,代码来源:behaviortree_task.cpp

示例12: rootId

    void SingeChildTask::load(ISerializableNode* node)
    {
        super::load(node);

        if (this->m_status != BT_INVALID)
        {
            CSerializationID  rootId("root");
            ISerializableNode* rootNode = node->findChild(rootId);
            BEHAVIAC_ASSERT(rootNode);
            this->m_root->load(rootNode);
        }
    }
开发者ID:xfw5,项目名称:behaviac,代码行数:12,代码来源:behaviortree_task.cpp

示例13: BEHAVIAC_ASSERT

    void Context::CleanupInstances()
    {
        //don't delete it as it is DestroyInstance's resposibity
        //for (Context::NamedAgents_t::iterator it = m_namedAgents.begin(); it != m_namedAgents.end(); ++it)
        //{
        //	Agent* pAgent = it->second;
        //	BEHAVIAC_DELETE(pAgent);
        //}
        BEHAVIAC_ASSERT(m_namedAgents.size() == 0, "you need to call DestroyInstance or UnbindInstance");

        m_namedAgents.clear();
    }
开发者ID:1414648814,项目名称:behaviac,代码行数:12,代码来源:context.cpp

示例14: BEHAVIAC_UNUSED_VAR

	bool CFileSystem::copyFile(const char* lpExistingFileName,
		const char* lpNewFileName,
		bool bFailIfExists)
	{
		BEHAVIAC_UNUSED_VAR(lpExistingFileName);
		BEHAVIAC_UNUSED_VAR(lpNewFileName);
		BEHAVIAC_UNUSED_VAR(bFailIfExists);

		BEHAVIAC_ASSERT(0);

		return false;
	}
开发者ID:LacusCon,项目名称:behaviac,代码行数:12,代码来源:filesystem_gcc.cpp

示例15: BEHAVIAC_ASSERT

    EBTStatus IfElseTask::update(Agent* pAgent, EBTStatus childStatus) {
		BEHAVIAC_ASSERT(childStatus != BT_INVALID);
		BEHAVIAC_ASSERT(this->m_children.size() == 3);

		EBTStatus conditionResult = BT_INVALID;

		if (childStatus == BT_SUCCESS || childStatus == BT_FAILURE) {
			// if the condition returned running then ended with childStatus
			conditionResult = childStatus;
		}

		if (this->m_activeChildIndex == CompositeTask::InvalidChildIndex) {
            BehaviorTask* pCondition = this->m_children[0];

			if (conditionResult == BT_INVALID) {
				// condition has not been checked
				conditionResult = pCondition->exec(pAgent);
			}

            if (conditionResult == BT_SUCCESS) {
				// if
                this->m_activeChildIndex = 1;
            } else if (conditionResult == BT_FAILURE) {
				// else
                this->m_activeChildIndex = 2;
            }
        }
		else {
			return childStatus;
		}

        if (this->m_activeChildIndex != CompositeTask::InvalidChildIndex) {
            BehaviorTask* pBehavior = this->m_children[this->m_activeChildIndex];
            EBTStatus s = pBehavior->exec(pAgent);

            return s;
        }

        return BT_RUNNING;
    }
开发者ID:czfsvn,项目名称:LinuxC,代码行数:40,代码来源:ifelse.cpp


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