Preparing to make mtp be a command line using an input file.
[mtp.git] / mtp_example.cc
similarity index 91%
rename from mtp.cc
rename to mtp_example.cc
index 7f55e0a..13cd4f1 100644 (file)
--- a/mtp.cc
@@ -40,7 +40,9 @@ int main(int argc, char **argv) {
   int nb_time_steps = 8;
   int motion_amplitude = 1;
 
-  Tracker *tracker = new Tracker(nb_time_steps, nb_locations);
+  Tracker *tracker = new Tracker();
+
+  tracker->allocate(nb_time_steps, nb_locations);
 
   // We define the spatial structures by stating what are the possible
   // motions of targets, and what are the entrances and the
@@ -111,6 +113,19 @@ int main(int argc, char **argv) {
 
   // Does the tracking per se
 
+  {
+    ofstream out_tracker("/tmp/tracker.dat");
+    tracker->write(&out_tracker);
+
+    ifstream in_tracker("/tmp/tracker.dat");
+    Tracker tracker2;
+    tracker2.read(&in_tracker);
+    tracker2.build_graph();
+    tracker2.track();
+    ofstream out_traj("/tmp/result.trj");
+    tracker2.write_trajectories(&out_traj);
+  }
+
   tracker->track();
 
   // Prints the detected trajectories