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

C++ MojAssert函数代码示例

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

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



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

示例1: LOG_TRACE

MojErr MojDbSandwichDatabase::update(const MojObject& id, MojBuffer& val, MojDbStorageItem* oldVal, MojDbStorageTxn* txn)
{
    LOG_TRACE("Entering function %s", __FUNCTION__);
    MojAssert(oldVal && txn);

    MojErr err = txn->offsetQuota(-(MojInt64) oldVal->size());
    MojErrCheck(err);

    // add/replace with a new one
    err = put(id, val, txn, false);
    MojErrCheck(err);

    return MojErrNone;
}
开发者ID:ctbrowser,项目名称:db8,代码行数:14,代码来源:MojDbSandwichDatabase.cpp


示例2: MojAssert

MojErr MojDbServiceHandler::handleFind(MojServiceMessage* msg, MojObject& payload, MojDbReq& req)
{
	MojAssert(msg);
	MojLogTrace(s_log);
	
	bool doCount = false;
	payload.get(MojDbServiceDefs::CountKey, doCount);

	MojDbCursor cursor;
	MojErr err = findImpl(msg, payload, req, cursor, doCount);
	MojErrCheck(err);

	return MojErrNone;
}
开发者ID:anttiharju-owo,项目名称:db8,代码行数:14,代码来源:MojDbServiceHandler.cpp


示例3: MojAssert

MojErr MojService::dispatchCancel(MojServiceMessage* msg)
{
	MojAssert(msg);
	MojAssertMutexUnlocked(m_mutex);
	MojLogTrace(s_log);

	SubscriptionKey key;
	MojErr err = key.init(msg);
	MojErrCheck(err);
	err = dispatchCancel(key);
	MojErrCheck(err);

	return MojErrNone;
}
开发者ID:BigBlueHat,项目名称:db8,代码行数:14,代码来源:MojService.cpp


示例4: LOG_TRACE

MojErr MojDbSearchCursor::sort()
{
    LOG_TRACE("Entering function %s", __FUNCTION__);
    MojAssert(!m_orderProp.empty());

    // TODO: instead of parsing all objects, find the serialized field in the object and compare it directly
    // create extractor for sort prop
    MojRefCountedPtr<MojDbTextCollator> collator(new MojDbTextCollator);
    MojAllocCheck(collator.get());
    // TODO: use real locale
    //MojErr err = collator->init(_T(""), MojDbCollationPrimary);
    MojErr err = MojErrNone;

    // set locale
    MojString locale = m_locale;
    if(m_dbIndex) {
        locale = m_dbIndex->locale();
    }
    // set collate
    MojDbCollationStrength coll = m_collation;
    if (coll == MojDbCollationInvalid) {
        // default setting is primary
        coll = MojDbCollationPrimary;
    }
    err = collator->init(locale, coll);
    MojErrCheck(err);

    MojDbPropExtractor extractor;
    extractor.collator(collator.get());
    err = extractor.prop(m_orderProp);
    MojErrCheck(err);

    // create sort keys
    MojDbKeyBuilder builder;
    ItemVec::Iterator begin;
    err = m_items.begin(begin);
    MojErrCheck(err);
    for (ItemVec::Iterator i = begin; i != m_items.end(); ++i) {
        KeySet keys;
        err = extractor.vals((*i)->obj(), keys);
        MojErrCheck(err);
        (*i)->sortKeys(keys);
    }

    // sort
    err = m_items.sort();
    MojErrCheck(err);

    return MojErrNone;
}
开发者ID:pombredanne,项目名称:db8,代码行数:50,代码来源:MojDbSearchCursor.cpp


示例5: MojAssert

