这篇教程C++ BEHAVIAC_ASSERT函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中BEHAVIAC_ASSERT函数的典型用法代码示例。如果您正苦于以下问题:C++ BEHAVIAC_ASSERT函数的具体用法?C++ BEHAVIAC_ASSERT怎么用?C++ BEHAVIAC_ASSERT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了BEHAVIAC_ASSERT函数的23个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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,
示例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,
示例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,
示例4: BEHAVIAC_ASSERTint 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,
示例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,
示例6: lua_gettopvoid 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,
示例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,
示例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,
示例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,
示例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,
示例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,
示例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,
示例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,
示例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,
示例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,
示例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,
示例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,
示例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,
示例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,
示例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,
示例21: BEHAVIAC_ASSERT int DecoratorCount::GetCount(Agent* pAgent) const { if (this->m_count_var) { BEHAVIAC_ASSERT(this->m_count_var); TProperty<int>* pP = (TProperty<int>*)this->m_count_var; uint64_t count = pP->GetValue(pAgent); return (count == ((uint64_t) - 1) ? -1 : (int)count); } return 0; }
开发者ID:pjkui,项目名称:behaviac,代码行数:13,
示例22: BEHAVIAC_UNUSED_VAR bool IfElseTask::onenter(Agent* pAgent) { BEHAVIAC_UNUSED_VAR(pAgent); //reset it as it will be checked for the condition execution at the first time this->m_activeChildIndex = CompositeTask::InvalidChildIndex; if (this->m_children.size() == 3) { return true; } BEHAVIAC_ASSERT(false, "IfElseTask has to have three children: condition, if, else"); return false; }
开发者ID:czfsvn,项目名称:LinuxC,代码行数:13,
示例23: pthread_mutex_trylock bool Mutex::TryLock() {#if !BEHAVIAC_COMPILER_GCC_LINUX int rval = pthread_mutex_trylock(&_impl->_mutex); // valid returns are 0 (locked) and [EBUSY] BEHAVIAC_ASSERT(rval == 0 || rval == EBUSY, "critical_section::trylock: pthread_mutex_trylock failed"); bool gotlock = (rval == 0); return gotlock;#else return false;#endif }
开发者ID:xubingyue,项目名称:tencent-behaviac-cocos3.x,代码行数:13,
注:本文中的BEHAVIAC_ASSERT函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ BELLE_SIP_HEADER_ADDRESS函数代码示例 C++ BEGIN_RING函数代码示例 |