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


C++ ObjectWrapper::type方法代码示例

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


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

示例1: wrapSimpleType

bool GridClientObjectWrapperConvertor::wrapSimpleType(const GridClientVariant& var, ObjectWrapper& objWrapper) {
    objWrapper.set_type(NONE);
    GridClientVariantVisitorImpl visitor(objWrapper);
    objWrapper.set_binary((void*) NULL, 0);
    var.accept(visitor);

    return objWrapper.type() != NONE;
}
开发者ID:anujsrc,项目名称:gridgain,代码行数:8,代码来源:gridclientprotobufutils.cpp

示例2: unwrapCollection

template<class T> void unwrapCollection(const ObjectWrapper& objWrapper, std::vector<T>& res) {
    assert(objWrapper.type() == COLLECTION);
    assert(objWrapper.has_binary());

    res.clear();

    ::Collection coll;

    unmarshalMsg(objWrapper.binary().c_str(), objWrapper.binary().size(), coll);

    unwrapCollection(coll, res);
}
开发者ID:anujsrc,项目名称:gridgain,代码行数:12,代码来源:gridclientprotobufmarshaller.cpp

示例3: unwrapMap

template<class K, class V> void unwrapMap(ObjectWrapper objWrapper, std::map<K, V>& res) {
    assert(objWrapper.type() == MAP);
    assert(objWrapper.has_binary());

    res.clear();

    ::Map map;

    unmarshalMsg((int8_t*) objWrapper.binary().c_str(), objWrapper.binary().size(), map);

    const ::google::protobuf::RepeatedPtrField< ::KeyValue >& repFileds = map.entry();

    std::for_each(repFileds.begin(), repFileds.end(), MapInserter<K, V, ::KeyValue>(res));
}
开发者ID:anujsrc,项目名称:gridgain,代码行数:14,代码来源:gridclientprotobufmarshaller.cpp

示例4: doUnwrapSimpleType

static bool doUnwrapSimpleType(const ObjectWrapper& objWrapper, GridClientVariant& var) {
    assert(objWrapper.has_binary());

    GG_LOG_DEBUG("Unwrap simple type: %s", objWrapper.DebugString().c_str());

    string binary = objWrapper.binary();

    bool unwrapRes = false;

    switch (objWrapper.type()) {
        case NONE:
            return true;
        case BOOL:
            return getBoolValue(binary, var);

        case BYTE:
            return getByteValue(binary, var);

        case BYTES:
            return getBytesValue(binary, var);

        case INT32:
            return getInt32Value(binary, var);

        case INT64:
            return getInt64Value(binary, var);

        case SHORT:
            return getInt16Value(binary, var);

        case STRING:
            var.set(binary);
            return true;

        case DOUBLE:
            return getDoubleValue(binary, var);

        case FLOAT:
            return getFloatValue(binary, var);

        case TASK_BEAN:
            return getTaskTesult(binary, var);

        default: // Non-simple type

            break;
    }

    return unwrapRes;
}
开发者ID:anujsrc,项目名称:gridgain,代码行数:50,代码来源:gridclientprotobufutils.cpp

示例5: unwrap

static void unwrap(const ObjectWrapper& objWrapper, GridClientNode& res) {
    assert(objWrapper.type() == NODE_BEAN);
    assert(objWrapper.has_binary());

    ::ProtoNodeBean bean;

    boost::asio::io_service ioSrvc;
    boost::asio::ip::tcp::resolver resolver(ioSrvc);

    unmarshalMsg((int8_t*) objWrapper.binary().c_str(), objWrapper.binary().size(), bean);

    GridNodeMarshallerHelper helper(res);

    helper.setNodeId(GridUuid::fromBytes(bean.nodeid()));

    GridClientVariant consistentId;

    GridClientObjectWrapperConvertor::unwrapSimpleType(bean.consistentid(), consistentId);

    helper.setConsistentId(consistentId);

    int tcpport = bean.tcpport();
    int jettyport = bean.jettyport();

    std::vector<GridSocketAddress> addresses;

    for (int i = 0; i < bean.jettyaddress_size(); ++i) {
        if (bean.jettyaddress(i).size()) {
            GridSocketAddress newJettyAddress = GridSocketAddress(bean.jettyaddress(i), jettyport);

            boost::asio::ip::tcp::resolver::query queryIp(bean.jettyaddress(i),
                boost::lexical_cast<std::string>(bean.jettyport()));

            boost::system::error_code ec;

            boost::asio::ip::tcp::resolver::iterator endpoint_iter = resolver.resolve(queryIp, ec);

            if (!ec)
                addresses.push_back(newJettyAddress);
            else
                GG_LOG_ERROR("Error resolving hostname: %s, %s", bean.jettyaddress(i).c_str(), ec.message().c_str());
        }
    }

    for (int i = 0; i < bean.jettyhostname_size(); ++i) {
        if (bean.jettyhostname(i).size()) {
            GridSocketAddress newJettyAddress = GridSocketAddress(bean.jettyhostname(i), jettyport);

            boost::asio::ip::tcp::resolver::query queryHostname(bean.jettyhostname(i),
                boost::lexical_cast<std::string>(bean.jettyport()));

            boost::system::error_code ec;

            boost::asio::ip::tcp::resolver::iterator endpoint_iter = resolver.resolve(queryHostname, ec);

            if (!ec)
                addresses.push_back(newJettyAddress);
            else
                GG_LOG_ERROR("Error resolving hostname: %s, %s", bean.jettyhostname(i).c_str(), ec.message().c_str());
        }

    }

    helper.setJettyAddresses(addresses);
    addresses.clear();

    for (int i = 0; i < bean.tcpaddress_size(); ++i) {
        if (bean.tcpaddress(i).size()) {
            GridSocketAddress newTCPAddress = GridSocketAddress(bean.tcpaddress(i), tcpport);

            boost::asio::ip::tcp::resolver::query queryIp(bean.tcpaddress(i),
                boost::lexical_cast<std::string>(bean.tcpport()));

            boost::system::error_code ec;

            boost::asio::ip::tcp::resolver::iterator endpoint_iter = resolver.resolve(queryIp, ec);

            if (!ec)
                addresses.push_back(newTCPAddress);
            else
                GG_LOG_ERROR("Error resolving hostname: %s, %s", bean.tcpaddress(i).c_str(), ec.message().c_str());
        }
    }

    for (int i = 0; i < bean.tcphostname_size(); ++i) {
        if (bean.tcphostname(i).size()) {
            GridSocketAddress newTCPAddress = GridSocketAddress(bean.tcphostname(i), tcpport);

            boost::asio::ip::tcp::resolver::query queryHostname(bean.tcphostname(i),
                boost::lexical_cast<std::string>(bean.tcpport()));

            boost::system::error_code ec;

            boost::asio::ip::tcp::resolver::iterator endpoint_iter = resolver.resolve(queryHostname, ec);

            if (!ec)
                addresses.push_back(newTCPAddress);
            else
                GG_LOG_ERROR("Error resolving hostname: %s, %s", bean.tcphostname(i).c_str(), ec.message().c_str());
        }
//.........这里部分代码省略.........
开发者ID:anujsrc,项目名称:gridgain,代码行数:101,代码来源:gridclientprotobufmarshaller.cpp

示例6: unwrapResponse

static void unwrapResponse(const ObjectWrapper& objWrapper, ProtoResponse& resp) {
    assert(objWrapper.type() == RESPONSE);
    assert(objWrapper.has_binary());

    unmarshalMsg((int8_t*) objWrapper.binary().c_str(), objWrapper.binary().size(), resp);
}
开发者ID:anujsrc,项目名称:gridgain,代码行数:6,代码来源:gridclientprotobufmarshaller.cpp


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