void GridClientProtobufMarshaller::unwrap(const ObjectWrapper& objWrapper, GridClientMessageLogResult& logRslt) { ProtoResponse resp; GG_LOG_DEBUG("Unwrap: %s", objWrapper.DebugString().c_str()); unwrapResponse(objWrapper, resp); GG_LOG_DEBUG("Unwrap result: %s", resp.DebugString().c_str()); fillResponseHeader(resp, logRslt); std::vector<std::string> lines; if (resp.has_resultbean()) { assert(resp.resultbean().type() == COLLECTION); const std::string& binary = resp.resultbean().binary(); ::Collection coll; unmarshalMsg((int8_t*) binary.c_str(), binary.size(), coll); for (auto it = coll.item().begin(); it != coll.item().end(); ++it) { const ObjectWrapper& el = (*it); lines.push_back(el.binary()); } } logRslt.lines(lines); }
void GridClientProtobufMarshaller::unwrap(const ObjectWrapper& objWrapper, GridClientMessageAuthenticationResult& authRslt) { ProtoResponse resp; GG_LOG_DEBUG("Unwrap: %s", objWrapper.DebugString().c_str()); unwrapResponse(objWrapper, resp); GG_LOG_DEBUG("Unwrap result: %s", resp.DebugString().c_str()); fillResponseHeader(resp, authRslt); }
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; }