#include <objlib.h>
Convert class contents to JSON object.
Returns a json11 JSON object of the class
- Returns
- A json11 JSON object containing every member variable within the class
212 {
"materialidx" ,
static_cast<double>(
materialidx) },
213 {
"pointidx" , d_pointidx },
214 {
"lineidx" , d_lineidx },
215 {
"faceidx" , d_faceidx },
std::map< std::string, Json > object
Definition: json11.hpp:88
string name
Definition: objlib.h:194
size_t materialidx
Definition: objlib.h:195
vector< size_t > pointidx
Definition: objlib.h:196
vector< size_t > lineidx
Definition: objlib.h:197
Vector com
Definition: objlib.h:199
vector< size_t > faceidx
Definition: objlib.h:198
double volume
Definition: objlib.h:200
void Cosmos::wavefront::group::from_json |
( |
const string & |
s | ) |
|
|
inline |
Set class contents from JSON string.
Parses the provided JSON-formatted string and sets the class data. String should be formatted like the string returned from to_json()
- Parameters
-
s | JSON-formatted string to set class contents to |
- Returns
- n/a
231 if(!p[
"name"].is_null())
name = p[
"name"].string_value();
232 if(!p[
"materialidx"].is_null())
materialidx = static_cast<size_t>(p[
"materialidx"].number_value());
234 if(!p[
"pointidx"][
i].is_null())
235 pointidx[
i] = static_cast<size_t>(p[
"pointidx"][
i].number_value());
238 if(!p[
"lineidx"][
i].is_null())
239 lineidx[
i] = static_cast<size_t>(p[
"lineidx"][
i].number_value());
242 if(!p[
"faceidx"][
i].is_null())
243 faceidx[
i] = static_cast<size_t>(p[
"faceidx"][
i].number_value());
246 if(!p[
"volume"].is_null())
volume = p[
"volume"].number_value();
248 cerr<<
"ERROR: <"<<error<<
">"<<endl;
Definition: json11.hpp:79
int i
Definition: rw_test.cpp:37
string name
Definition: objlib.h:194
size_t materialidx
Definition: objlib.h:195
static double * p
Definition: gauss_jackson_test.cpp:42
void dump(std::string &out) const
void from_json(const string &s)
Set class contents from JSON string.
Definition: vector.h:783
static Json parse(const std::string &in, std::string &err, JsonParse strategy=JsonParse::STANDARD)
vector< size_t > pointidx
Definition: objlib.h:196
vector< size_t > lineidx
Definition: objlib.h:197
Vector com
Definition: objlib.h:199
vector< size_t > faceidx
Definition: objlib.h:198
double volume
Definition: objlib.h:200
string Cosmos::wavefront::group::name = "" |
size_t Cosmos::wavefront::group::materialidx = 0 |
vector<size_t> Cosmos::wavefront::group::pointidx |
vector<size_t> Cosmos::wavefront::group::lineidx |
vector<size_t> Cosmos::wavefront::group::faceidx |
Vector Cosmos::wavefront::group::com |
double Cosmos::wavefront::group::volume = 0 |
The documentation for this struct was generated from the following file: