TypeSystems

From Sirikata Wiki
Jump to: navigation, search

We want the type system to be serialization agnostic so we can support different backends (eg Thrift, Protocol Buffers, MXP, LLSD,...).

Our current implementation ideas revolve around starting from the serialization format specified in protocol buffers and building upon them. You can checkout our implementation at git://github.com/danielrh/pbj.git (github homepage at http://github.com/danielrh/pbj )


Starting with a protocol buffers implementation, we have the following types

Name
double
float
int32
int64
uint32
uint64
sint32
sint64
fixed32
fixed64
sfixed32
sfixed64
bool
string
bytes

There are some additional types that would be nice to add:

Name Basic Types Built From Restrictions
Fixed Length Byte Array bytes length must be equal to constraint
UUID Fixed Length Byte Array [16] length must be equal to constraint
SHA256 Fixed Length Byte Array [32] length must be equal to constraint (should this changed to a generic Hash type?)
URI Variable Length Array of Strings must follow URI guidelines in appropriate RFC
Time fixed64 microseconds from 1 Jan 1970 UTC
Duration fixed64 nanoseconds
flags (enum where each enumerant can be toggled) fixed32 or fixed64 depending on the number of enumerants
Vector3f message consisting of 3 reqiured floats
Normal3f message consisting of 3 reqiured floats sum of squares must be nearly 1
Vector2f message consisting of 2 reqiured floats
Vector3d message consisting of 3 reqiured doubles
Vector2d message consisting of 2 reqiured floats
Quaternion
Angle (0-2pi)
Bounding box/sphere (NULL defined)