MCPcopy Create free account
hub / github.com/apache/mesos / devolve

Function devolve

src/internal/devolve.cpp:29–50  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27
28template <typename T>
29static T devolve(const google::protobuf::Message& message)
30{
31 T t;
32
33 string data;
34
35 // NOTE: We need to use 'SerializePartialToString' instead of
36 // 'SerializeToString' because some required fields might not be set
37 // and we don't want an exception to get thrown.
38 CHECK(message.SerializePartialToString(&data))
39 << "Failed to serialize " << message.GetTypeName()
40 << " while devolving to " << t.GetTypeName();
41
42 // NOTE: We need to use 'ParsePartialFromString' instead of
43 // 'ParseFromString' because some required fields might not
44 // be set and we don't want an exception to get thrown.
45 CHECK(t.ParsePartialFromString(data))
46 << "Failed to parse " << t.GetTypeName()
47 << " while devolving from " << message.GetTypeName();
48
49 return t;
50}
51
52
53CommandInfo devolve(const v1::CommandInfo& command)

Callers

nothing calls this directly

Calls 3

typeMethod · 0.80
valueMethod · 0.45
subscribeMethod · 0.45

Tested by

no test coverage detected