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


C++ UUID::rawHexData方法代码示例

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


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

示例1: performUpdate

SQLitePersistedObjectSet::UpdateResult SQLitePersistedObjectSet::performUpdate(const UUID& internal_id, const String& script_type, const String& script_args, const String& script_contents, RequestCallback cb) {
    SQLitePersistedObjectSet::UpdateResult result = SUCCESS;

    bool success = true;

    int rc;
    char* remain;
    String value_insert;
    value_insert = "INSERT OR REPLACE INTO ";
    value_insert += "\"" TABLE_NAME "\"";
    value_insert += " (object, script_type, script_args, script_contents) VALUES(?, ?, ?, ?)";

    sqlite3_stmt* value_insert_stmt;
    rc = sqlite3_prepare_v2(mDB->db(), value_insert.c_str(), -1, &value_insert_stmt, (const char**)&remain);
    success = success && !checkSQLiteError(rc, "Error preparing value insert statement");

    String id_str = internal_id.rawHexData();
    rc = sqlite3_bind_text(value_insert_stmt, 1, id_str.c_str(), (int)id_str.size(), SQLITE_TRANSIENT);
    success = success && !checkSQLiteError(rc, "Error binding object internal ID to value insert statement");
    rc = sqlite3_bind_text(value_insert_stmt, 2, script_type.c_str(), (int)script_type.size(), SQLITE_TRANSIENT);
    success = success && !checkSQLiteError(rc, "Error binding script_type name to value insert statement");
    rc = sqlite3_bind_blob(value_insert_stmt, 3, script_args.c_str(), (int)script_args.size(), SQLITE_TRANSIENT);
    success = success && !checkSQLiteError(rc, "Error binding script_args to value insert statement");
    rc = sqlite3_bind_blob(value_insert_stmt, 4, script_contents.c_str(), (int)script_contents.size(), SQLITE_TRANSIENT);
    success = success && !checkSQLiteError(rc, "Error binding script_contents to value insert statement");

    int step_rc = SQLITE_OK;
    while(step_rc == SQLITE_OK) {
        step_rc = sqlite3_step(value_insert_stmt);
    }
    if (step_rc != SQLITE_OK && step_rc != SQLITE_DONE) {
        success = false;
        sqlite3_reset(value_insert_stmt); // allow this to be cleaned
                                          // up
        if (step_rc == SQLITE_LOCKED || step_rc == SQLITE_BUSY)
            result = LOCK_ERROR;
        else
            SILOG(sqlite-persisted-object-set, error, "Update failed: " << SQLite::resultAsString(step_rc));
    }

    rc = sqlite3_finalize(value_insert_stmt);
    success = success && !checkSQLiteError(rc, "Error finalizing value insert statement");

    if (!success && result == SUCCESS)
        result = TRANSACTION_ERROR;

    return result;
}
开发者ID:AsherBond,项目名称:sirikata,代码行数:48,代码来源:SQLitePersistedObjectSet.cpp

示例2: performUpdate

void SQLitePersistedObjectSet::performUpdate(const UUID& internal_id, const String& script_type, const String& script_args, const String& script_contents, RequestCallback cb) {
    bool success = true;

    int rc;
    char* remain;
    String value_insert;
    value_insert = "INSERT OR REPLACE INTO ";
    value_insert += "\"" TABLE_NAME "\"";
    value_insert += " (object, script_type, script_args, script_contents) VALUES(?, ?, ?, ?)";

    sqlite3_stmt* value_insert_stmt;
    rc = sqlite3_prepare_v2(mDB->db(), value_insert.c_str(), -1, &value_insert_stmt, (const char**)&remain);
    success = success && !SQLite::check_sql_error(mDB->db(), rc, NULL, "Error preparing value insert statement");

    String id_str = internal_id.rawHexData();
    rc = sqlite3_bind_text(value_insert_stmt, 1, id_str.c_str(), (int)id_str.size(), SQLITE_TRANSIENT);
    success = success && !SQLite::check_sql_error(mDB->db(), rc, NULL, "Error binding object internal ID to value insert statement");
    rc = sqlite3_bind_text(value_insert_stmt, 2, script_type.c_str(), (int)script_type.size(), SQLITE_TRANSIENT);
    success = success && !SQLite::check_sql_error(mDB->db(), rc, NULL, "Error binding script_type name to value insert statement");
    rc = sqlite3_bind_blob(value_insert_stmt, 3, script_args.c_str(), (int)script_args.size(), SQLITE_TRANSIENT);
    success = success && !SQLite::check_sql_error(mDB->db(), rc, NULL, "Error binding script_args to value insert statement");
    rc = sqlite3_bind_blob(value_insert_stmt, 4, script_contents.c_str(), (int)script_contents.size(), SQLITE_TRANSIENT);
    success = success && !SQLite::check_sql_error(mDB->db(), rc, NULL, "Error binding script_contents to value insert statement");

    int step_rc = SQLITE_OK;
    while(step_rc == SQLITE_OK) {
        step_rc = sqlite3_step(value_insert_stmt);
    }
    if (step_rc != SQLITE_OK && step_rc != SQLITE_DONE) {
        success = false;
        sqlite3_reset(value_insert_stmt); // allow this to be cleaned
                                          // up
    }

    rc = sqlite3_finalize(value_insert_stmt);
    success = success && !SQLite::check_sql_error(mDB->db(), rc, NULL, "Error finalizing value insert statement");

    if (cb != 0)
        mContext->mainStrand->post(std::tr1::bind(cb, success), "SQLitePersistedObjectSet::performUpdate callback");
}
开发者ID:yinlei,项目名称:sirikata,代码行数:40,代码来源:SQLitePersistedObjectSet.cpp

示例3: convert_obj_id_to_dht_key

void CraqObjectSegmentation::convert_obj_id_to_dht_key(const UUID& obj_id, CraqDataKey& returner) const
{
    returner[0] = myUniquePrefixKey;
    strncpy(returner+1,obj_id.rawHexData().c_str(),obj_id.rawHexData().size() + 1);
}
开发者ID:pathorn,项目名称:sirikata,代码行数:5,代码来源:CraqObjectSegmentation.cpp

示例4: beginCraqLookup

void CraqObjectSegmentation::beginCraqLookup(const UUID& obj_id, OSegLookupTraceToken* traceToken)
{
    --mOSegQueueLen;
    if (mStopping)
    {
        delete traceToken;
        return;
    }

    traceToken->stamp(OSegLookupTraceToken::OSEG_TRACE_CRAQ_LOOKUP_BEGIN);

    UUID tmper = obj_id;
    InTransitMap::const_iterator iter = mInTransitOrLookup.find(tmper);

    if (iter == mInTransitOrLookup.end()) //means that the object isn't already being looked up and the object isn't already in transit
    {
        //Duration beginCraqLookupNotAlreadyLookingUpDur = Time::local() - Time::epoch();
        //traceToken->craqLookupNotAlreadyLookingUpBegin  = beginCraqLookupNotAlreadyLookingUpDur.toMicroseconds();
        traceToken->stamp(OSegLookupTraceToken::OSEG_TRACE_CRAQ_LOOKUP_NOT_ALREADY_LOOKING_UP_BEGIN);

        //if object is not in transit, lookup its location in the dht.  returns -1 if object doesn't exist.
        //add the mapping of a craqData Key to a uuid.

        ++numCraqLookups;

        std::string indexer = "";
        indexer.append(1,myUniquePrefixKey);
        indexer.append(tmper.rawHexData());

        CraqDataSetGet cdSetGet (indexer,CraqEntry::null(),false,CraqDataSetGet::GET); //bftm modified

        mapDataKeyToUUID[indexer] = tmper; //changed here.


        CONTEXT_SPACETRACE(objectSegmentationCraqLookupRequest,
                           obj_id,
                           mContext->id());

        ++numLookingUpDebug;

        //puts object in transit or lookup.
        //Duration timerDur =  Time::local() - Time::epoch();

        TransLookup tmpTransLookup;
        tmpTransLookup.sID = CraqEntry::null();  //means that we're performing a lookup, rather than a migrate.
        //tmpTransLookup.timeAdmitted = (int)timerDur.toMilliseconds();
        tmpTransLookup.timeAdmitted = 0;

        mInTransitOrLookup[tmper] = tmpTransLookup; //just says that we are performing a lookup on the object

        traceToken->stamp(OSegLookupTraceToken::OSEG_TRACE_CRAQ_LOOKUP_END);
        traceToken->stamp(OSegLookupTraceToken::OSEG_TRACE_CRAQ_LOOKUP_NOT_ALREADY_LOOKING_UP_END);

        if ((numCraqLookups %2) == 0)
            craqDhtGet1.get(cdSetGet,traceToken); //calling the craqDht to do a get
        else
            craqDhtGet2.get(cdSetGet,traceToken); //calling the craqDht to do a get.
    }
    else
    {
        ++numAlreadyLookingUp;
        traceToken->stamp(OSegLookupTraceToken::OSEG_TRACE_CRAQ_LOOKUP_END);
        CONTEXT_SPACETRACE(osegCumulativeResponse, traceToken);
        delete traceToken;
    }
}
开发者ID:pathorn,项目名称:sirikata,代码行数:66,代码来源:CraqObjectSegmentation.cpp


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