Copyright © 2013, Andreas Stenius
Authors: Andreas Stenius (kaos@astekk.se).
Read/Write/Allocate references.
Everything reference. Which is almost everything in Cap'n Proto :p.ref() = ecapnp:ref()
ref_kind() = ecapnp:ref_kind()
segment_id() = ecapnp:segment_id()
word_count() = ecapnp:word_count()
| alloc/3 | Allocate data for a reference. |
| alloc/4 | Allocate data for a reference of a specific kind. |
| alloc_data/1 | Allocate data for reference. |
| alloc_data/2 | Allocate data for reference. |
| alloc_list/3 | Allocate data for list. |
| copy/1 | Make a deep copy of a reference. |
| create_ptr/2 | |
| follow_far/1 | Resolve a far pointer. |
| get/3 | Get reference from segment data. |
| get/4 | Get reference from segment data. |
| null_ref/1 | Get a null pointer. |
| paste/2 | Allocate space and write data for reference. |
| ptr/2 | Get indexed reference (unintialized). |
| read_data/1 | Read data. |
| read_data/2 | Read data. |
| read_list/1 | Read elements from a list ref. |
| read_list/2 | Read elements from a list ref. |
| read_list_refs/3 | Read elements from a list ref, forcing the result into a list of refs. |
| read_struct_data/3 | Read from data section of a struct ref. |
| read_struct_data/4 | Read from data section of a struct ref. |
| read_struct_ptr/2 | Read a refeference from the pointer section of struct ref. |
| read_struct_ptr/3 | Read a refeference from the pointer section of struct ref. |
| read_text/1 | Read text. |
| read_text/2 | Read text. |
| refresh/1 | Reread reference from message. |
| set/2 | Set reference kind. |
| write_data/3 | Write data. |
| write_list/4 | Write list element. |
| write_struct_data/4 | Write to struct data section. |
| write_struct_ptr/2 | Write pointer reference. |
| write_text/3 | Write text. |
alloc(SegmentId::segment_id(), Size::integer(), Builder::pid()) -> ref()
Allocate data for a reference.
The allocated data is left empty.alloc(Kind::ref_kind(), SegmentId::segment_id(), Size::integer(), Builder::pid()) -> ref()
Allocate data for a reference of a specific kind.
The reference will be written to the first word of the allocated data, byset/2.
Allocate data for reference.
The number of words allocated is deduced from the passed Reference.
alloc_data(Size::word_count(), Ref::ref()) -> ref()
Allocate data for reference.
alloc_list(Idx::integer(), List_ref::ref_kind(), Ref::ref()) -> ref()
Allocate data for list.
Kind should be a #list_ref{} describing the list to
allocate; but for inlineComposite lists, the #list_ref.size
field should point to a #struct_ref{} describing the list element
type, and #list_ref.count should still be the number of elements
rather than the total word count.
See also: alloc_data/1.
copy(Ref::ref()) -> binary()
Make a deep copy of a reference.
Recursively follows all pointers and copies them as well. So copying a root object will effectively defragment a fragmented message.create_ptr(Offset, Ref) -> any()
Resolve a far pointer.
Usually this is done automatically when reading ref's.get(SegmentId::segment_id(), Pos::integer(), Data::pid() | binary()) -> ref()
Get reference from segment data.
Read segment, and parse it for a reference pointer.
Will follow far pointers.See also: get/4.
get(SegmentId::segment_id(), Pos::integer(), Data::pid() | binary(), FollowFar::boolean()) -> ref()
Get reference from segment data.
Read segment, and parse it for a reference pointer.
The resulting reference may be a far pointer, unlessFollowFar is true.
See also: read_segment/5, ecapnp_data:get_segment/4.
Get a null pointer.
The up-side with this function in contrast to using a default#ref{} record on its own is that the null reference returned by
this function knows about the schema and segment data of the
message for which it was based.
Allocate space and write data for reference.
All data, both data section and pointers section, and any data that those may refer to (good for saving off a deep copy of another object).
Note:Data should be whole words (8 bytes). Any fraction of a
word will be truncated.
Get indexed reference (unintialized).
NOTICE: That by 'uninitialized', the returned reference is a null reference, regardless of what data currently is in the segment.
That is, for structs, get a reference for pointerIdx, while for
lists, get a reference for the element at Idx (either a pointer
or a "unpositioned" ref pointing to where a inlineComposite element
holds its data).
read_data(Ref::ref()) -> binary()
Read data.
read_data(Ref::ref(), Default::any()) -> binary() | any()
Read data.
Read elements from a list ref.
Read elements from a list ref.
read_list_refs(Ref, ElementRefKind, Default) -> any()
Read elements from a list ref, forcing the result into a list of refs.
read_struct_data(Align::integer(), Len::integer(), Ref::ref()) -> binary()
Read from data section of a struct ref.
Align is number of bits into the data section to read from, and
Len is number of bits to read.
read_struct_data(FAlign::integer(), Len::integer(), Ref::ref(), Default::any()) -> binary() | any()
Read from data section of a struct ref.
Align is number of bits into the data section to read from, and
Len is number of bits to read.
Read a refeference from the pointer section of struct ref.
Read a refeference from the pointer section of struct ref.
read_text(Ref::ref()) -> binary()
Read text.
NOTICE: The required trailingNULL byte is silently dropped when
reading the text.
read_text(Ref::ref(), Default::any()) -> binary() | any()
Read text.
NOTICE: The required trailingNULL byte is silently dropped when
reading the text.
Reread reference from message.
set(Kind, Ref) -> any()
Set reference kind.
Updates the reference kind and writes it to the segment data atRef.pos.
See also: alloc/4.
Write data.
Allocates data forData and updates the Ptr in Ref to point
to the newly allocated (and updated) data.
write_list(Idx::integer(), ElementIdx::integer(), Value::binary(), Ref::ref()) -> ok
Write list element.
write_struct_data(FAlign::integer(), Len::integer(), Value::binary(), Ref::ref()) -> ok
Write to struct data section.
Write pointer reference.
Ptr must be a pointer from Ref (i.e. the pointer is within the
data bounds of the reference).
Write text.
Allocates data for Text and updates the Ptr in Ref to point
to the newly allocated (and updated) data.
NULL byte is appended to Text to stay
conformant with Cap'n Proto specifications.
Generated by EDoc, May 30 2014, 12:56:29.