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

Function construct

src/python/native_common/common.hpp:150–166  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

148// Declaration of 'construct<T>()' for protobufs.
149template <typename T>
150typename std::enable_if<
151 std::is_base_of<google::protobuf::Message, T>::value,
152 std::unique_ptr<T>>::type
153construct(PyObject* obj)
154{
155 std::unique_ptr<T> result(new T());
156 if (!readPythonProtobuf(obj, result.get())) {
157 PyErr_Format(
158 PyExc_TypeError,
159 "Failed to construct %s from a Python object",
160 result->GetDescriptor()->full_name().c_str());
161
162 return nullptr;
163 }
164
165 return result;
166}
167
168
169// Declaration of 'construct<T>()' for non-protobufs.

Callers

nothing calls this directly

Calls 2

readPythonProtobufFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected