~mbogomilov/maus/devel3

« back to all changes in this revision

Viewing changes to src/common_cpp/JsonCppProcessors/PrimitivesProcessors.hh

  • Committer: Durga Rajaram
  • Date: 2014-01-14 07:07:02 UTC
  • mfrom: (659.1.80 relcand)
  • Revision ID: durga@fnal.gov-20140114070702-2l1fuj1w6rraw7xe
Tags: MAUS-v0.7.6
MAUS-v0.7.6

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
 
26
26
namespace MAUS {
27
27
 
 
28
typedef unsigned long long uint64;
 
29
 
28
30
/** Processor to convert between C++ double and Json::numericValue
29
31
 */
30
32
class DoubleProcessor : public ProcessorBase<double> {
31
33
  public:
32
34
    /** Convert from Json::numericValue to double
33
35
     *
34
 
     *  If json_double cannot be converted to a double, throw a Squeal
 
36
     *  If json_double cannot be converted to a double, throw a Exception
35
37
     */
36
38
    virtual double* JsonToCpp(const Json::Value& json_double);
37
39
 
50
52
  public:
51
53
    /** Convert from Json::numericValue to double
52
54
     *
53
 
     *  If json_string cannot be converted to a double, throw a Squeal
 
55
     *  If json_string cannot be converted to a double, throw a Exception
54
56
     */
55
57
    virtual std::string* JsonToCpp(const Json::Value& json_string);
56
58
 
71
73
  public:
72
74
    /** Convert from Json::intValue to int
73
75
     *
74
 
     *  If json_string cannot be converted to a int, throw a Squeal
 
76
     *  If json_string cannot be converted to a int, throw a Exception
75
77
     */
76
78
    virtual int* JsonToCpp(const Json::Value& json_int);
77
79
 
104
106
                             (const unsigned int& cpp_double, std::string path);
105
107
};
106
108
 
 
109
/** Processor to convert between C++ long long int and Json::stringValue
 
110
 */
 
111
class LLUIntProcessor : public ProcessorBase<uint64> {
 
112
  public:
 
113
    /** Convert from Json::stringValue to long long unsigned int
 
114
     *
 
115
     *  If we have a Json::Value that
 
116
     *    - has a minus sign as first character
 
117
     *    - does not parse to an uint64
 
118
     *    - is not a string type at all
 
119
     *  throw an exception
 
120
     */
 
121
    virtual uint64* JsonToCpp(const Json::Value& json_str);
 
122
 
 
123
    /** Convert from unsigned int to Json::stringValue
 
124
     */
 
125
    virtual Json::Value* CppToJson(const uint64& cpp_double);
 
126
 
 
127
    /** Convert from unsigned int to Json::stringValue
 
128
     */
 
129
    virtual Json::Value* CppToJson(const uint64& cpp_double,
 
130
                                   std::string path);
 
131
};
 
132
 
107
133
/** Processor to convert between C++ nool and Json::boolValue
108
134
 */
109
135
class BoolProcessor : public ProcessorBase<bool> {
110
136
  public:
111
137
    /** Convert from Json::boolValue to bool
112
138
     *
113
 
     *  If json_bool cannot be converted to a bool, throw a Squeal
 
139
     *  If json_bool cannot be converted to a bool, throw a Exception
114
140
     */
115
141
    virtual bool* JsonToCpp(const Json::Value& json_bool);
116
142