本文整理汇总了C++中ObjectWrapper::set_binary方法的典型用法代码示例。如果您正苦于以下问题:C++ ObjectWrapper::set_binary方法的具体用法?C++ ObjectWrapper::set_binary怎么用?C++ ObjectWrapper::set_binary使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ObjectWrapper
的用法示例。
在下文中一共展示了ObjectWrapper::set_binary方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例2: wrapRequest
static void wrapRequest(const GridClientMessageCommand& cmd, const ObjectWrapperType& type,
const ::google::protobuf::Message& src, ObjectWrapper& objWrapper) {
GG_LOG_DEBUG("Wrapping request: %s", src.DebugString().c_str());
ProtoRequest req;
fillRequestHeader(cmd, req);
objWrapper.set_type(type);
int8_t * pBuffer;
unsigned long bufferLength;
GridClientProtobufMarshaller::marshalMsg(src, pBuffer, bufferLength);
req.set_body(pBuffer, bufferLength);
delete[] pBuffer;
GridClientProtobufMarshaller::marshalMsg(req, pBuffer, bufferLength);
objWrapper.set_binary(pBuffer, bufferLength);
delete[] pBuffer;
}
示例3: run
//.........这里部分代码省略.........
break;
case UUID: { // block of code to avoid compilation error in gcc
value.set(GridClientUuid("550e8400-e29b-41d4-a716-446655440000"));
if (unmarshal)
std::cerr << "Unmarshalling UUID is not supported yet";
}
break;
default:
std::cerr << "Unsupported message type.\n";
return;
}
while (++iters != maxiterations) {
GridClientObjectWrapperConvertor::wrapSimpleType(value, marshalledObject);
if (unmarshal && messageType != UUID) {
value.clear();
GridClientObjectWrapperConvertor::unwrapSimpleType(marshalledObject, value);
}
}
}
else {
switch (messageType) {
case CACHE_REQUEST: { // block of code to avoid compilation error in gcc
GridCacheRequestCommand cmd = GridCacheRequestCommand(
GridCacheRequestCommand::GridCacheOperation::PUT);
cmd.sessionToken("Something");
cmd.setCacheName("partitioned");
cmd.setClientId(GridClientUuid("550e8400-e29b-41d4-a716-446655440000"));
cmd.setDestinationId(GridClientUuid("550e8400-e29b-41d4-a716-446655440000"));
cmd.setKey(42.0f);
cmd.setRequestId(42);
cmd.setValue(42.0f);
// typical reply for cache PUT. 15 bytes length;
unsigned char daReply[] = { 8, 0, 26, 5, 8, 1, 18, 1, 1, 34, 0 };
GridClientMessageCacheModifyResult resp;
while (++iters != maxiterations) {
GridClientProtobufMarshaller::wrap(cmd, marshalledObject);
if (unmarshal) {
marshalledObject.set_binary(daReply, sizeof(daReply));
marshalledObject.set_type(RESPONSE);
GridClientProtobufMarshaller::unwrap(marshalledObject, resp);
}
}
}
break;
case TOPOLOGY_REQUEST: { // block of code to avoid compilation error in gcc
GridTopologyRequestCommand cmd;
// typical reply for topology. Contains info about 2 local nodes. 185 bytes length;
unsigned char daReply[] = { 8, 0, 26, 173, 1, 8, 10, 18, 168, 1, 10, 165, 1, 8, 60, 18, 160,
1, 10, 16, 6, 225, 6, 102, 61, 76, 77, 123, 129, 135, 99, 184, 120, 177, 249,
186, 18, 9, 49, 50, 55, 46, 48, 46, 48, 46, 49, 26, 9, 49, 50, 55, 46, 48,
46, 48, 46, 49, 32, 224, 78, 40, 144, 63, 74, 88, 10, 25, 10, 6, 8, 9, 18,
2, 116, 120, 18, 15, 8, 9, 18, 11, 80, 65, 82, 84, 73, 84, 73, 79, 78, 69,
68, 10, 28, 10, 9, 8, 9, 18, 5, 113, 117, 101, 114, 121, 18, 15, 8, 9, 18,
11, 80, 65, 82, 84, 73, 84, 73, 79, 78, 69, 68, 10, 29, 10, 10, 8, 9, 18, 6,
97, 116, 111, 109, 105, 99, 18, 15, 8, 9, 18, 11, 80, 65, 82, 84, 73, 84, 73,
79, 78, 69, 68, 104, 128, 1, 114, 19, 8, 9, 18, 15, 49, 50, 55, 46, 48, 46,
48, 46, 49, 58, 52, 55, 53, 48, 48, 34, 0 };
GridClientMessageTopologyResult resp;
while (++iters != maxiterations) {
GridClientProtobufMarshaller::wrap(cmd, marshalledObject);
if (unmarshal) {
marshalledObject.set_binary(daReply, sizeof(daReply));
marshalledObject.set_type(RESPONSE);
GridClientProtobufMarshaller::unwrap(marshalledObject, resp);
}
}
}
break;
default:
std::cerr << "Unsupported message type.\n";
return;
}
}
}
catch (GridClientException& e) {
std::cerr << "GridClientException: " << e.what() << "\n";
exit(1);
}
catch (...) {
std::cerr << "Unknown exception.\n";
exit(1);
}
}