MCPcopy Create free account
hub / github.com/OpenPTrack/open_ptrack_v2 / ReadProtoFromBinaryFile

Function ReadProtoFromBinaryFile

rtpose_wrapper/src/caffe/util/io.cpp:52–65  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

50}
51
52bool ReadProtoFromBinaryFile(const char* filename, Message* proto) {
53 int fd = open(filename, O_RDONLY);
54 CHECK_NE(fd, -1) << "File not found: " << filename;
55 ZeroCopyInputStream* raw_input = new FileInputStream(fd);
56 CodedInputStream* coded_input = new CodedInputStream(raw_input);
57 coded_input->SetTotalBytesLimit(kProtoReadBytesLimit, 536870912);
58
59 bool success = proto->ParseFromCodedStream(coded_input);
60
61 delete coded_input;
62 delete raw_input;
63 close(fd);
64 return success;
65}
66
67void WriteProtoToBinaryFile(const Message& proto, const char* filename) {
68 fstream output(filename, ios::out | ios::trunc | ios::binary);

Callers 5

mainFunction · 0.50
LayerSetUpMethod · 0.50
read_meanFunction · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected