Commit 79d486a4 authored by Giorgio Azzinnaro's avatar Giorgio Azzinnaro

fixed ptr error

parent 1daa16fa
......@@ -2,7 +2,7 @@ import grpc
from profanedb.protobuf import db_pb2, db_pb2_grpc
import test_pb2
import test_pb2, nested_pb2
from google.protobuf import any_pb2
......@@ -15,12 +15,17 @@ def run():
field_two_str = "my_string",
field_three_bool = True,
field_four_bytes = b'bytes',
field_five_nested =
test_pb2.Nested(
nested_field_one_str = "nested string",
nested_field_two_int = 1902923490,
nested_field_three_double = 1728.543344
),
field_six_externalnested =
nested_pb2.ExternalNested(
field_one_double = 123.456
)
)
......
......@@ -33,10 +33,10 @@ std::map<std::string, const google::protobuf::Message &> profanedb::storage::Nor
{
// Any messages have a type url beginning with `type.googleapis.com/`, this is stripped
std::string type = serializable.type_url();
auto definition = std::unique_ptr<const google::protobuf::Descriptor>(schemaPool->FindMessageTypeByName(type.substr(type.rfind('/')+1, std::string::npos)));
const google::protobuf::Descriptor * definition = schemaPool->FindMessageTypeByName(type.substr(type.rfind('/')+1, std::string::npos));
// Having the definition our message factory can simply generate a container,
auto container = std::shared_ptr<google::protobuf::Message>(messageFactory.GetPrototype(definition.get())->New());
auto container = std::shared_ptr<google::protobuf::Message>(messageFactory.GetPrototype(definition)->New());
// and convert the bytes coming from Any into it
serializable.UnpackTo(container.get());
......
......@@ -33,10 +33,6 @@ class RootSourceTree : public google::protobuf::compiler::DiskSourceTree
{
public:
RootSourceTree(std::initializer_list<boost::filesystem::path> mappings);
// private:
// std::unique_ptr<google::protobuf::io::ZeroCopyInputStream> inputStream;
};
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment