~christopher-hunt08/maus/maus_integrated_kalman

« back to all changes in this revision

Viewing changes to src/map/MapCppPrint/MapCppPrint.cc

  • Committer: Durga Rajaram
  • Date: 2014-07-16 15:13:05 UTC
  • mfrom: (659.1.92 cand)
  • Revision ID: durga@fnal.gov-20140716151305-q27rv1y9p03v9lks
Tags: MAUS-v0.9, MAUS-v0.9.0
MAUS-v0.9.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#include "MapCppPrint.hh"
2
 
 
3
 
bool MapCppPrint::birth(std::string argJsonConfigDocument) {
4
 
  _classname = "MapCppPrint";
5
 
  return true;
6
 
}
7
 
 
8
 
bool MapCppPrint::death() {
9
 
  return true;
10
 
}
11
 
 
12
 
std::string  MapCppPrint::process(std::string document) {
13
 
  Json::Value root;   // will contains the root value after parsing.
14
 
  Json::Reader reader;
15
 
  bool parsingSuccessful = reader.parse(document, root);
16
 
  if (!parsingSuccessful) {
17
 
      Json::Value errors;
18
 
      std::stringstream ss;
19
 
 
20
 
      ss << _classname << " says:" << reader.getFormatedErrorMessages();
21
 
      errors["bad_json_document"] = ss.str();
22
 
      root["errors"] = errors;
23
 
 
24
 
      Json::FastWriter writer;
25
 
      return writer.write(root);
26
 
  }
27
 
  std::cout << "MapCppPrint output" << std::endl;
28
 
  std::cout << root;
29
 
 
30
 
  return document;
31
 
}