Skip to content

Instantly share code, notes, and snippets.

@srenault
Last active August 29, 2015 14:16
Show Gist options
  • Save srenault/ab7e7c8a2ad240cc18c0 to your computer and use it in GitHub Desktop.
Save srenault/ab7e7c8a2ad240cc18c0 to your computer and use it in GitHub Desktop.
int main(int argc, char **argv) {
google::protobuf::Arena arena;
std::ifstream in("<path>");
m::cheminot::data::Graph* graphBuf = google::protobuf::Arena::CreateMessage<m::cheminot::data::Graph>(&arena);
graphBuf->ParseFromIstream(&in);
in.close();
}
syntax = "proto3";
option cc_enable_arenas = true;
package m.cheminot.data;
message Graph {
map<string, Vertice> vertices = 1;
}
message Vertice {
string id = 1;
string name = 2;
repeated string edges = 3;
repeated StopTime stopTimes = 4;
}
message StopTime {
string tripId = 1;
string arrival = 2;
string departure = 3;
string stopId = 4;
int32 pos = 5;
}
message CalendarDates {
map<string, CalendarExceptions> exceptionsByServiceId = 1;
}
message CalendarExceptions {
repeated CalendarDate calendarDates = 1;
}
message CalendarDate {
string serviceId = 1;
string date = 2;
int32 exceptionType = 3;
}
message Calendar {
string serviceId = 1;
string monday = 2;
string tuesday = 3;
string wednesday = 4;
string thursday = 5;
string friday = 6;
string saturday = 7;
string sunday = 8;
string startDate = 9;
string endDate = 10;
}
message TripStopIds {
repeated string stopIds = 1;
}
main(44728,0x7fff77496300) malloc: *** error for object 0x7ffb8ac04ed0: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
[1] 44728 abort ./main
@xfxyjwf
Copy link

xfxyjwf commented Mar 23, 2015

Have you figured out the problem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment