> On Sept. 24, 2015, 3:52 p.m., Jan Schlicht wrote: > > 3rdparty/libprocess/3rdparty/stout/include/stout/protobuf.hpp, line 609 > > <https://reviews.apache.org/r/38342/diff/3/?file=1084033#file1084033line609> > > > > s/protobuf(const T& message)/protobuf(const google::protobuf::Message& > > message) > > > > The templatization in 608 isn't necessary here, as the static_assert in > > 611 has the same effect as just using a google::protobuf::Message as > > function parameter. Please change the function signature and remove line > > 608 & 611,612. > > > > Also, it'd make sense to return a `Try<Object>` as parsing `message` > > may fail. The current behavior is to call ABORT, one could as well return > > `None` here.
Used template here because there's a link error if we used `protobuf(const google::protobuf::Message& message)`; the way to resovle is to move implementation into cpp file, but stout is a library only including headers. `static_assert` will generate error when compiling, it will check error before running; so we can use `Object` directly :). > On Sept. 24, 2015, 3:52 p.m., Jan Schlicht wrote: > > 3rdparty/libprocess/3rdparty/stout/include/stout/protobuf.hpp, line 774 > > <https://reviews.apache.org/r/38342/diff/3/?file=1084033#file1084033line774> > > > > Same as before: It'd make sense to return a `Try<Array>` here. Same answer to `Object` :). > On Sept. 24, 2015, 3:52 p.m., Jan Schlicht wrote: > > 3rdparty/libprocess/3rdparty/stout/include/stout/protobuf.hpp, line 615 > > <https://reviews.apache.org/r/38342/diff/3/?file=1084033#file1084033line615> > > > > This comment describes a behavior of the function and should be moved > > to 608 (= above the function signature). I'll address it :). - Klaus ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/38342/#review100413 ----------------------------------------------------------- On Sept. 24, 2015, 3 p.m., Klaus Ma wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/38342/ > ----------------------------------------------------------- > > (Updated Sept. 24, 2015, 3 p.m.) > > > Review request for mesos, Alexander Rukletsov, Michael Park, and Jan Schlicht. > > > Bugs: MESOS-3405 > https://issues.apache.org/jira/browse/MESOS-3405 > > > Repository: mesos > > > Description > ------- > > Currently, `stout/protobuf.hpp` provides a `JSON::Protobuf` utility which > converts a `google::protobuf::Message` into a `JSON::Object`. > We should add the support for `google::protobuf::RepeatedPtrField<T>` by > introducing overloaded functions. > > > Diffs > ----- > > 3rdparty/libprocess/3rdparty/stout/include/stout/protobuf.hpp 2285ce9 > 3rdparty/libprocess/3rdparty/stout/tests/protobuf_tests.cpp 68328a2 > 3rdparty/libprocess/3rdparty/stout/tests/protobuf_tests.pb.h 8ebb798 > 3rdparty/libprocess/3rdparty/stout/tests/protobuf_tests.pb.cc 34eb6d0 > 3rdparty/libprocess/3rdparty/stout/tests/protobuf_tests.proto 920f5c9 > > Diff: https://reviews.apache.org/r/38342/diff/ > > > Testing > ------- > > cd 3rdparty/libprocess/3rdparty/stout > ./boostrap > ./configure > make > > > Thanks, > > Klaus Ma > >