本文整理汇总了C++中SlaveInfo::SerializeToString方法的典型用法代码示例。如果您正苦于以下问题:C++ SlaveInfo::SerializeToString方法的具体用法?C++ SlaveInfo::SerializeToString怎么用?C++ SlaveInfo::SerializeToString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SlaveInfo
的用法示例。
在下文中一共展示了SlaveInfo::SerializeToString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: registered
void registered (ExecutorDriver* driver,
const ExecutorInfo& executorInfo,
const FrameworkInfo& frameworkInfo,
const SlaveInfo& slaveInfo) override {
_executorId = executorInfo.executor_id().value();
cout
<< "Registered executor " << _executorId << " on "
<< slaveInfo.hostname()
<< endl;
string data;
slaveInfo.SerializeToString(&data);
driver->sendFrameworkMessage(data);
}
示例2: convert
jobject convert(JNIEnv* env, const SlaveInfo& slaveInfo)
{
string data;
slaveInfo.SerializeToString(&data);
// byte[] data = ..;
jbyteArray jdata = env->NewByteArray(data.size());
env->SetByteArrayRegion(jdata, 0, data.size(), (jbyte*) data.data());
// SlaveInfo slaveInfo = SlaveInfo.parseFrom(data);
jclass clazz = FindMesosClass(env, "org/apache/mesos/Protos$SlaveInfo");
jmethodID parseFrom =
env->GetStaticMethodID(clazz, "parseFrom",
"([B)Lorg/apache/mesos/Protos$SlaveInfo;");
jobject jslaveInfo = env->CallStaticObjectMethod(clazz, parseFrom, jdata);
return jslaveInfo;
}