Difference between revisions of "TypeSystems"

From Sirikata Wiki
Jump to navigation Jump to search
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
We want the type system to be serialization agnostic so we can support different backends.
+
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.
+
Our current implementation ideas revolve around starting from the serialization format specified in protocol buffers and building upon them.
This gives us the following types
+
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
  
 
{| border="1" cellpadding="0"
 
{| border="1" cellpadding="0"
Line 36: Line 39:
 
|-
 
|-
 
|bytes
 
|bytes
 +
|}
  
 
There are some additional types that would be nice to add:
 
There are some additional types that would be nice to add:
 +
 
{| border="1" cellpadding="0"
 
{| border="1" cellpadding="0"
!width="50"|Name||Basic Types Built From  
+
!width="50"|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
 
|-
 
|-
|Fixed Length Arrays || bytes
+
|SHA256 || Fixed Length Byte Array [32] || length must be equal to constraint (should this changed to a generic Hash type?)
 
|-
 
|-
|UUID || Fixed Length Array [16]
+
|URI || Variable Length Array of Strings || must follow URI guidelines in appropriate RFC
 
|-
 
|-
|URI || Variable Length Array of Strings
+
|Time || fixed64 || microseconds from 1 Jan 1970 UTC
 
|-
 
|-
|Time
+
|Duration || fixed64 || nanoseconds
 
|-
 
|-
|Duration
+
|flags (enum where each enumerant can be toggled) || fixed32 or fixed64 depending on the number of enumerants
 
|-
 
|-
|flags (enum where each enumerant can be toggled)
+
|Vector3f || message consisting of 3 reqiured floats ||
 
|-
 
|-
|Vector3f
+
|Normal3f || message consisting of 3 reqiured floats || sum of squares must be nearly 1
 
|-
 
|-
|Vector2f
+
|Vector2f || message consisting of 2 reqiured floats ||
 
|-
 
|-
|Vector3d
+
|Vector3d || message consisting of 3 reqiured doubles ||
 
|-
 
|-
|Vector2d
+
|Vector2d || message consisting of 2 reqiured floats ||
 
|-
 
|-
 
|Quaternion
 
|Quaternion

Latest revision as of 22:46, 14 April 2009

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)