Fixed up setup process, cleaned up repo, and updated README

This commit is contained in:
Jason Paryani
2013-07-06 23:41:19 -07:00
parent b2aa5e8019
commit 0ed0bcf361
15 changed files with 68693 additions and 348 deletions

2
capnp/__init__.py Normal file
View File

@@ -0,0 +1,2 @@
from .version import version as __version__
from .capnp import *

19725
capnp/capnp.cpp Normal file

File diff suppressed because it is too large Load Diff

580
capnp/capnp.pyx Normal file
View File

@@ -0,0 +1,580 @@
# capnp.pyx
# distutils: language = c++
# distutils: extra_compile_args = --std=c++11
# distutils: libraries = capnp
cimport cython
cimport capnp_cpp as capnp
cimport schema_cpp
from capnp_cpp cimport SchemaLoader as C_SchemaLoader, Schema as C_Schema, StructSchema as C_StructSchema, DynamicStruct as C_DynamicStruct, DynamicValue as C_DynamicValue, Type as C_Type, DynamicList as C_DynamicList, DynamicUnion as C_DynamicUnion, fixMaybe, VOID
from schema_cpp cimport CodeGeneratorRequest as C_CodeGeneratorRequest, Node as C_Node, EnumNode as C_EnumNode
from cython.operator cimport dereference as deref
from schema cimport _NodeReader
from libc.stdint cimport *
ctypedef unsigned int uint
ctypedef uint8_t UInt8
ctypedef uint16_t UInt16
ctypedef uint32_t UInt32
ctypedef uint64_t UInt64
ctypedef int8_t Int8
ctypedef int16_t Int16
ctypedef int32_t Int32
ctypedef int64_t Int64
ctypedef char * Object
ctypedef bint Bool
ctypedef float Float32
ctypedef double Float64
ctypedef fused valid_values:
int
long
float
double
bint
cython.p_char
def _make_enum(enum_name, *sequential, **named):
enums = dict(zip(sequential, range(len(sequential))), **named)
reverse = dict((value, key) for key, value in enums.iteritems())
enums['reverse_mapping'] = reverse
return type(enum_name, (), enums)
_Type = _make_enum('DynamicValue.Type',
UNKNOWN = capnp.TYPE_UNKNOWN,
VOID = capnp.TYPE_VOID,
BOOL = capnp.TYPE_BOOL,
INT = capnp.TYPE_INT,
UINT = capnp.TYPE_UINT,
FLOAT = capnp.TYPE_FLOAT,
TEXT = capnp.TYPE_TEXT,
DATA = capnp.TYPE_DATA,
LIST = capnp.TYPE_LIST,
ENUM = capnp.TYPE_ENUM,
STRUCT = capnp.TYPE_STRUCT,
UNION = capnp.TYPE_UNION,
INTERFACE = capnp.TYPE_INTERFACE,
OBJECT = capnp.TYPE_OBJECT)
cdef extern from "capnp/list.h" namespace " ::capnp":
cdef cppclass List[T]:
cppclass Reader:
T operator[](uint) except +ValueError
uint size()
cppclass Builder:
T operator[](uint) except +ValueError
uint size()
cdef class _DynamicListReader:
cdef C_DynamicList.Reader thisptr
cdef _init(self, C_DynamicList.Reader other):
self.thisptr = other
return self
cpdef _get(self, index):
size = self.thisptr.size()
if index >= size:
raise IndexError('Out of bounds')
index = index % size
return _DynamicValueReader()._init(self.thisptr[index])
def __getitem__(self, index):
return self._get(index).toPython()
def __len__(self):
return self.thisptr.size()
cdef class _DynamicListBuilder:
cdef C_DynamicList.Builder thisptr
cdef _init(self, C_DynamicList.Builder other):
self.thisptr = other
return self
#def _init(self, size):
# self.thisptr._init(size)
# return self
def __getitem__(self, index):
size = self.thisptr.size()
if index >= size:
raise IndexError('Out of bounds')
index = index % size
temp = self.thisptr[index]
return toPython(temp)
def _setitem(self, index, valid_values value):
cdef C_DynamicValue.Reader temp = C_DynamicValue.Reader(value)
self.thisptr.set(index, temp)
def __setitem__(self, index, value):
size = self.thisptr.size()
if index >= size:
raise IndexError('Out of bounds')
index = index % size
self._setitem(index, value)
def __len__(self):
return self.thisptr.size()
cdef class _List_UInt64_Reader:
cdef List[UInt64].Reader thisptr
cdef _init(self, List[UInt64].Reader other):
self.thisptr = other
return self
def __getitem__(self, index):
size = self.thisptr.size()
if index >= size:
raise IndexError('Out of bounds')
index = index % size
return self.thisptr[index]
def __len__(self):
return self.thisptr.size()
cdef class _List_Node_Reader:
cdef List[C_Node].Reader thisptr
cdef _init(self, List[C_Node].Reader other):
self.thisptr = other
return self
def __getitem__(self, index):
size = self.thisptr.size()
if index >= size:
raise IndexError('Out of bounds')
index = index % size
return _NodeReader().init(<C_Node.Reader>self.thisptr[index])
def __len__(self):
return self.thisptr.size()
cdef class _DynamicValueReader:
cdef C_DynamicValue.Reader thisptr
cdef _init(self, C_DynamicValue.Reader other):
self.thisptr = other
return self
cpdef int getType(self):
return self.thisptr.getType()
cpdef toPython(self):
cdef int type = self.getType()
if type == capnp.TYPE_BOOL:
return self.thisptr.asBool()
elif type == capnp.TYPE_INT:
return self.thisptr.asInt()
elif type == capnp.TYPE_UINT:
return self.thisptr.asUint()
elif type == capnp.TYPE_FLOAT:
return self.thisptr.asDouble()
elif type == capnp.TYPE_TEXT:
return self.thisptr.asText()[:]
elif type == capnp.TYPE_DATA:
temp = self.thisptr.asData()
return (<char*>temp.begin())[:temp.size()]
elif type == capnp.TYPE_LIST:
return list(_DynamicListReader()._init(self.thisptr.asList()))
elif type == capnp.TYPE_STRUCT:
return _DynamicStructReader()._init(self.thisptr.asStruct())
elif type == capnp.TYPE_UNION:
return _DynamicUnionReader()._init(self.thisptr.asUnion())
elif type == capnp.TYPE_ENUM:
return fixMaybe(self.thisptr.asEnum().getEnumerant()).getProto().getName().cStr()
elif type == capnp.TYPE_VOID:
return None
elif type == capnp.TYPE_UNKOWN:
raise ValueError("Cannot convert type to Python. Type is unknown by capnproto library")
else:
raise ValueError("Cannot convert type to Python. Type is unhandled by capnproto library")
cdef int getType(C_DynamicValue.Builder & self):
return self.getType()
cdef toPython(C_DynamicValue.Builder & self):
cdef int type = getType(self)
if type == capnp.TYPE_BOOL:
return self.asBool()
elif type == capnp.TYPE_INT:
return self.asInt()
elif type == capnp.TYPE_UINT:
return self.asUint()
elif type == capnp.TYPE_FLOAT:
return self.asDouble()
elif type == capnp.TYPE_TEXT:
return self.asText()[:]
elif type == capnp.TYPE_DATA:
temp = self.asData()
return (<char*>temp.begin())[:temp.size()]
elif type == capnp.TYPE_LIST:
return list(_DynamicListBuilder()._init(self.asList()))
elif type == capnp.TYPE_STRUCT:
return _DynamicStructBuilder()._init(self.asStruct())
elif type == capnp.TYPE_UNION:
return _DynamicUnionBuilder()._init(self.asUnion())
elif type == capnp.TYPE_ENUM:
return fixMaybe(self.asEnum().getEnumerant()).getProto().getName().cStr()
elif type == capnp.TYPE_VOID:
return None
elif type == capnp.TYPE_UNKOWN:
raise ValueError("Cannot convert type to Python. Type is unknown by capnproto library")
else:
raise ValueError("Cannot convert type to Python. Type is unhandled by capnproto library")
cdef toPythonByValue(C_DynamicValue.Builder self):
cdef int type = self.getType()
if type == capnp.TYPE_BOOL:
return self.asBool()
elif type == capnp.TYPE_INT:
return self.asInt()
elif type == capnp.TYPE_UINT:
return self.asUint()
elif type == capnp.TYPE_FLOAT:
return self.asDouble()
elif type == capnp.TYPE_TEXT:
return self.asText()[:]
elif type == capnp.TYPE_DATA:
temp = self.asData()
return (<char*>temp.begin())[:temp.size()]
elif type == capnp.TYPE_LIST:
return list(_DynamicListBuilder()._init(self.asList()))
elif type == capnp.TYPE_STRUCT:
return _DynamicStructBuilder()._init(self.asStruct())
elif type == capnp.TYPE_UNION:
return _DynamicUnionBuilder()._init(self.asUnion())
elif type == capnp.TYPE_ENUM:
return fixMaybe(self.asEnum().getEnumerant()).getProto().getName().cStr()
elif type == capnp.TYPE_VOID:
return None
elif type == capnp.TYPE_UNKOWN:
raise ValueError("Cannot convert type to Python. Type is unknown by capnproto library")
else:
raise ValueError("Cannot convert type to Python. Type is unhandled by capnproto library")
cdef class _DynamicStructReader:
cdef C_DynamicStruct.Reader thisptr
cdef _init(self, C_DynamicStruct.Reader other):
self.thisptr = other
return self
cpdef _get(self, field):
return _DynamicValueReader()._init(self.thisptr.get(field))
def __getattr__(self, field):
return self._get(field).toPython()
def _has(self, field):
return self.thisptr.has(field)
cdef class _DynamicStructBuilder:
cdef C_DynamicStruct.Builder thisptr
cdef _init(self, C_DynamicStruct.Builder other):
self.thisptr = other
return self
def __getattr__(self, field):
if field.startswith('init'):
field_name = field[4].lower() + field[5:]
try:
self._has(field_name) # We don't need to test bool value here, since it will throw an exception if the field is non-existant
return lambda size: self.init(field_name, size)
except ValueError: pass
return toPython(self.thisptr.get(field))
cdef _setattrInt(self, field, value):
cdef C_DynamicValue.Reader temp = C_DynamicValue.Reader(<long long>value)
self.thisptr.set(field, temp)
cdef _setattrDouble(self, field, value):
cdef C_DynamicValue.Reader temp = C_DynamicValue.Reader(<double>value)
self.thisptr.set(field, temp)
cdef _setattrBool(self, field, value):
cdef C_DynamicValue.Reader temp = C_DynamicValue.Reader(<bint>value)
self.thisptr.set(field, temp)
cdef _setattrString(self, field, value):
cdef C_DynamicValue.Reader temp = C_DynamicValue.Reader(<char*>value)
self.thisptr.set(field, temp)
cdef _setattrVoid(self, field):
cdef C_DynamicValue.Reader temp = C_DynamicValue.Reader(VOID)
self.thisptr.set(field, temp)
def __setattr__(self, field, value):
value_type = type(value)
if value_type is int:
self._setattrInt(field, value)
elif value_type is float:
self._setattrDouble(field, value)
elif value_type is bool:
self._setattrBool(field, value)
elif value_type is bytes:
self._setattrString(field, value)
elif value is None:
self._setattrVoid(field)
else:
raise ValueError("Non primitive type")
def _has(self, field):
return self.thisptr.has(field)
cpdef init(self, field, size=None) except +ValueError:
if size is None:
return toPythonByValue(self.thisptr.init(field))
else:
return toPythonByValue(self.thisptr.init(field, size))
cdef class _DynamicUnionReader:
cdef C_DynamicUnion.Reader thisptr
cdef _init(self, C_DynamicUnion.Reader other):
self.thisptr = other
return self
cpdef _get(self):
return _DynamicValueReader()._init(self.thisptr.get())
def __getattr__(self, field):
return self._get().toPython() # TODO: check that the field is right?
cpdef which(self):
return fixMaybe(self.thisptr.which()).getProto().getName().cStr()
cdef class _DynamicUnionBuilder:
cdef C_DynamicUnion.Builder thisptr
cdef _init(self, C_DynamicUnion.Builder other):
self.thisptr = other
return self
def __getattr__(self, field):
return toPython(self.thisptr.get()) # TODO: check that the field is right?
cdef _setattrInt(self, field, value):
cdef C_DynamicValue.Reader temp = C_DynamicValue.Reader(<long long>value)
self.thisptr.set(field, temp)
cdef _setattrDouble(self, field, value):
cdef C_DynamicValue.Reader temp = C_DynamicValue.Reader(<double>value)
self.thisptr.set(field, temp)
cdef _setattrBool(self, field, value):
cdef C_DynamicValue.Reader temp = C_DynamicValue.Reader(<bint>value)
self.thisptr.set(field, temp)
cdef _setattrString(self, field, value):
cdef C_DynamicValue.Reader temp = C_DynamicValue.Reader(<char*>value)
self.thisptr.set(field, temp)
cdef _setattrVoid(self, field):
cdef C_DynamicValue.Reader temp = C_DynamicValue.Reader(VOID)
self.thisptr.set(field, temp)
def __setattr__(self, field, value):
value_type = type(value)
if value_type is int:
self._setattrInt(field, value)
elif value_type is float:
self._setattrDouble(field, value)
elif value_type is bool:
self._setattrBool(field, value)
elif value_type is bytes:
self._setattrString(field, value)
elif value is None:
self._setattrVoid(field)
else:
raise ValueError("Non primitive type")
cpdef which(self):
return fixMaybe(self.thisptr.which()).getProto().getName().cStr()
cpdef init(self, field, size=None) except +ValueError:
if size is None:
return toPythonByValue(self.thisptr.init(field))
else:
return toPythonByValue(self.thisptr.init(field, size))
cdef class _CodeGeneratorRequestReader:
cdef C_CodeGeneratorRequest.Reader thisptr
cdef _init(self, C_CodeGeneratorRequest.Reader other):
self.thisptr = other
return self
property nodes:
def __get__(self):
return _List_Node_Reader()._init(self.thisptr.getNodes())
property requestedFiles:
def __get__(self):
return _List_UInt64_Reader()._init(self.thisptr.getRequestedFiles())
cdef class Schema:
cdef C_Schema thisptr
cdef _init(self, C_Schema other):
self.thisptr = other
return self
cpdef asStruct(self):
return StructSchema()._init(self.thisptr.asStruct())
cpdef getDependency(self, id):
return Schema()._init(self.thisptr.getDependency(id))
cpdef getProto(self):
return _NodeReader().init(self.thisptr.getProto())
cdef class StructSchema:
cdef C_StructSchema thisptr
cdef _init(self, C_StructSchema other):
self.thisptr = other
return self
cdef class SchemaLoader:
cdef C_SchemaLoader * thisptr
def __cinit__(self):
self.thisptr = new C_SchemaLoader()
def __dealloc__(self):
del self.thisptr
cpdef load(self, _NodeReader node):
return Schema()._init(self.thisptr.load(node.thisptr))
cpdef get(self, id):
return Schema()._init(self.thisptr.get(id))
cdef class MessageBuilder:
cdef schema_cpp.MessageBuilder * thisptr
def __dealloc__(self):
del self.thisptr
cpdef initRoot(self, schema):
cdef StructSchema s
if hasattr(schema, 'Schema'):
s = schema.Schema
else:
s = schema
return _DynamicStructBuilder()._init(self.thisptr.initRootDynamicStruct(s.thisptr))
cpdef getRoot(self, schema):
cdef StructSchema s
if hasattr(schema, 'Schema'):
s = schema.Schema
else:
s = schema
return _DynamicStructBuilder()._init(self.thisptr.getRootDynamicStruct(s.thisptr))
cdef class MallocMessageBuilder(MessageBuilder):
def __cinit__(self):
self.thisptr = new schema_cpp.MallocMessageBuilder()
cdef class MessageReader:
cdef schema_cpp.MessageReader * thisptr
def __dealloc__(self):
del self.thisptr
cpdef getRootNode(self):
return _NodeReader().init(self.thisptr.getRootNode())
cpdef getRootCodeGeneratorRequest(self):
return _CodeGeneratorRequestReader()._init(self.thisptr.getRootCodeGeneratorRequest())
cpdef getRootDynamicStruct(self, StructSchema schema):
return _DynamicStructReader()._init(self.thisptr.getRootDynamicStruct(schema.thisptr))
cpdef getRoot(self, schema):
cdef StructSchema s
if hasattr(schema, 'Schema'):
s = schema.Schema
else:
s = schema
return _DynamicStructReader()._init(self.thisptr.getRootDynamicStruct(s.thisptr))
cdef class StreamFdMessageReader(MessageReader):
def __cinit__(self, int fd):
self.thisptr = new schema_cpp.StreamFdMessageReader(fd)
cdef class PackedFdMessageReader(MessageReader):
def __cinit__(self, int fd):
self.thisptr = new schema_cpp.PackedFdMessageReader(fd)
def writeMessageToFd(int fd, MessageBuilder m):
schema_cpp.writeMessageToFd(fd, deref(m.thisptr))
def writePackedMessageToFd(int fd, MessageBuilder m):
schema_cpp.writePackedMessageToFd(fd, deref(m.thisptr))
def capitalize(s):
if len(s) < 2:
return s
return s[0].upper() + s[1:]
def upper_and_under(s):
if len(s) < 2:
return s
ret = [s[0]]
for letter in s[1:]:
if letter.isupper():
ret.append('_')
ret.append(letter)
return ''.join(ret).upper()
from types import ModuleType
import re
import schema
import subprocess
def _load(module, node, loader, name, isUnion = False):
if name is None or len(name) == 0:
return
if name[0] == ':':
name = name[1:]
local_module = module
for sub_name in re.split('[:.]', name):
new_m = local_module.__dict__.get(sub_name, ModuleType(sub_name))
new_m._parent_module = local_module
local_module.__dict__[sub_name] = new_m
local_module = new_m
local_module._root_module = module
for nestedNode in node.nestedNodes:
s = loader.get(nestedNode.id)
_load(module, s.getProto(), loader, name + ':' + nestedNode.name)
body = node.body
which = body.which()
if which == schema.Node.Body.Which.enumNode:
enum = body.enumNode
local_module._parent_module.__dict__[sub_name] = _make_enum(name, **{upper_and_under(e.name) : e.name for e in enum.enumerants})
elif which == schema.Node.Body.Which.structNode:
struct = body.structNode
for member in struct.members:
if member.body.which() == schema.StructNode.Member.Body.Which.unionMember:
sub_name = capitalize(member.name)
new_m = local_module.__dict__.get(sub_name, ModuleType(sub_name))
local_module.__dict__[sub_name] = new_m
new_m.Which = _make_enum(sub_name+':Which', **{upper_and_under(e.name) : e.name for e in member.body.unionMember.members})
return local_module
def load(file_name, cat_path='/bin/cat'):
p = subprocess.Popen(['capnpc', '-o'+cat_path, file_name], stdout=subprocess.PIPE)
retcode = p.wait()
if retcode != 0:
raise RuntimeError("capnpc failed for some reason")
reader = schema.StreamFdMessageReader(p.stdout.fileno())
request = reader.getRootCodeGeneratorRequest()
module = ModuleType(file_name)
loader = SchemaLoader()
module._loader = loader
for node in request.nodes:
loader.load(node)
for node in request.nodes:
s = loader.load(node)
local_module = _load(module, node, loader, name = node.displayName.replace(file_name, '', 1))
try:
s = s.asStruct()
local_module.Schema = s
except: pass
return module

