88
91
ParentType* _ref_cpp_parent;
94
/** @class TRefResolver
96
* Converts a Json pointer to a C++ pointer
98
* @tparam ParentType type of object that holds the pointer
100
template <class ParentType>
101
class TRefResolver : public Resolver {
103
/** SetMethod function pointer for setting the C++ pointer during
104
* dereference operation
106
typedef void (ParentType::*SetMethod)(TRef value);
110
* @param ref_json_address path to the json pointer-by-value (i.e. actual
111
* data in the json tree. This is stored in the "$ref" field of the json
112
* pointer-by-reference
113
* @param ref_cpp_set_func SetMethod that is used to set the C++ pointer
114
* @param ref_cpp_parent C++ object that will store the C++ pointer.
116
TRefResolver(std::string ref_json_address,
117
SetMethod ref_cpp_set_func,
118
ParentType* ref_cpp_parent);
120
/** Destructor does nothing */
123
/** Resolve this reference
125
* Lookup the json address on the RefManager; call SetMethod to allocate
126
* the resultant C++ pointer to the parent object.
128
* Note that as we store the addresses of C++ objects, deep copy of the C++
129
* data is not allowed during processing of the data tree until after we
130
* have called ResolveReferences (otherwise reference resolution will fail)
132
void ResolveReferences();
135
SetMethod _cpp_setter;
136
std::string _ref_json_address;
137
ParentType* _ref_cpp_parent;
91
140
/** @class VectorResolver
93
142
* Converts a Json pointer to a C++ pointer in an array (std::vector)
180
/** @class TRefArrayResolver
182
* Converts a Json pointer to a C++ pointer stored in a TRefArray
184
* @tparam ChildType type of object pointed to;
186
class TRefArrayResolver : public Resolver {
190
* @param ref_json_address Address of json object
191
* @param tref_array The TRefArray holding child data
192
* @param vector_index Location in the vector holding child data
194
TRefArrayResolver(std::string ref_json_address,
195
TRefArray* tref_array,
196
size_t vector_index);
198
/** Destructor - does nothing */
199
~TRefArrayResolver() {}
201
/** Resolve this reference
203
* Lookup the json address on the RefManager; call vector subscript
204
* operator to allocate the resultant C++ pointer to the parent object.
206
* Note that as we store the addresses of C++ objects, deep copy of the C++
207
* data is not allowed during processing of the data tree until after we
208
* have called ResolveReferences (otherwise reference resolution will fail)
210
void ResolveReferences();
213
std::string _ref_json_address;
214
TRefArray* _tref_array;
131
218
class RefManager {
133
220
/** Get the static instance of the RefManager