MojErr MojDbIndex::cancelWatch(MojDbWatcher* watcher)
{
	MojAssert(isOpen());
	MojAssert(watcher);
	MojLogTrace(s_log);

	MojLogInfo(s_log, _T("Index_cancelWatch: index name = %s; domain = %s\n"),
				this->name().data(), watcher->domain().data());

	MojThreadWriteGuard guard(m_lock);
	MojSize idx;
	MojSize size = m_watcherVec.size();
	for (idx = 0; idx < size; ++idx) {
		if (m_watcherVec.at(idx).get() == watcher) {
			MojErr err = m_watcherVec.erase(idx);
			MojErrCheck(err);
			WatcherMap::Iterator iter;
			err = m_watcherMap.find(watcher->domain(), iter);
			MojErrCheck(err);
			if (iter != m_watcherMap.end()) {
				iter.value() -= 1;
				if (iter.value() == 0) {
					bool found = false;
					m_watcherMap.del(iter.key(), found);
					MojAssert(found);
					MojLogInfo(s_log, _T("Index_cancelwatch: Domain Del found = %d; index name = %s; domain = %s\n"),
 						(int)found, this->name().data(), watcher->domain().data());
				}
			}
			break;
		}
	}
	if (idx == size)
		MojErrThrow(MojErrDbWatcherNotRegistered);

	return MojErrNone;
}
开发者ID:KyleMaas,项目名称:db8,代码行数:37,代码来源:MojDbIndex.cpp


示例6: MojAssert

MojErr MojDbSandwichEngine::open(const MojChar* path)
{
    MojAssert(path);
    MojAssert(m_env.get());
	MojAssert(!m_isOpen);

	MojErr err;

	err = m_path.assign(path);
	MojErrCheck(err);

	// TODO: We should get this options from ENV
	m_db->options = MojDbSandwichEngine::getOpenOptions();
	m_db->writeOptions = MojDbSandwichEngine::getWriteOptions();
	m_db->readOptions = MojDbSandwichEngine::getReadOptions();

	leveldb::Status status = m_db->Open(path);
	MojLdbErrCheck(status, _T("db_create/db_open"));

	// open seqence db
	m_seqDb.reset(new MojDbSandwichDatabase(m_db.use(MojEnvSeqDbName)));
	MojAllocCheck(m_seqDb.get());

	err = m_seqDb->open(MojEnvSeqDbName, this);
	MojErrCheck(err);

	// open index db
	m_indexDb.reset(new MojDbSandwichDatabase(m_db.use(MojEnvIndexDbName)));
	MojAllocCheck(m_indexDb.get());

	err = m_indexDb->open(MojEnvIndexDbName, this);
	MojErrCheck(err);

	m_isOpen = true;

    return MojErrNone;
}
开发者ID:feniksa,项目名称:indb8,代码行数:37,代码来源:MojDbSandwichEngine.cpp


示例7: LOG_TRACE

MojErr MojDbIndex::cancelWatch(MojDbWatcher* watcher)
{
    LOG_TRACE("Entering function %s", __FUNCTION__);
	MojAssert(isOpen());
	MojAssert(watcher);

    LOG_DEBUG("[db_mojodb] Index_cancelWatch: index name = %s; domain = %s\n",
		this->name().data(), watcher->domain().data());

	MojThreadWriteGuard guard(m_lock);
	MojSize idx;
	MojSize size = m_watcherVec.size();
	for (idx = 0; idx < size; ++idx) {
		if (m_watcherVec.at(idx).get() == watcher) {
			MojErr err = m_watcherVec.erase(idx);
			MojErrCheck(err);
			WatcherMap::Iterator iter;
			err = m_watcherMap.find(watcher->domain(), iter);
			MojErrCheck(err);
			if (iter != m_watcherMap.end()) {
				iter.value() -= 1;
				if (iter.value() == 0) {
					bool found = false;
					m_watcherMap.del(iter.key(), found);
					MojAssert(found);
					LOG_DEBUG("[db_mojodb] Index_cancelwatch: Domain Del found = %d; index name = %s; domain = %s\n",
 						(int)found, this->name().data(), watcher->domain().data());
				}
			}
			break;
		}
	}
	if (idx == size)
		MojErrThrow(MojErrDbWatcherNotRegistered);

	return MojErrNone;
}
开发者ID:sailesharya,项目名称:db8,代码行数:37,代码来源:MojDbIndex.cpp


示例8: MojErrCheck

MojErr MojDbTestStorageTxn::commitImpl()
{
	MojErr err = m_testEngine->checkErrMap(_T("txn.commit"));
	if (err != MojErrNone) {
		MojErr errAbort = m_txn->abort();
		MojErrCheck(errAbort);
		return err;
	}

	MojAssert(m_txn.get());
	err = m_txn->commit();
	MojErrCheck(err);

	return MojErrNone;
}
开发者ID:anttiharju-owo,项目名称:db8,代码行数:15,代码来源:MojDbTestStorageEngine.cpp


示例9: MojAssert

MojErr MojGmainReactor::addSock(MojSockT sock)
{
	MojAssert(sock != MojInvalidSock);
	MojAssert(m_mainLoop.get());

	MojThreadGuard guard(m_mutex);
	MojAssert(!m_sources.contains(sock));

	// alloc info and source
	SourcePtr source;
	MojErr err = source.resetChecked((Source*) g_source_new(&s_sourceFuncs, sizeof(Source)));
	MojErrCheck(err);
	source->m_info = new SockInfo(sock, m_mutex);
	MojAllocCheck(source->m_info);
	source->m_info->retain();
	// add to vec
	err = m_sources.put(sock, source);
	MojErrCheck(err);
	// attach
	g_source_attach(source.get(), g_main_loop_get_context(m_mainLoop.get()));
	g_source_add_poll(source.get(), &source->m_info->m_pollFd);

	return MojErrNone;
}
开发者ID:anttiharju-owo,项目名称:db8,代码行数:24,代码来源:MojGmainReactor.cpp


示例10: MojAssert

MojErr MojDbKindState::writeObj(const MojChar* key, const MojObject& val, MojDbStorageDatabase* db,
		MojDbStorageTxn* txn, MojRefCountedPtr<MojDbStorageItem>& oldItem)
{
	MojAssert(key && db && txn);
	MojAssertMutexLocked(m_lock);

	// reconstitute obj
	MojObject obj;
	if (oldItem.get()) {
		MojErr err = oldItem->toObject(obj, *m_kindEngine, false);
		MojErrCheck(err);
	}
	MojErr err = obj.put(key, val);
	MojErrCheck(err);

	// we directly use the storage engine apis because the higher-level apis depend on the kind state.
	MojBuffer buf;
	err = obj.toBytes(buf);
	MojErrCheck(err);

	txn->quotaEnabled(false);
	if (oldItem.get()) {
		err = db->update(m_kindId, buf, oldItem.get(), txn);
		MojErrCheck(err);
	} else {
		err = db->insert(m_kindId, buf, txn);
		MojErrCheck(err);
		// get old item so we can update it next time
		err = db->get(m_kindId, txn, false, oldItem);
                MojAssert(oldItem.get());
		MojErrCheck(err);
	}
	txn->quotaEnabled(true);

	return MojErrNone;
}
开发者ID:feniksa,项目名称:indb8,代码行数:36,代码来源:MojDbKindState.cpp


示例11: MojAssert

MojErr MojDbQuotaEngine::getUsage(const MojString& kindId, MojDbStorageTxn* txn, bool forUpdate, MojInt64& usageOut, MojRefCountedPtr<MojDbStorageItem>& itemOut)
{
	MojAssert(txn);

	usageOut = 0;
	MojErr err = m_usageDb->get(kindId, txn, forUpdate, itemOut);
	MojErrCheck(err);
	if (itemOut.get()) {
		MojObject val;
		err = itemOut->toObject(val, *m_db->kindEngine(), false);
		MojErrCheck(err);
		usageOut = val.intValue();
	}
	return MojErrNone;
}
开发者ID:anttiharju-owo,项目名称:db8,代码行数:15,代码来源:MojDbQuotaEngine.cpp


示例12: MojAssert

MojErr MojDecimal::assign(const MojChar* str, MojSize n)
{
	MojAssert(str);

    MojNumber::Parser p;
    MojErr err;

    err = MojNumber::Lexer::parse(p, str, n);
    MojErrCheck( err );

    err = p.toDecimal( *this );
    MojErrCheck( err );

    return MojErrNone;
}
开发者ID:ctbrowser,项目名称:db8,代码行数:15,代码来源:MojDecimal.cpp


示例13: MojAssert

MojErr MojDbKind::openIndex(MojDbIndex* index, MojDbReq& req)
{
	MojAssert(index);
	MojAssert(m_db);
	MojLogTrace(s_log);

	// construct storage index name
	MojString name;
	MojErr err = name.format(_T("%s-%d-%s"), m_name.data(), m_version, index->name().data());
	MojErrCheck(err);
	// get id
	MojObject id;
	bool created = false;
	err = m_state->indexId(index->name(), req, id, created);
	MojErrCheck(err);
	// open
	MojRefCountedPtr<MojDbStorageIndex> storageIndex;
	err = m_db->openIndex(id, req.txn(), storageIndex);
	MojErrCheck(err);
	err = index->open(storageIndex.get(), id, req, created);
	MojErrCheck(err);

	return MojErrNone;
}
开发者ID:webOS101,项目名称:db8,代码行数:24,代码来源:MojDbKind.cpp


示例14: MojAssert

MojErr MojSocketMessageParser::readFromSocket(MojSockT sock, MojRefCountedPtr<MojSocketMessage>& msgOut, bool& completeOut)
{
	MojErr err = MojErrNone;
	MojAssert(sock != -1);
	completeOut = false;

	while (m_headerBytes < sizeof(m_header)) {
		MojInt32 sz = recv(sock, m_headerBuf+m_headerBytes, sizeof(m_header) - m_headerBytes, 0);
		MojParserRecvCheck(sz);
		m_headerBytes += sz;
		if (m_headerBytes == sizeof(m_header)) {
			MojDataReader reader(m_headerBuf, m_headerBytes);
			err = m_header.read(reader);
			MojErrCheck(err);
			m_messageData = new MojByte[m_header.messageLen()];
			MojAllocCheck(m_messageData);
		}
	}

	while (m_messageBytesRead < m_header.messageLen()) {
		MojInt32 sz = recv(sock, m_messageData + m_messageBytesRead, m_header.messageLen() - m_messageBytesRead, 0);
		MojParserRecvCheck(sz);
		m_messageBytesRead += sz;
	}

	msgOut.reset(new MojSocketMessage);
	if (!msgOut.get()) {
		err = MojErrNoMem;
		MojErrGoto(err, done);
	}
	MojSize cbConsumed;
	err = msgOut->extract(m_messageData, m_header.messageLen(), cbConsumed);
	MojErrGoto(err, done);
	if (m_header.messageLen() != cbConsumed) {
		err = MojErrInvalidMsg;
		MojErrGoto(err, done);
	}

	completeOut = true;

done:
	if (m_messageData) {
		delete[] m_messageData;
		m_messageData = NULL;
	}

	return err;
}
开发者ID:KyleMaas,项目名称:db8,代码行数:48,代码来源:MojSocketEncoding.cpp


示例15: MojAssert

MojErr MojSockAddr::fromPath(const MojChar* path)
{
    MojAssert(path);

    MojSockAddrUnT addr;
    MojZero(&addr, sizeof(addr));

    if (MojStrLen(path) > (sizeof(addr.sun_path) - 1))
        MojErrThrow(MojErrPathTooLong);
    MojStrCpy(addr.sun_path, path);

    addr.sun_family = MOJ_PF_LOCAL;
    fromAddr((MojSockAddrT*) &addr, sizeof(addr));

    return MojErrNone;
}
开发者ID:webOS-ports,项目名称:db8,代码行数:16,代码来源:MojSock.cpp


