• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ BEHAVIAC_ASSERT函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: Read

        size_t Read(Handle& h, const void* buffer, size_t bytesMax)
        {
            size_t bytesRead = 0;

            if (bytesMax == 0 || !h)
            {
                return bytesRead;
            }

            fd_set readfds;
            FD_ZERO(&readfds);
            FD_SET(::AsWinSocket(h), &readfds);

            struct timeval tv;

            tv.tv_sec = 0;
            tv.tv_usec = 100000;//0.1s

            int rv = ::select(1, &readfds, 0, 0, &tv);

            if (rv == -1)
            {
                BEHAVIAC_ASSERT(0);
            }
            else if (rv == 0)
            {
                //timeout
            }
            else
            {
                int res = ::recv(::AsWinSocket(h), (char*)buffer, (int)bytesMax, 0);

                if (res == SOCKET_ERROR)
                {
                    int err = WSAGetLastError();

                    if (err == WSAECONNRESET || err == WSAECONNABORTED)
                    {
                        Close(h);
                    }
                }
                else
                {
                    bytesRead = res;
                    gs_packetsReceived++;
                }

                return bytesRead;
            }

            return 0;
        }
开发者ID:1414648814,项目名称:behaviac,代码行数:52,代码来源:defaultsocketwrapper_vcc.cpp


示例17: BEHAVIAC_UNUSED_VAR

    void BehaviorNode::load_custom(int version, const char* agentType, BsonDeserizer& d)
    {
        d.OpenDocument();

        BsonDeserizer::BsonTypes type = d.ReadType();
        BEHAVIAC_UNUSED_VAR(type);
        //BEHAVIAC_ASSERT(type == BsonDeserizer.BsonTypes.BT_NodeElement);
        BEHAVIAC_ASSERT(type == BsonDeserizer::BT_NodeElement);

        d.OpenDocument();

        BehaviorNode* pChildNode = this->load(agentType, d, version);
        this->m_customCondition = pChildNode;

        d.CloseDocument(false);

        d.CloseDocument(false);

        type = d.ReadType();
        //BEHAVIAC_ASSERT(type == BsonDeserizer.BsonTypes.BT_None);
        BEHAVIAC_ASSERT(type == BsonDeserizer::BT_None);
    }
开发者ID:haolly,项目名称:behaviac,代码行数:22,代码来源:behaviortree.cpp


示例18: BEHAVIAC_ASSERT

    bool BsonDeserizer::OpenDocument()
    {
        const char* head = this->m_pPtr;
        uint32_t size = this->ReadInt32();
        //uint16_t size = this->ReadUInt16();

        const char* end = head + size - 1;

        if (*end == 0)
        {
#if USE_DOCUMENET
            BEHAVIAC_ASSERT(this->m_documentStackTop >= 0 && this->m_documentStackTop < kDocumentStackMax - 1);
            this->m_documentStack[this->m_documentStackTop++] = this->m_document;
            this->m_document = head;
#endif
            return true;
        }

        BEHAVIAC_ASSERT(0);

        return false;
    }
开发者ID:haolly,项目名称:behaviac,代码行数:22,代码来源:behaviortree.cpp


示例19: BEHAVIAC_ASSERT

    int DecoratorWeight::GetWeight(behaviac::Agent* pAgent) const
    {
        if (this->m_weight_var)
        {
            BEHAVIAC_ASSERT(this->m_weight_var);
            TProperty<int>* pP = (TProperty<int>*)this->m_weight_var;
            uint64_t count = pP->GetValue(pAgent);

            return (count == ((uint64_t) - 1) ? -1 : (int)count);
        }

        return 0;
    }
开发者ID:1414648814,项目名称:behaviac,代码行数:13,代码来源:decoratorweight.cpp


示例20: BEHAVIAC_ASSERT

	bool ReferencedBehaviorTask::onevent(Agent* pAgent, const char* eventName)
	{
		if (this->m_status == BT_RUNNING && this->m_node->HasEvents())
        {
			BEHAVIAC_ASSERT(this->m_subTree);
            if (!this->m_subTree->onevent(pAgent, eventName))
            {
                return false;
            }
		}

		return true;
	}
开发者ID:shafeng,项目名称:behaviac,代码行数:13,代码来源:referencebehavior.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ BELLE_SIP_HEADER_ADDRESS函数代码示例发布时间:2022-05-30
下一篇:
C++ BEGIN_RING函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap