Thrift simulation for list <HashMap <String, Object >>
2 answers
Pretty simple:
struct MyObjectData {
// data of your objects
}
list< map< string, MyObjectData>>
You might want to make it a type:
typedef list< map< string, MyObjectData>> MyObjectStructure
MyObjectData. Object Object, . Thrift , , , ( class). , union, , :
struct Foo { /* some fields */ }
struct Bar { /* some fields */ }
// a union allows us to store different kinds of structs in one list
union Generic {
1: Foo foo
2: Bar bar
}
// technically, a union is more or less a struct with optional fields,
struct Alternative {
1: optional Foo foo
2: optional Bar bar
}
, , :
struct Base {
// some fields
}
struct Derived {
1: Base base_
// some more fields
}
. , , .
+6