示例16: MojLogTrace

MojErr MojService::close()
{
	MojLogTrace(s_log);

	// cancel all pending subscriptions
	MojErr err = MojErrNone;
	for (SubscriptionMap::ConstIterator i = m_subscriptions.begin(); i != m_subscriptions.end();) {
		SubscriptionKey key = (i++).key();
		MojErr errClose = dispatchCancel(key);
		MojErrAccumulate(err, errClose);
	}
	// if you're hitting this assertion, you probably aren't releasing your message in your cancel handler
	MojAssert(m_subscriptions.empty());

	return err;
}
开发者ID:BigBlueHat,项目名称:db8,代码行数:16,代码来源:MojService.cpp


示例17: LOG_TRACE

MojErr MojDbLevelIndex::open(const MojObject& id, MojDbLevelDatabase* db, MojDbStorageTxn* txn)
{
    LOG_TRACE("Entering function %s", __FUNCTION__);
    MojAssert(db && db->engine());

    m_id = id;

    // this is deprecated
    // m_db and m_primaryDb should point to the same object
    // leave both of them here more for debugging purposes

    m_db.reset(db->engine()->indexDb());
    m_primaryDb.reset(db);

    return MojErrNone;
}
开发者ID:sailesharya,项目名称:db8,代码行数:16,代码来源:MojDbLevelIndex.cpp


示例18: MojAssert

MojErr MojDbKindState::readObj(const MojChar* key, MojObject& val, MojDbStorageDatabase* db,
		MojDbStorageTxn* txn, MojRefCountedPtr<MojDbStorageItem>& oldItem)
{
	MojAssert(key && db);

	MojErr err = db->get(m_kindId, txn, false, oldItem);
	MojErrCheck(err);
	if (oldItem.get()) {
		// get objects
		MojObject obj;
		err = oldItem->toObject(obj, *m_kindEngine, false);
		MojErrCheck(err);
		obj.get(key, val);
	}
	return MojErrNone;
}
开发者ID:BigBlueHat,项目名称:db8,代码行数:16,代码来源:MojDbKindState.cpp


示例19: g_thread_init

MojErr MojGmainReactor::init()
{
#if !GLIB_CHECK_VERSION(2,32,0)
    // init glib threads - must be done BEFORE any other call to glib!!!!
    // glib >= 2.32.0 does this automatically
    if (!g_thread_supported())
    {
        g_thread_init(NULL);
    }
#endif /* GLIB_CHECK_VERSION */
	MojAssert(!m_mainLoop.get());
	m_mainLoop.reset(g_main_loop_new(NULL, false));
	MojAllocCheck(m_mainLoop.get());

	return MojErrNone;
}
开发者ID:KyleMaas,项目名称:db8,代码行数:16,代码来源:MojGmainReactor.cpp


示例20: MojAssert

MojErr MojBuffer::write(const void* data, MojSize size)
{
	MojAssert(data || size == 0);

	const MojByte* bytes = static_cast<const MojByte*>(data);
	while (size > 0) {
		Chunk* chunk;
		MojErr err = writeableChunk(chunk, size);
		MojErrCheck(err);
		MojSize chunkSize = MojMin(size, chunk->freeSpace());
		chunk->write(bytes, chunkSize);
		bytes += chunkSize;
		size -= chunkSize;
	}
	return MojErrNone;
}
开发者ID:feniksa,项目名称:indb8,代码行数:16,代码来源:MojBuffer.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ MojErrCheck函数代码示例发布时间:2022-05-30
下一篇:
C++ MojAllocCheck函数代码示例发布时间: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