Add support for triming vectors in json

Sometimes (we have images we want to print) we don't want to print out
all the data from long arrays in JSON.  That can be too slow.

Add an option which lets us limit the number of elements to print before
printing out a "... xxx elements ..." message instead.

Change-Id: I95ad6ea3e9e2fe1767005be8f53c8ba8d4371ace
diff --git a/aos/aos_dump.cc b/aos/aos_dump.cc
index 2ecfe5e..fd33eca 100644
--- a/aos/aos_dump.cc
+++ b/aos/aos_dump.cc
@@ -8,6 +8,8 @@
 #include "gflags/gflags.h"
 
 DEFINE_string(config, "./config.json", "File path of aos configuration");
+DEFINE_int32(max_vector_size, 100,
+             "If positive, vectors longer than this will not be printed");
 
 int main(int argc, char **argv) {
   aos::InitGoogle(&argc, &argv);
@@ -57,14 +59,16 @@
                         << context.monotonic_event_time << "): "
                         << aos::FlatbufferToJson(
                                channel->schema(),
-                               static_cast<const uint8_t *>(message))
+                               static_cast<const uint8_t *>(message),
+                               FLAGS_max_vector_size)
                         << '\n';
             } else {
               std::cout << context.realtime_event_time << " ("
                         << context.monotonic_event_time << "): "
                         << aos::FlatbufferToJson(
                                channel->schema(),
-                               static_cast<const uint8_t *>(message))
+                               static_cast<const uint8_t *>(message),
+                               FLAGS_max_vector_size)
                         << '\n';
             }
           });