178
capnp/capnp_cpp.pxd Normal file
View File

@@ -0,0 +1,178 @@
# schema.capnp.cpp.pyx
# distutils: language = c++
# distutils: extra_compile_args = --std=c++11
# distutils: libraries = capnp
from schema_cpp cimport Node, Data, StructNode, EnumNode
from libc.stdint cimport *
ctypedef unsigned int uint
cdef extern from "capnp/common.h" namespace " ::capnp":
enum Void:
VOID " ::capnp::Void::VOID"
cdef extern from "kj/common.h" namespace "::kj":
cdef cppclass Maybe[T]:
pass
cdef extern from "capnp/schema.h" namespace " ::capnp":
cdef cppclass Schema:
Node.Reader getProto() except +
StructSchema asStruct() except +
EnumSchema asEnum() except +
Schema getDependency(uint64_t id) except +
#InterfaceSchema asInterface() const;
cdef cppclass MemberForward" ::capnp::StructSchema::Member":
pass
cdef cppclass StructSchema(Schema):
cppclass MemberList:
uint size()
MemberForward operator[](uint index)
cppclass Union:
StructNode.Union.Reader getProto()
MemberList getMembers()
MemberForward getMemberByName(char * name)
cppclass Member:
StructNode.Member.Reader getProto()
StructSchema getContainingStruct()
uint getIndex()
MemberList getMembers()
Union asUnion() except +
Node.Reader getProto()
MemberList getMembers()
Member getMemberByName(char * name)
cdef cppclass EnumSchema:
cppclass Enumerant:
EnumNode.Enumerant.Reader getProto()
EnumSchema getContainingEnum()
uint16_t getOrdinal()
cppclass EnumerantList:
uint size()
Enumerant operator[](uint index)
EnumerantList getEnumerants()
Enumerant getEnumerantByName(char * name)
Node.Reader getProto()
cdef extern from "capnp/schema-loader.h" namespace " ::capnp":
cdef cppclass SchemaLoader:
SchemaLoader()
Schema load(Node.Reader &) except +
Schema get(uint64_t id) except +
cdef extern from "capnp/dynamic.h" namespace " ::capnp":
cdef cppclass DynamicValueForward" ::capnp::DynamicValue":
cppclass Reader:
pass
cppclass Builder:
pass
enum Type:
TYPE_UNKNOWN " ::capnp::DynamicValue::UNKNOWN"
TYPE_VOID " ::capnp::DynamicValue::VOID"
TYPE_BOOL " ::capnp::DynamicValue::BOOL"
TYPE_INT " ::capnp::DynamicValue::INT"
TYPE_UINT " ::capnp::DynamicValue::UINT"
TYPE_FLOAT " ::capnp::DynamicValue::FLOAT"
TYPE_TEXT " ::capnp::DynamicValue::TEXT"
TYPE_DATA " ::capnp::DynamicValue::DATA"
TYPE_LIST " ::capnp::DynamicValue::LIST"
TYPE_ENUM " ::capnp::DynamicValue::ENUM"
TYPE_STRUCT " ::capnp::DynamicValue::STRUCT"
TYPE_UNION " ::capnp::DynamicValue::UNION"
TYPE_INTERFACE " ::capnp::DynamicValue::INTERFACE"
TYPE_OBJECT " ::capnp::DynamicValue::OBJECT"
cdef cppclass DynamicStruct:
cppclass Reader:
DynamicValueForward.Reader get(char *) except +ValueError
bint has(char *) except +ValueError
cppclass Builder:
DynamicValueForward.Builder get(char *) except +ValueError
bint has(char *) except +ValueError
void set(char *, DynamicValueForward.Reader&) except +ValueError
DynamicValueForward.Builder init(char *, uint size)
DynamicValueForward.Builder init(char *)
cdef extern from "fixMaybe.h":
StructSchema.Member fixMaybe(Maybe[StructSchema.Member]) except+
EnumSchema.Enumerant fixMaybe(Maybe[EnumSchema.Enumerant]) except+
cdef extern from "capnp/dynamic.h" namespace " ::capnp":
cdef cppclass DynamicEnum:
uint16_t getRaw()
Maybe[EnumSchema.Enumerant] getEnumerant()
cdef cppclass DynamicUnion:
cppclass Reader:
DynamicValueForward.Reader get() except +ValueError
Maybe[StructSchema.Member] which()
cppclass Builder:
DynamicValueForward.Builder get() except +ValueError
Maybe[StructSchema.Member] which()
void set(char *, DynamicValueForward.Reader&) except +ValueError
DynamicValueForward.Builder init(char *, uint size)
DynamicValueForward.Builder init(char *)
cdef cppclass DynamicList:
cppclass Reader:
DynamicValueForward.Reader operator[](uint) except +ValueError
uint size()
cppclass Builder:
DynamicValueForward.Builder operator[](uint) except +ValueError
uint size()
void set(uint index, DynamicValueForward.Reader& value)
DynamicValueForward.Builder init(uint index, uint size)
cdef cppclass DynamicValue:
cppclass Reader:
Reader()
Reader(Void value)
Reader(bint value)
Reader(char value)
Reader(short value)
Reader(int value)
Reader(long value)
Reader(long long value)
Reader(unsigned char value)
Reader(unsigned short value)
Reader(unsigned int value)
Reader(unsigned long value)
Reader(unsigned long long value)
Reader(float value)
Reader(double value)
Reader(char* value)
Reader(DynamicList.Reader& value)
Reader(DynamicEnum value)
Reader(DynamicStruct.Reader& value)
Reader(DynamicUnion.Reader& value)
Type getType()
int64_t asInt"as<int64_t>"()
uint64_t asUint"as<uint64_t>"()
bint asBool"as<bool>"()
double asDouble"as<double>"()
char * asText"as< ::capnp::Text>().cStr"()
DynamicList.Reader asList"as< ::capnp::DynamicList>"()
DynamicStruct.Reader asStruct"as< ::capnp::DynamicStruct>"()
DynamicUnion.Reader asUnion"as< ::capnp::DynamicUnion>"()
DynamicEnum asEnum"as< ::capnp::DynamicEnum>"()
Data.Reader asData"as< ::capnp::Data>"()
cppclass Builder:
Type getType()
int64_t asInt"as<int64_t>"()
uint64_t asUint"as<uint64_t>"()
bint asBool"as<bool>"()
double asDouble"as<double>"()
char * asText"as< ::capnp::Text>().cStr"()
DynamicList.Builder asList"as< ::capnp::DynamicList>"()
DynamicStruct.Builder asStruct"as< ::capnp::DynamicStruct>"()
DynamicUnion.Builder asUnion"as< ::capnp::DynamicUnion>"()
DynamicEnum asEnum"as< ::capnp::DynamicEnum>"()
Data.Builder asData"as< ::capnp::Data>"()

11
capnp/fixMaybe.h Normal file
View File

@@ -0,0 +1,11 @@
#include "kj/common.h"
#include <stdexcept>
template<typename T>
T fixMaybe(::kj::Maybe<T> val) {
KJ_IF_MAYBE(new_val, val) {
return *new_val;
} else {
throw std::invalid_argument("member was null");
}
}

48862
capnp/schema.cpp Normal file

File diff suppressed because it is too large Load Diff

9
capnp/schema.pxd Normal file
View File

@@ -0,0 +1,9 @@
# schema.capnp.cpp.pyx
# distutils: language = c++
# distutils: extra_compile_args = --std=c++11
# distutils: libraries = capnp
from schema_cpp cimport Node as C_Node
cdef class _NodeReader:
cdef C_Node.Reader thisptr
cdef init(self, C_Node.Reader other)

1808
capnp/schema.pyx Normal file

File diff suppressed because it is too large Load Diff

689
capnp/schema_cpp.pxd Normal file
View File

@@ -0,0 +1,689 @@
# schema.capnp.cpp.pyx
# distutils: language = c++
# distutils: extra_compile_args = --std=c++11
# distutils: libraries = capnp
from libc.stdint cimport *
ctypedef unsigned int uint
ctypedef uint8_t UInt8
ctypedef uint16_t UInt16
ctypedef uint32_t UInt32
ctypedef uint64_t UInt64
ctypedef int8_t Int8
ctypedef int16_t Int16
ctypedef int32_t Int32
ctypedef int64_t Int64
ctypedef char * Object
ctypedef bint Bool
ctypedef float Float32
ctypedef double Float64
cdef extern from "capnp/dynamic.h" namespace " ::capnp":
cdef cppclass DynamicValue:
cppclass Reader:
pass
cppclass Builder:
pass
cdef cppclass DynamicStruct:
cppclass Reader:
pass
cppclass Builder:
pass
cdef extern from "capnp/schema.h" namespace " ::capnp":
cdef cppclass Schema:
pass
cdef cppclass StructSchema(Schema):
pass
cdef extern from "capnp/blob.h" namespace " ::capnp":
cdef cppclass Data:
cppclass Reader:
char * begin()
size_t size()
cppclass Builder:
char * begin()
size_t size()
cdef cppclass Text:
cppclass Reader:
char * cStr()
cppclass Builder:
char * cStr()
cdef extern from "capnp/message.h" namespace " ::capnp":
cdef cppclass List[T]:
cppclass Reader:
T operator[](uint)
uint size()
cppclass Builder:
T operator[](uint)
uint size()
cdef extern from "capnp/schema.capnp.h" namespace " ::capnp::schema":
enum :
_ElementSize_inlineComposite " ::capnp::schema::ElementSize::INLINE_COMPOSITE"
_ElementSize_eightBytes " ::capnp::schema::ElementSize::EIGHT_BYTES"
_ElementSize_pointer " ::capnp::schema::ElementSize::POINTER"
_ElementSize_bit " ::capnp::schema::ElementSize::BIT"
_ElementSize_twoBytes " ::capnp::schema::ElementSize::TWO_BYTES"
_ElementSize_fourBytes " ::capnp::schema::ElementSize::FOUR_BYTES"
_ElementSize_byte " ::capnp::schema::ElementSize::BYTE"
_ElementSize_empty " ::capnp::schema::ElementSize::EMPTY"
enum _Value_Body_Which:
_Value_Body_uint32Value " ::capnp::schema::Value::Body::Which::UINT32_VALUE"
_Value_Body_float64Value " ::capnp::schema::Value::Body::Which::FLOAT64_VALUE"
_Value_Body_voidValue " ::capnp::schema::Value::Body::Which::VOID_VALUE"
_Value_Body_dataValue " ::capnp::schema::Value::Body::Which::DATA_VALUE"
_Value_Body_listValue " ::capnp::schema::Value::Body::Which::LIST_VALUE"
_Value_Body_int32Value " ::capnp::schema::Value::Body::Which::INT32_VALUE"
_Value_Body_enumValue " ::capnp::schema::Value::Body::Which::ENUM_VALUE"
_Value_Body_int8Value " ::capnp::schema::Value::Body::Which::INT8_VALUE"
_Value_Body_boolValue " ::capnp::schema::Value::Body::Which::BOOL_VALUE"
_Value_Body_int16Value " ::capnp::schema::Value::Body::Which::INT16_VALUE"
_Value_Body_float32Value " ::capnp::schema::Value::Body::Which::FLOAT32_VALUE"
_Value_Body_interfaceValue " ::capnp::schema::Value::Body::Which::INTERFACE_VALUE"
_Value_Body_uint16Value " ::capnp::schema::Value::Body::Which::UINT16_VALUE"
_Value_Body_uint8Value " ::capnp::schema::Value::Body::Which::UINT8_VALUE"
_Value_Body_int64Value " ::capnp::schema::Value::Body::Which::INT64_VALUE"
_Value_Body_structValue " ::capnp::schema::Value::Body::Which::STRUCT_VALUE"
_Value_Body_textValue " ::capnp::schema::Value::Body::Which::TEXT_VALUE"
_Value_Body_uint64Value " ::capnp::schema::Value::Body::Which::UINT64_VALUE"
_Value_Body_objectValue " ::capnp::schema::Value::Body::Which::OBJECT_VALUE"
enum _Type_Body_Which:
_Type_Body_boolType " ::capnp::schema::Type::Body::Which::BOOL_TYPE"
_Type_Body_structType " ::capnp::schema::Type::Body::Which::STRUCT_TYPE"
_Type_Body_int32Type " ::capnp::schema::Type::Body::Which::INT32_TYPE"
_Type_Body_voidType " ::capnp::schema::Type::Body::Which::VOID_TYPE"
_Type_Body_uint16Type " ::capnp::schema::Type::Body::Which::UINT16_TYPE"
_Type_Body_dataType " ::capnp::schema::Type::Body::Which::DATA_TYPE"
_Type_Body_objectType " ::capnp::schema::Type::Body::Which::OBJECT_TYPE"
_Type_Body_int64Type " ::capnp::schema::Type::Body::Which::INT64_TYPE"
_Type_Body_float64Type " ::capnp::schema::Type::Body::Which::FLOAT64_TYPE"
_Type_Body_interfaceType " ::capnp::schema::Type::Body::Which::INTERFACE_TYPE"
_Type_Body_uint32Type " ::capnp::schema::Type::Body::Which::UINT32_TYPE"
_Type_Body_uint8Type " ::capnp::schema::Type::Body::Which::UINT8_TYPE"
_Type_Body_listType " ::capnp::schema::Type::Body::Which::LIST_TYPE"
_Type_Body_int8Type " ::capnp::schema::Type::Body::Which::INT8_TYPE"
_Type_Body_float32Type " ::capnp::schema::Type::Body::Which::FLOAT32_TYPE"
_Type_Body_enumType " ::capnp::schema::Type::Body::Which::ENUM_TYPE"
_Type_Body_uint64Type " ::capnp::schema::Type::Body::Which::UINT64_TYPE"
_Type_Body_textType " ::capnp::schema::Type::Body::Which::TEXT_TYPE"
_Type_Body_int16Type " ::capnp::schema::Type::Body::Which::INT16_TYPE"
enum _Node_Body_Which:
_Node_Body_annotationNode " ::capnp::schema::Node::Body::Which::ANNOTATION_NODE"
_Node_Body_interfaceNode " ::capnp::schema::Node::Body::Which::INTERFACE_NODE"
_Node_Body_enumNode " ::capnp::schema::Node::Body::Which::ENUM_NODE"
_Node_Body_structNode " ::capnp::schema::Node::Body::Which::STRUCT_NODE"
_Node_Body_constNode " ::capnp::schema::Node::Body::Which::CONST_NODE"
_Node_Body_fileNode " ::capnp::schema::Node::Body::Which::FILE_NODE"
enum _StructNode_Member_Body_Which:
_StructNode_Member_Body_fieldMember " ::capnp::schema::StructNode::Member::Body::Which::FIELD_MEMBER"
_StructNode_Member_Body_unionMember " ::capnp::schema::StructNode::Member::Body::Which::UNION_MEMBER"
cdef cppclass CodeGeneratorRequest
cdef cppclass InterfaceNode
cdef cppclass Value
cdef cppclass ConstNode
cdef cppclass Type
cdef cppclass FileNode
cdef cppclass Node
cdef cppclass AnnotationNode
cdef cppclass EnumNode
cdef cppclass StructNode
cdef cppclass Annotation
cdef cppclass CodeGeneratorRequest:
cppclass Reader:
List[CodeGeneratorRequest.Node].Reader getNodes()
List[UInt64].Reader getRequestedFiles()
cppclass Builder:
List[CodeGeneratorRequest.Node].Builder getNodes()
List[CodeGeneratorRequest.Node].Builder initNodes(int)
List[UInt64].Builder getRequestedFiles()
List[UInt64].Builder initRequestedFiles(int)
cdef cppclass InterfaceNode:
cppclass Method
cppclass Method:
cppclass Param
cppclass Param:
cppclass Reader:
Value getDefaultValue()
Type getType()
Text.Reader getName()
List[InterfaceNode.Method.Param.Annotation].Reader getAnnotations()
cppclass Builder:
Value getDefaultValue()
void setDefaultValue(Value)
Type getType()
void setType(Type)
Text.Builder getName()
void setName(Text)
List[InterfaceNode.Method.Param.Annotation].Builder getAnnotations()
List[InterfaceNode.Method.Param.Annotation].Builder initAnnotations(int)
cppclass Reader:
UInt16 getCodeOrder()
Text.Reader getName()
List[InterfaceNode.Method.InterfaceNode.Method.Param].Reader getParams()
UInt16 getRequiredParamCount()
Type getReturnType()
List[InterfaceNode.Method.Annotation].Reader getAnnotations()
cppclass Builder:
UInt16 getCodeOrder()
void setCodeOrder(UInt16)
Text.Builder getName()
void setName(Text)
List[InterfaceNode.Method.InterfaceNode.Method.Param].Builder getParams()
List[InterfaceNode.Method.InterfaceNode.Method.Param].Builder initParams(int)
UInt16 getRequiredParamCount()
void setRequiredParamCount(UInt16)
Type getReturnType()
void setReturnType(Type)
List[InterfaceNode.Method.Annotation].Builder getAnnotations()
List[InterfaceNode.Method.Annotation].Builder initAnnotations(int)
cppclass Reader:
List[InterfaceNode.InterfaceNode.Method].Reader getMethods()
cppclass Builder:
List[InterfaceNode.InterfaceNode.Method].Builder getMethods()
List[InterfaceNode.InterfaceNode.Method].Builder initMethods(int)
cdef cppclass Value:
cppclass Body
cppclass Body:
cppclass Reader:
int which()
UInt32 getUint32Value()
Float64 getFloat64Value()
Void getVoidValue()
Data.Reader getDataValue()
Object getListValue()
Int32 getInt32Value()
UInt16 getEnumValue()
Int8 getInt8Value()
Bool getBoolValue()
Int16 getInt16Value()
Float32 getFloat32Value()
Void getInterfaceValue()
UInt16 getUint16Value()
UInt8 getUint8Value()
Int64 getInt64Value()
Object getStructValue()
Text.Reader getTextValue()
UInt64 getUint64Value()
Object getObjectValue()
cppclass Builder:
int which()
UInt32 getUint32Value()
void setUint32Value(UInt32)
Float64 getFloat64Value()
void setFloat64Value(Float64)
Void getVoidValue()
void setVoidValue(Void)
Data.Builder getDataValue()
void setDataValue(Data)
Object getListValue()
void setListValue(Object)
Int32 getInt32Value()
void setInt32Value(Int32)
UInt16 getEnumValue()
void setEnumValue(UInt16)
Int8 getInt8Value()
void setInt8Value(Int8)
Bool getBoolValue()
void setBoolValue(Bool)
Int16 getInt16Value()
void setInt16Value(Int16)
Float32 getFloat32Value()
void setFloat32Value(Float32)
Void getInterfaceValue()
void setInterfaceValue(Void)
UInt16 getUint16Value()
void setUint16Value(UInt16)
UInt8 getUint8Value()
void setUint8Value(UInt8)
Int64 getInt64Value()
void setInt64Value(Int64)
Object getStructValue()
void setStructValue(Object)
Text.Builder getTextValue()
void setTextValue(Text)
UInt64 getUint64Value()
void setUint64Value(UInt64)
Object getObjectValue()
void setObjectValue(Object)
cppclass Reader:
Value.Body getBody()
cppclass Builder:
Value.Body getBody()
void setBody(Value.Body)
cdef cppclass ConstNode:
cppclass Reader:
Type getType()
Value getValue()
cppclass Builder:
Type getType()
void setType(Type)
Value getValue()
void setValue(Value)
cdef cppclass Type:
cppclass Body
cppclass Body:
cppclass Reader:
int which()
Void getBoolType()
UInt64 getStructType()
Void getInt32Type()
Void getVoidType()
Void getUint16Type()
Void getDataType()
Void getObjectType()
Void getInt64Type()
Void getFloat64Type()
UInt64 getInterfaceType()
Void getUint32Type()
Void getUint8Type()
Type getListType()
Void getInt8Type()
Void getFloat32Type()
UInt64 getEnumType()
Void getUint64Type()
Void getTextType()
Void getInt16Type()
cppclass Builder:
int which()
Void getBoolType()
void setBoolType(Void)
UInt64 getStructType()
void setStructType(UInt64)
Void getInt32Type()
void setInt32Type(Void)
Void getVoidType()
void setVoidType(Void)
Void getUint16Type()
void setUint16Type(Void)
Void getDataType()
void setDataType(Void)
Void getObjectType()
void setObjectType(Void)
Void getInt64Type()
void setInt64Type(Void)
Void getFloat64Type()
void setFloat64Type(Void)
UInt64 getInterfaceType()
void setInterfaceType(UInt64)
Void getUint32Type()
void setUint32Type(Void)
Void getUint8Type()
void setUint8Type(Void)
Type getListType()
void setListType(Type)
Void getInt8Type()
void setInt8Type(Void)
Void getFloat32Type()
void setFloat32Type(Void)
UInt64 getEnumType()
void setEnumType(UInt64)
Void getUint64Type()
void setUint64Type(Void)
Void getTextType()
void setTextType(Void)
Void getInt16Type()
void setInt16Type(Void)
cppclass Reader:
Type.Body getBody()
cppclass Builder:
Type.Body getBody()
void setBody(Type.Body)
cdef cppclass FileNode:
cppclass Import
cppclass Import:
cppclass Reader:
UInt64 getId()
Text.Reader getName()
cppclass Builder:
UInt64 getId()
void setId(UInt64)
Text.Builder getName()
void setName(Text)
cppclass Reader:
List[FileNode.FileNode.Import].Reader getImports()
cppclass Builder:
List[FileNode.FileNode.Import].Builder getImports()
List[FileNode.FileNode.Import].Builder initImports(int)
cdef cppclass Node:
cppclass Body
cppclass NestedNode
cppclass Body:
cppclass Reader:
int which()
AnnotationNode getAnnotationNode()
InterfaceNode getInterfaceNode()
EnumNode getEnumNode()
StructNode getStructNode()
ConstNode getConstNode()
FileNode getFileNode()
cppclass Builder:
int which()
AnnotationNode getAnnotationNode()
void setAnnotationNode(AnnotationNode)
InterfaceNode getInterfaceNode()
void setInterfaceNode(InterfaceNode)
EnumNode getEnumNode()
void setEnumNode(EnumNode)
StructNode getStructNode()
void setStructNode(StructNode)
ConstNode getConstNode()
void setConstNode(ConstNode)
FileNode getFileNode()
void setFileNode(FileNode)
cppclass NestedNode:
cppclass Reader:
Text.Reader getName()
UInt64 getId()
cppclass Builder:
Text.Builder getName()
void setName(Text)
UInt64 getId()
void setId(UInt64)
cppclass Reader:
Node.Body getBody()
Text.Reader getDisplayName()
List[Node.Annotation].Reader getAnnotations()
UInt64 getScopeId()
List[Node.Node.NestedNode].Reader getNestedNodes()
UInt64 getId()
cppclass Builder:
Node.Body getBody()
void setBody(Node.Body)
Text.Builder getDisplayName()
void setDisplayName(Text)
List[Node.Annotation].Builder getAnnotations()
List[Node.Annotation].Builder initAnnotations(int)
UInt64 getScopeId()
void setScopeId(UInt64)
List[Node.Node.NestedNode].Builder getNestedNodes()
List[Node.Node.NestedNode].Builder initNestedNodes(int)
UInt64 getId()
void setId(UInt64)
cdef cppclass AnnotationNode:
cppclass Reader:
Bool getTargetsField()
Bool getTargetsConst()
Bool getTargetsFile()
Bool getTargetsStruct()
Bool getTargetsParam()
Bool getTargetsUnion()
Bool getTargetsAnnotation()
Bool getTargetsEnumerant()
Type getType()
Bool getTargetsEnum()
Bool getTargetsInterface()
Bool getTargetsMethod()
cppclass Builder:
Bool getTargetsField()
void setTargetsField(Bool)
Bool getTargetsConst()
void setTargetsConst(Bool)
Bool getTargetsFile()
void setTargetsFile(Bool)
Bool getTargetsStruct()
void setTargetsStruct(Bool)
Bool getTargetsParam()
void setTargetsParam(Bool)
Bool getTargetsUnion()
void setTargetsUnion(Bool)
Bool getTargetsAnnotation()
void setTargetsAnnotation(Bool)
Bool getTargetsEnumerant()
void setTargetsEnumerant(Bool)
Type getType()
void setType(Type)
Bool getTargetsEnum()
void setTargetsEnum(Bool)
Bool getTargetsInterface()
void setTargetsInterface(Bool)
Bool getTargetsMethod()
void setTargetsMethod(Bool)
cdef cppclass EnumNode:
cppclass Enumerant
cppclass Enumerant:
cppclass Reader:
UInt16 getCodeOrder()
Text.Reader getName()
List[EnumNode.Enumerant.Annotation].Reader getAnnotations()
cppclass Builder:
UInt16 getCodeOrder()
void setCodeOrder(UInt16)
Text.Builder getName()
void setName(Text)
List[EnumNode.Enumerant.Annotation].Builder getAnnotations()
List[EnumNode.Enumerant.Annotation].Builder initAnnotations(int)
cppclass Reader:
List[EnumNode.EnumNode.Enumerant].Reader getEnumerants()
cppclass Builder:
List[EnumNode.EnumNode.Enumerant].Builder getEnumerants()
List[EnumNode.EnumNode.Enumerant].Builder initEnumerants(int)
cdef cppclass StructNode:
cppclass Union
cppclass Member
cppclass Field
cppclass Union:
cppclass Reader:
UInt32 getDiscriminantOffset()
List[StructNode.Union.StructNode.Member].Reader getMembers()
cppclass Builder:
UInt32 getDiscriminantOffset()
void setDiscriminantOffset(UInt32)
List[StructNode.Union.StructNode.Member].Builder getMembers()
List[StructNode.Union.StructNode.Member].Builder initMembers(int)
cppclass Member:
cppclass Body
cppclass Body:
cppclass Reader:
int which()
Field getFieldMember()
Union getUnionMember()
cppclass Builder:
int which()
Field getFieldMember()
void setFieldMember(Field)
Union getUnionMember()
void setUnionMember(Union)
cppclass Reader:
UInt16 getOrdinal()
StructNode.Member.Body getBody()
UInt16 getCodeOrder()
Text.Reader getName()
List[StructNode.Member.Annotation].Reader getAnnotations()
cppclass Builder:
UInt16 getOrdinal()
void setOrdinal(UInt16)
StructNode.Member.Body getBody()
void setBody(StructNode.Member.Body)
UInt16 getCodeOrder()
void setCodeOrder(UInt16)
Text.Builder getName()
void setName(Text)
List[StructNode.Member.Annotation].Builder getAnnotations()
List[StructNode.Member.Annotation].Builder initAnnotations(int)
cppclass Field:
cppclass Reader:
Value getDefaultValue()
Type getType()
UInt32 getOffset()
cppclass Builder:
Value getDefaultValue()
void setDefaultValue(Value)
Type getType()
void setType(Type)
UInt32 getOffset()
void setOffset(UInt32)
cppclass Reader:
UInt16 getDataSectionWordSize()
List[StructNode.StructNode.Member].Reader getMembers()
UInt16 getPointerSectionSize()
cppclass Builder:
UInt16 getDataSectionWordSize()
void setDataSectionWordSize(UInt16)
List[StructNode.StructNode.Member].Builder getMembers()
List[StructNode.StructNode.Member].Builder initMembers(int)
UInt16 getPointerSectionSize()
void setPointerSectionSize(UInt16)
cdef cppclass Annotation:
cppclass Reader:
UInt64 getId()
Value getValue()
cppclass Builder:
UInt64 getId()
void setId(UInt64)
Value getValue()
void setValue(Value)
cdef extern from "capnp/message.h" namespace " ::capnp":
cdef cppclass ReaderOptions:
uint64_t traversalLimitInWords
uint nestingLimit
cdef cppclass MessageBuilder:
CodeGeneratorRequest.Builder getRootCodeGeneratorRequest'getRoot< ::capnp::schema::CodeGeneratorRequest>'()
CodeGeneratorRequest.Builder initRootCodeGeneratorRequest'initRoot< ::capnp::schema::CodeGeneratorRequest>'()
InterfaceNode.Builder getRootInterfaceNode'getRoot< ::capnp::schema::InterfaceNode>'()
InterfaceNode.Builder initRootInterfaceNode'initRoot< ::capnp::schema::InterfaceNode>'()
Value.Builder getRootValue'getRoot< ::capnp::schema::Value>'()
Value.Builder initRootValue'initRoot< ::capnp::schema::Value>'()
ConstNode.Builder getRootConstNode'getRoot< ::capnp::schema::ConstNode>'()
ConstNode.Builder initRootConstNode'initRoot< ::capnp::schema::ConstNode>'()
Type.Builder getRootType'getRoot< ::capnp::schema::Type>'()
Type.Builder initRootType'initRoot< ::capnp::schema::Type>'()
FileNode.Builder getRootFileNode'getRoot< ::capnp::schema::FileNode>'()
FileNode.Builder initRootFileNode'initRoot< ::capnp::schema::FileNode>'()
Node.Builder getRootNode'getRoot< ::capnp::schema::Node>'()
Node.Builder initRootNode'initRoot< ::capnp::schema::Node>'()
AnnotationNode.Builder getRootAnnotationNode'getRoot< ::capnp::schema::AnnotationNode>'()
AnnotationNode.Builder initRootAnnotationNode'initRoot< ::capnp::schema::AnnotationNode>'()
EnumNode.Builder getRootEnumNode'getRoot< ::capnp::schema::EnumNode>'()
EnumNode.Builder initRootEnumNode'initRoot< ::capnp::schema::EnumNode>'()
StructNode.Builder getRootStructNode'getRoot< ::capnp::schema::StructNode>'()
StructNode.Builder initRootStructNode'initRoot< ::capnp::schema::StructNode>'()
Annotation.Builder getRootAnnotation'getRoot< ::capnp::schema::Annotation>'()
Annotation.Builder initRootAnnotation'initRoot< ::capnp::schema::Annotation>'()
DynamicStruct.Builder getRootDynamicStruct'getRoot< ::capnp::DynamicStruct>'(StructSchema)
DynamicStruct.Builder initRootDynamicStruct'initRoot< ::capnp::DynamicStruct>'(StructSchema)
cdef cppclass MessageReader:
CodeGeneratorRequest.Reader getRootCodeGeneratorRequest'getRoot< ::capnp::schema::CodeGeneratorRequest>'()
InterfaceNode.Reader getRootInterfaceNode'getRoot< ::capnp::schema::InterfaceNode>'()
Value.Reader getRootValue'getRoot< ::capnp::schema::Value>'()
ConstNode.Reader getRootConstNode'getRoot< ::capnp::schema::ConstNode>'()
Type.Reader getRootType'getRoot< ::capnp::schema::Type>'()
FileNode.Reader getRootFileNode'getRoot< ::capnp::schema::FileNode>'()
Node.Reader getRootNode'getRoot< ::capnp::schema::Node>'()
AnnotationNode.Reader getRootAnnotationNode'getRoot< ::capnp::schema::AnnotationNode>'()
EnumNode.Reader getRootEnumNode'getRoot< ::capnp::schema::EnumNode>'()
StructNode.Reader getRootStructNode'getRoot< ::capnp::schema::StructNode>'()
Annotation.Reader getRootAnnotation'getRoot< ::capnp::schema::Annotation>'()
DynamicStruct.Reader getRootDynamicStruct'getRoot< ::capnp::DynamicStruct>'(StructSchema)
cdef cppclass MallocMessageBuilder(MessageBuilder):
MallocMessageBuilder()
MallocMessageBuilder(int)
enum Void:
VOID
cdef extern from "capnp/serialize.h" namespace " ::capnp":
cdef cppclass StreamFdMessageReader(MessageReader):
StreamFdMessageReader(int)
StreamFdMessageReader(int, ReaderOptions)
void writeMessageToFd(int, MessageBuilder&)
cdef extern from "capnp/serialize-packed.h" namespace " ::capnp":
cdef cppclass PackedFdMessageReader(MessageReader):
PackedFdMessageReader(int)
StreamFdMessageReader(int, ReaderOptions)
void writePackedMessageToFd(int, MessageBuilder&)