25 metaInfo_ = std::make_shared<MetainfoMapImpl>(*other.metaInfo_);
30 std::swap(type_, other.type_);
31 dims_.swap(other.dims_);
32 metaInfo_->swap(*other.metaInfo_);
36 if(type_ != right.type_)
39 if(dims_.size() != right.dims_.size() ||
40 !std::equal(dims_.begin(), dims_.end(), right.dims_.begin()))
43 return (*metaInfo_ == *right.metaInfo_);
48 jsonNode[
"type_id"] =
static_cast<int>(type_);
49 jsonNode[
"dims"] = dims_;
50 jsonNode[
"meta_info"] = metaInfo_->toJSON();
58 if(jsonNode.is_null() || jsonNode.empty())
61 if(!jsonNode.count(
"type_id"))
63 type_ =
static_cast<TypeID>(int(jsonNode[
"type_id"]));
65 if(!jsonNode.count(
"dims"))
67 for(
auto it = jsonNode[
"dims"].begin(), end = jsonNode[
"dims"].end(); it != end; ++it)
68 dims_.push_back(
int(*it));
70 if(!jsonNode.count(
"meta_info"))
73 metaInfo_->fromJSON(jsonNode[
"meta_info"]);
75 throw Exception(
"in node 'meta_info': %s", e.what());
83 <<
"metainfo = " << *metaInfo_;
static std::string toString(const Array< T > &array)
Convert to string.
Namespace of the serialbox library.
TypeID
Type-id of types recognized by serialbox.
static std::string toString(TypeID id)
Convert to string.
Exception class which stores a human-readable error description.