本文整理汇总了C++中ObjectWrapper::has_binary方法的典型用法代码示例。如果您正苦于以下问题:C++ ObjectWrapper::has_binary方法的具体用法?C++ ObjectWrapper::has_binary怎么用?C++ ObjectWrapper::has_binary使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ObjectWrapper
的用法示例。
在下文中一共展示了ObjectWrapper::has_binary方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
示例2: 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));
}
示例3: 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;
}
示例4: 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());
}
//.........这里部分代码省略.........
示例5: 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);
}