DCPacker

from panda3d.direct import DCPacker
class DCPacker

Bases: DTOOL_SUPER_BASE

This class can be used for packing a series of numeric and string data into a binary stream, according to the DC specification.

See also direct/src/doc/dcPacker.txt for a more complete description and examples of using this class.

Inheritance diagram

Inheritance diagram of DCPacker

__init__(*args, **kwargs)
beginPack()

C++ Interface: begin_pack(const DCPacker self, const DCPackerInterface root)

/**
  • Begins a packing session. The parameter is the DC object that describes

  • the packing format; it may be a DCParameter or DCField.

  • Unless you call clear_data() between sessions, multiple packing sessions

  • will be concatenated together into the same buffer. If you wish to add

  • bytes to the buffer between packing sessions, use append_data() or

  • get_write_pointer().

*/

beginRepack()

C++ Interface: begin_repack(const DCPacker self, const DCPackerInterface root)

/**
  • Begins a repacking session. You must have previously called

  • set_unpack_data() to specify a buffer to unpack.

  • Unlike begin_pack() or begin_unpack() you may not concatenate the results

  • of multiple begin_repack() sessions in one buffer.

  • Also, unlike in packing or unpacking modes, you may not walk through the

  • fields from beginning to end, or even pack two consecutive fields at once.

  • Instead, you must call seek() for each field you wish to modify and pack

  • only that one field; then call seek() again to modify another field.

*/

beginUnpack()

C++ Interface: begin_unpack(const DCPacker self, const DCPackerInterface root)

/**
  • Begins an unpacking session. You must have previously called

  • set_unpack_data() to specify a buffer to unpack.

  • If there was data left in the buffer after a previous begin_unpack() ..

  • end_unpack() session, the new session will resume from the current point.

  • This method may be used, therefore, to unpack a sequence of objects from

  • the same buffer.

*/

begin_pack()

C++ Interface: begin_pack(const DCPacker self, const DCPackerInterface root)

/**
  • Begins a packing session. The parameter is the DC object that describes

  • the packing format; it may be a DCParameter or DCField.

  • Unless you call clear_data() between sessions, multiple packing sessions

  • will be concatenated together into the same buffer. If you wish to add

  • bytes to the buffer between packing sessions, use append_data() or

  • get_write_pointer().

*/

begin_repack()

C++ Interface: begin_repack(const DCPacker self, const DCPackerInterface root)

/**
  • Begins a repacking session. You must have previously called

  • set_unpack_data() to specify a buffer to unpack.

  • Unlike begin_pack() or begin_unpack() you may not concatenate the results

  • of multiple begin_repack() sessions in one buffer.

  • Also, unlike in packing or unpacking modes, you may not walk through the

  • fields from beginning to end, or even pack two consecutive fields at once.

  • Instead, you must call seek() for each field you wish to modify and pack

  • only that one field; then call seek() again to modify another field.

*/

begin_unpack()

C++ Interface: begin_unpack(const DCPacker self, const DCPackerInterface root)

/**
  • Begins an unpacking session. You must have previously called

  • set_unpack_data() to specify a buffer to unpack.

  • If there was data left in the buffer after a previous begin_unpack() ..

  • end_unpack() session, the new session will resume from the current point.

  • This method may be used, therefore, to unpack a sequence of objects from

  • the same buffer.

*/

clearData()

C++ Interface: clear_data(const DCPacker self)

/**
  • Empties the data in the pack buffer and unpack buffer. This should be

  • called between calls to begin_pack(), unless you want to concatenate all of

  • the pack results together.

*/

clear_data()

C++ Interface: clear_data(const DCPacker self)

/**
  • Empties the data in the pack buffer and unpack buffer. This should be

  • called between calls to begin_pack(), unless you want to concatenate all of

  • the pack results together.

*/

endPack()

C++ Interface: end_pack(const DCPacker self)

/**
  • Finishes a packing session.

  • The return value is true on success, or false if there has been some error

  • during packing.

*/

endRepack()

C++ Interface: end_repack(const DCPacker self)

/**
  • Finishes the repacking session.

  • The return value is true on success, or false if there has been some error

  • during repacking (or if all fields have not been repacked).

*/

endUnpack()

C++ Interface: end_unpack(const DCPacker self)

/**
  • Finishes the unpacking session.

  • The return value is true on success, or false if there has been some error

  • during unpacking (or if all fields have not been unpacked).

*/

end_pack()

C++ Interface: end_pack(const DCPacker self)

/**
  • Finishes a packing session.

  • The return value is true on success, or false if there has been some error

  • during packing.

*/

end_repack()

C++ Interface: end_repack(const DCPacker self)

/**
  • Finishes the repacking session.

  • The return value is true on success, or false if there has been some error

  • during repacking (or if all fields have not been repacked).

*/

end_unpack()

C++ Interface: end_unpack(const DCPacker self)

/**
  • Finishes the unpacking session.

  • The return value is true on success, or false if there has been some error

  • during unpacking (or if all fields have not been unpacked).

*/

getBytes()

C++ Interface: get_bytes(DCPacker self)

/**
  • Returns the packed data buffer as a bytes object. Also see get_data().

*/

getCurrentField()

C++ Interface: get_current_field(DCPacker self)

/**
  • Returns the field that will be referenced by the next call to pack_*() or

  • unpack_*(). This will be NULL if we have unpacked (or packed) all fields,

  • or if it is time to call pop().

*/

getCurrentFieldName()

C++ Interface: get_current_field_name(DCPacker self)

/**
  • Returns the name of the current field, if it has a name, or the empty

  • string if the field does not have a name or there is no current field.

*/

getCurrentParent()

C++ Interface: get_current_parent(DCPacker self)

/**
  • Returns the field that we left in our last call to push(): the owner of the

  • current level of fields. This may be NULL at the beginning of the pack

  • operation.

*/

getLastSwitch()

C++ Interface: get_last_switch(DCPacker self)

/**
  • Returns a pointer to the last DCSwitch instance that we have passed by and

  • selected one case of during the pack/unpack process. Each time we

  • encounter a new DCSwitch and select a case, this will change state.

  • This may be used to detect when a DCSwitch has been selected. At the

  • moment this changes state, get_current_parent() will contain the particular

  • SwitchCase that was selected by the switch.

*/

getLength()

C++ Interface: get_length(DCPacker self)

/**
  • Returns the current length of the buffer. This is the number of useful

  • bytes stored in the buffer, not the amount of memory it takes up.

*/

getNumNestedFields()

C++ Interface: get_num_nested_fields(DCPacker self)

/**
  • Returns the number of nested fields associated with the current field, if

  • has_nested_fields() returned true.

  • The return value may be -1 to indicate that a variable number of nested

  • fields are accepted by this field type (e.g. a variable-length array).

  • Note that this method is unreliable to determine how many fields you must

  • traverse before you can call pop(), since particularly in the presence of a

  • DCSwitch, it may change during traversal. Use more_nested_fields()

  • instead.

*/

getNumStackElementsEverAllocated()

C++ Interface: get_num_stack_elements_ever_allocated()

/**
  • Returns the number of DCPacker::StackElement pointers ever simultaneously

  • allocated; these are now either in active use or have been recycled into

  • the deleted DCPacker::StackElement pool to be used again.

*/

getNumUnpackedBytes()

C++ Interface: get_num_unpacked_bytes(DCPacker self)

/**
  • Returns the number of bytes that have been unpacked so far, or after

  • unpack_end(), the total number of bytes that were unpacked at all. This

  • can be used to validate that all of the bytes in the buffer were actually

  • unpacked (which is not otherwise considered an error).

*/

getPackType()

C++ Interface: get_pack_type(DCPacker self)

/**
  • Returns the type of value expected by the current field. See the

  • enumerated type definition at the top of DCPackerInterface.h. If this

  • returns one of PT_double, PT_int, PT_int64, or PT_string, then you should

  • call the corresponding pack_double(), pack_int() function (or

  • unpack_double(), unpack_int(), etc.) to transfer data. Otherwise, you

  • should call push() and begin packing or unpacking the nested fields.

*/

getString()

C++ Interface: get_string(DCPacker self)

/**
  • Returns the packed data buffer as a string. Also see get_data().

*/

/**
  • Copies the packed data into the indicated string. Also see get_data().

*/

getUnpackLength()

C++ Interface: get_unpack_length(DCPacker self)

/**
  • Returns the total number of bytes in the unpack data buffer. This is the

  • buffer used when unpacking; it is separate from the pack data returned by

  • get_length(), which is filled during packing.

*/

getUnpackString()

C++ Interface: get_unpack_string(DCPacker self)

/**
  • Returns the unpack data buffer, as a string. This is the buffer used when

  • unpacking; it is separate from the pack data returned by get_string(),

  • which is filled during packing. Also see get_unpack_data().

*/

get_bytes()

C++ Interface: get_bytes(DCPacker self)

/**
  • Returns the packed data buffer as a bytes object. Also see get_data().

*/

get_current_field()

C++ Interface: get_current_field(DCPacker self)

/**
  • Returns the field that will be referenced by the next call to pack_*() or

  • unpack_*(). This will be NULL if we have unpacked (or packed) all fields,

  • or if it is time to call pop().

*/

get_current_field_name()

C++ Interface: get_current_field_name(DCPacker self)

/**
  • Returns the name of the current field, if it has a name, or the empty

  • string if the field does not have a name or there is no current field.

*/

get_current_parent()

C++ Interface: get_current_parent(DCPacker self)

/**
  • Returns the field that we left in our last call to push(): the owner of the

  • current level of fields. This may be NULL at the beginning of the pack

  • operation.

*/

get_last_switch()

C++ Interface: get_last_switch(DCPacker self)

/**
  • Returns a pointer to the last DCSwitch instance that we have passed by and

  • selected one case of during the pack/unpack process. Each time we

  • encounter a new DCSwitch and select a case, this will change state.

  • This may be used to detect when a DCSwitch has been selected. At the

  • moment this changes state, get_current_parent() will contain the particular

  • SwitchCase that was selected by the switch.

*/

get_length()

C++ Interface: get_length(DCPacker self)

/**
  • Returns the current length of the buffer. This is the number of useful

  • bytes stored in the buffer, not the amount of memory it takes up.

*/

get_num_nested_fields()

C++ Interface: get_num_nested_fields(DCPacker self)

/**
  • Returns the number of nested fields associated with the current field, if

  • has_nested_fields() returned true.

  • The return value may be -1 to indicate that a variable number of nested

  • fields are accepted by this field type (e.g. a variable-length array).

  • Note that this method is unreliable to determine how many fields you must

  • traverse before you can call pop(), since particularly in the presence of a

  • DCSwitch, it may change during traversal. Use more_nested_fields()

  • instead.

*/

get_num_stack_elements_ever_allocated()

C++ Interface: get_num_stack_elements_ever_allocated()

/**
  • Returns the number of DCPacker::StackElement pointers ever simultaneously

  • allocated; these are now either in active use or have been recycled into

  • the deleted DCPacker::StackElement pool to be used again.

*/

get_num_unpacked_bytes()

C++ Interface: get_num_unpacked_bytes(DCPacker self)

/**
  • Returns the number of bytes that have been unpacked so far, or after

  • unpack_end(), the total number of bytes that were unpacked at all. This

  • can be used to validate that all of the bytes in the buffer were actually

  • unpacked (which is not otherwise considered an error).

*/

get_pack_type()

C++ Interface: get_pack_type(DCPacker self)

/**
  • Returns the type of value expected by the current field. See the

  • enumerated type definition at the top of DCPackerInterface.h. If this

  • returns one of PT_double, PT_int, PT_int64, or PT_string, then you should

  • call the corresponding pack_double(), pack_int() function (or

  • unpack_double(), unpack_int(), etc.) to transfer data. Otherwise, you

  • should call push() and begin packing or unpacking the nested fields.

*/

get_string()

C++ Interface: get_string(DCPacker self)

/**
  • Returns the packed data buffer as a string. Also see get_data().

*/

/**
  • Copies the packed data into the indicated string. Also see get_data().

*/

get_unpack_length()

C++ Interface: get_unpack_length(DCPacker self)

/**
  • Returns the total number of bytes in the unpack data buffer. This is the

  • buffer used when unpacking; it is separate from the pack data returned by

  • get_length(), which is filled during packing.

*/

get_unpack_string()

C++ Interface: get_unpack_string(DCPacker self)

/**
  • Returns the unpack data buffer, as a string. This is the buffer used when

  • unpacking; it is separate from the pack data returned by get_string(),

  • which is filled during packing. Also see get_unpack_data().

*/

hadError()

C++ Interface: had_error(DCPacker self)

/**
  • Returns true if there has been any error (either a pack error or a range

  • error) since the most recent call to begin(). If this returns true, then

  • the matching call to end() will indicate an error (false).

*/

hadPackError()

C++ Interface: had_pack_error(DCPacker self)

/**
  • Returns true if there has been an packing error since the most recent call

  • to begin(); in particular, this may be called after end() has returned

  • false to determine the nature of the failure.

  • A return value of true indicates there was a push/pop mismatch, or the

  • push/pop structure did not match the data structure, or there were the

  • wrong number of elements in a nested push/pop structure, or on unpack that

  • the data stream was truncated.

*/

hadParseError()

C++ Interface: had_parse_error(DCPacker self)

/**
  • Returns true if there has been an parse error since the most recent call to

  • begin(); this can only happen if you call parse_and_pack().

*/

hadRangeError()

C++ Interface: had_range_error(DCPacker self)

/**
  • Returns true if there has been an range validation error since the most

  • recent call to begin(); in particular, this may be called after end() has

  • returned false to determine the nature of the failure.

  • A return value of true indicates a value that was packed or unpacked did

  • not fit within the specified legal range for a parameter, or within the

  • limits of the field size.

*/

had_error()

C++ Interface: had_error(DCPacker self)

/**
  • Returns true if there has been any error (either a pack error or a range

  • error) since the most recent call to begin(). If this returns true, then

  • the matching call to end() will indicate an error (false).

*/

had_pack_error()

C++ Interface: had_pack_error(DCPacker self)

/**
  • Returns true if there has been an packing error since the most recent call

  • to begin(); in particular, this may be called after end() has returned

  • false to determine the nature of the failure.

  • A return value of true indicates there was a push/pop mismatch, or the

  • push/pop structure did not match the data structure, or there were the

  • wrong number of elements in a nested push/pop structure, or on unpack that

  • the data stream was truncated.

*/

had_parse_error()

C++ Interface: had_parse_error(DCPacker self)

/**
  • Returns true if there has been an parse error since the most recent call to

  • begin(); this can only happen if you call parse_and_pack().

*/

had_range_error()

C++ Interface: had_range_error(DCPacker self)

/**
  • Returns true if there has been an range validation error since the most

  • recent call to begin(); in particular, this may be called after end() has

  • returned false to determine the nature of the failure.

  • A return value of true indicates a value that was packed or unpacked did

  • not fit within the specified legal range for a parameter, or within the

  • limits of the field size.

*/

hasNestedFields()

C++ Interface: has_nested_fields(DCPacker self)

/**
  • Returns true if the current field has any nested fields (and thus expects a

  • push() .. pop() interface), or false otherwise. If this returns true,

  • get_num_nested_fields() may be called to determine how many nested fields

  • are expected.

*/

has_nested_fields()

C++ Interface: has_nested_fields(DCPacker self)

/**
  • Returns true if the current field has any nested fields (and thus expects a

  • push() .. pop() interface), or false otherwise. If this returns true,

  • get_num_nested_fields() may be called to determine how many nested fields

  • are expected.

*/

moreNestedFields()

C++ Interface: more_nested_fields(DCPacker self)

/**
  • Returns true if there are more nested fields to pack or unpack in the

  • current push sequence, false if it is time to call pop().

*/

more_nested_fields()

C++ Interface: more_nested_fields(DCPacker self)

/**
  • Returns true if there are more nested fields to pack or unpack in the

  • current push sequence, false if it is time to call pop().

*/

packBlob()

C++ Interface: pack_blob(const DCPacker self, bytes value)

/**
  • Packs the indicated numeric or string value into the stream.

*/

packDefaultValue()

C++ Interface: pack_default_value(const DCPacker self)

/**
  • Adds the default value for the current element into the stream. If no

  • default has been set for the current element, creates a sensible default.

*/

packDouble()

C++ Interface: pack_double(const DCPacker self, double value)

/**
  • Packs the indicated numeric or string value into the stream.

*/

packInt()

C++ Interface: pack_int(const DCPacker self, int value)

/**
  • Packs the indicated numeric or string value into the stream.

*/

packInt64()

C++ Interface: pack_int64(const DCPacker self, long value)

/**
  • Packs the indicated numeric or string value into the stream.

*/

packLiteralValue()

C++ Interface: pack_literal_value(const DCPacker self, bytes value)

/**
  • Adds the indicated string value into the stream, representing a single pre-

  • packed field element, or a whole group of field elements at once.

*/

packObject()

C++ Interface: pack_object(const DCPacker self, object object)

packString()

C++ Interface: pack_string(const DCPacker self, str value)

/**
  • Packs the indicated numeric or string value into the stream.

*/

packUint()

C++ Interface: pack_uint(const DCPacker self, int value)

/**
  • Packs the indicated numeric or string value into the stream.

*/

packUint64()

C++ Interface: pack_uint64(const DCPacker self, long value)

/**
  • Packs the indicated numeric or string value into the stream.

*/

pack_blob()

C++ Interface: pack_blob(const DCPacker self, bytes value)

/**
  • Packs the indicated numeric or string value into the stream.

*/

pack_default_value()

C++ Interface: pack_default_value(const DCPacker self)

/**
  • Adds the default value for the current element into the stream. If no

  • default has been set for the current element, creates a sensible default.

*/

pack_double()

C++ Interface: pack_double(const DCPacker self, double value)

/**
  • Packs the indicated numeric or string value into the stream.

*/

pack_int()

C++ Interface: pack_int(const DCPacker self, int value)

/**
  • Packs the indicated numeric or string value into the stream.

*/

pack_int64()

C++ Interface: pack_int64(const DCPacker self, long value)

/**
  • Packs the indicated numeric or string value into the stream.

*/

pack_literal_value()

C++ Interface: pack_literal_value(const DCPacker self, bytes value)

/**
  • Adds the indicated string value into the stream, representing a single pre-

  • packed field element, or a whole group of field elements at once.

*/

pack_object()

C++ Interface: pack_object(const DCPacker self, object object)

pack_string()

C++ Interface: pack_string(const DCPacker self, str value)

/**
  • Packs the indicated numeric or string value into the stream.

*/

pack_uint()

C++ Interface: pack_uint(const DCPacker self, int value)

/**
  • Packs the indicated numeric or string value into the stream.

*/

pack_uint64()

C++ Interface: pack_uint64(const DCPacker self, long value)

/**
  • Packs the indicated numeric or string value into the stream.

*/

parseAndPack()

C++ Interface: parse_and_pack(const DCPacker self, istream in) parse_and_pack(const DCPacker self, str formatted_object)

/**
  • Parses an object’s value according to the DC file syntax (e.g. as a

  • default value string) and packs it. Returns true on success, false on a

  • parse error.

*/

/**
  • Parses an object’s value according to the DC file syntax (e.g. as a

  • default value string) and packs it. Returns true on success, false on a

  • parse error.

*/

parse_and_pack()

C++ Interface: parse_and_pack(const DCPacker self, istream in) parse_and_pack(const DCPacker self, str formatted_object)

/**
  • Parses an object’s value according to the DC file syntax (e.g. as a

  • default value string) and packs it. Returns true on success, false on a

  • parse error.

*/

/**
  • Parses an object’s value according to the DC file syntax (e.g. as a

  • default value string) and packs it. Returns true on success, false on a

  • parse error.

*/

pop()

C++ Interface: pop(const DCPacker self)

/**
  • Marks the end of a nested series of fields.

  • This must be called to match a previous push() only after all the expected

  • number of nested fields have been packed. It is an error to call it too

  • early, or too late.

*/

push()

C++ Interface: push(const DCPacker self)

/**
  • Marks the beginning of a nested series of fields.

  • This must be called before filling the elements of an array or the

  • individual fields in a structure field. It must also be balanced by a

  • matching pop().

  • It is necessary to use push() / pop() only if has_nested_fields() returns

  • true.

*/

rawPackBlob()

C++ Interface: raw_pack_blob(const DCPacker self, bytes value)

/**
  • Packs the data into the buffer between packing sessions.

*/

rawPackFloat64()

C++ Interface: raw_pack_float64(const DCPacker self, double value)

/**
  • Packs the data into the buffer between packing sessions.

*/

rawPackInt16()

C++ Interface: raw_pack_int16(const DCPacker self, int value)

/**
  • Packs the data into the buffer between packing sessions.

*/

rawPackInt32()

C++ Interface: raw_pack_int32(const DCPacker self, int value)

/**
  • Packs the data into the buffer between packing sessions.

*/

rawPackInt64()

C++ Interface: raw_pack_int64(const DCPacker self, long value)

/**
  • Packs the data into the buffer between packing sessions.

*/

rawPackInt8()

C++ Interface: raw_pack_int8(const DCPacker self, int value)

/**
  • Packs the data into the buffer between packing sessions.

*/

rawPackString()

C++ Interface: raw_pack_string(const DCPacker self, str value)

/**
  • Packs the data into the buffer between packing sessions.

*/

rawPackUint16()

C++ Interface: raw_pack_uint16(const DCPacker self, int value)

/**
  • Packs the data into the buffer between packing sessions.

*/

rawPackUint32()

C++ Interface: raw_pack_uint32(const DCPacker self, int value)

/**
  • Packs the data into the buffer between packing sessions.

*/

rawPackUint64()

C++ Interface: raw_pack_uint64(const DCPacker self, long value)

/**
  • Packs the data into the buffer between packing sessions.

*/

rawPackUint8()

C++ Interface: raw_pack_uint8(const DCPacker self, int value)

/**
  • Packs the data into the buffer between packing sessions.

*/

rawUnpackBlob()

C++ Interface: raw_unpack_blob(const DCPacker self)

/**
  • Unpacks the data from the buffer between unpacking sessions.

*/

/**
  • Unpacks the data from the buffer between unpacking sessions.

*/

rawUnpackFloat64()

C++ Interface: raw_unpack_float64(const DCPacker self)

/**
  • Unpacks the data from the buffer between unpacking sessions.

*/

/**
  • Unpacks the data from the buffer between unpacking sessions.

*/

rawUnpackInt16()

C++ Interface: raw_unpack_int16(const DCPacker self)

/**
  • Unpacks the data from the buffer between unpacking sessions.

*/

/**
  • Unpacks the data from the buffer between unpacking sessions.

*/

rawUnpackInt32()

C++ Interface: raw_unpack_int32(const DCPacker self)

/**
  • Unpacks the data from the buffer between unpacking sessions.

*/

/**
  • Unpacks the data from the buffer between unpacking sessions.

*/

rawUnpackInt64()

C++ Interface: raw_unpack_int64(const DCPacker self)

/**
  • Unpacks the data from the buffer between unpacking sessions.

*/

/**
  • Unpacks the data from the buffer between unpacking sessions.

*/

rawUnpackInt8()

C++ Interface: raw_unpack_int8(const DCPacker self)

/**
  • Unpacks the data from the buffer between unpacking sessions.

*/

/**
  • Unpacks the data from the buffer between unpacking sessions.

*/

rawUnpackString()

C++ Interface: raw_unpack_string(const DCPacker self)

/**
  • Unpacks the data from the buffer between unpacking sessions.

*/

/**
  • Unpacks the data from the buffer between unpacking sessions.

*/

rawUnpackUint16()

C++ Interface: raw_unpack_uint16(const DCPacker self)

/**
  • Unpacks the data from the buffer between unpacking sessions.

*/

/**
  • Unpacks the data from the buffer between unpacking sessions.

*/

rawUnpackUint32()

C++ Interface: raw_unpack_uint32(const DCPacker self)

/**
  • Unpacks the data from the buffer between unpacking sessions.

*/

/**
  • Unpacks the data from the buffer between unpacking sessions.

*/

rawUnpackUint64()

C++ Interface: raw_unpack_uint64(const DCPacker self)

/**
  • Unpacks the data from the buffer between unpacking sessions.

*/

/**
  • Unpacks the data from the buffer between unpacking sessions.

*/

rawUnpackUint8()

C++ Interface: raw_unpack_uint8(const DCPacker self)

/**
  • Unpacks the data from the buffer between unpacking sessions.

*/

/**
  • Unpacks the data from the buffer between unpacking sessions.

*/

raw_pack_blob()

C++ Interface: raw_pack_blob(const DCPacker self, bytes value)

/**
  • Packs the data into the buffer between packing sessions.

*/

raw_pack_float64()

C++ Interface: raw_pack_float64(const DCPacker self, double value)

/**
  • Packs the data into the buffer between packing sessions.

*/

raw_pack_int16()

C++ Interface: raw_pack_int16(const DCPacker self, int value)

/**
  • Packs the data into the buffer between packing sessions.

*/

raw_pack_int32()

C++ Interface: raw_pack_int32(const DCPacker self, int value)

/**
  • Packs the data into the buffer between packing sessions.

*/

raw_pack_int64()

C++ Interface: raw_pack_int64(const DCPacker self, long value)

/**
  • Packs the data into the buffer between packing sessions.

*/

raw_pack_int8()

C++ Interface: raw_pack_int8(const DCPacker self, int value)

/**
  • Packs the data into the buffer between packing sessions.

*/

raw_pack_string()

C++ Interface: raw_pack_string(const DCPacker self, str value)

/**
  • Packs the data into the buffer between packing sessions.

*/

raw_pack_uint16()

C++ Interface: raw_pack_uint16(const DCPacker self, int value)

/**
  • Packs the data into the buffer between packing sessions.

*/

raw_pack_uint32()

C++ Interface: raw_pack_uint32(const DCPacker self, int value)

/**
  • Packs the data into the buffer between packing sessions.

*/

raw_pack_uint64()

C++ Interface: raw_pack_uint64(const DCPacker self, long value)

/**
  • Packs the data into the buffer between packing sessions.

*/

raw_pack_uint8()

C++ Interface: raw_pack_uint8(const DCPacker self, int value)

/**
  • Packs the data into the buffer between packing sessions.

*/

raw_unpack_blob()

C++ Interface: raw_unpack_blob(const DCPacker self)

/**
  • Unpacks the data from the buffer between unpacking sessions.

*/

/**
  • Unpacks the data from the buffer between unpacking sessions.

*/

raw_unpack_float64()

C++ Interface: raw_unpack_float64(const DCPacker self)

/**
  • Unpacks the data from the buffer between unpacking sessions.

*/

/**
  • Unpacks the data from the buffer between unpacking sessions.

*/

raw_unpack_int16()

C++ Interface: raw_unpack_int16(const DCPacker self)

/**
  • Unpacks the data from the buffer between unpacking sessions.

*/

/**
  • Unpacks the data from the buffer between unpacking sessions.

*/

raw_unpack_int32()

C++ Interface: raw_unpack_int32(const DCPacker self)

/**
  • Unpacks the data from the buffer between unpacking sessions.

*/

/**
  • Unpacks the data from the buffer between unpacking sessions.

*/

raw_unpack_int64()

C++ Interface: raw_unpack_int64(const DCPacker self)

/**
  • Unpacks the data from the buffer between unpacking sessions.

*/

/**
  • Unpacks the data from the buffer between unpacking sessions.

*/

raw_unpack_int8()

C++ Interface: raw_unpack_int8(const DCPacker self)

/**
  • Unpacks the data from the buffer between unpacking sessions.

*/

/**
  • Unpacks the data from the buffer between unpacking sessions.

*/

raw_unpack_string()

C++ Interface: raw_unpack_string(const DCPacker self)

/**
  • Unpacks the data from the buffer between unpacking sessions.

*/

/**
  • Unpacks the data from the buffer between unpacking sessions.

*/

raw_unpack_uint16()

C++ Interface: raw_unpack_uint16(const DCPacker self)

/**
  • Unpacks the data from the buffer between unpacking sessions.

*/

/**
  • Unpacks the data from the buffer between unpacking sessions.

*/

raw_unpack_uint32()

C++ Interface: raw_unpack_uint32(const DCPacker self)

/**
  • Unpacks the data from the buffer between unpacking sessions.

*/

/**
  • Unpacks the data from the buffer between unpacking sessions.

*/

raw_unpack_uint64()

C++ Interface: raw_unpack_uint64(const DCPacker self)

/**
  • Unpacks the data from the buffer between unpacking sessions.

*/

/**
  • Unpacks the data from the buffer between unpacking sessions.

*/

raw_unpack_uint8()

C++ Interface: raw_unpack_uint8(const DCPacker self)

/**
  • Unpacks the data from the buffer between unpacking sessions.

*/

/**
  • Unpacks the data from the buffer between unpacking sessions.

*/

seek()

C++ Interface: seek(const DCPacker self, str field_name) seek(const DCPacker self, int seek_index)

/**
  • Sets the current unpack (or repack) position to the named field. In unpack

  • mode, the next call to unpack_*() or push() will begin to read the named

  • field. In repack mode, the next call to pack_*() or push() will modify the

  • named field.

  • Returns true if successful, false if the field is not known (or if the

  • packer is in an invalid mode).

*/

/**
  • Seeks to the field indentified by seek_index, which was returned by an

  • earlier call to DCField::find_seek_index() to get the index of some nested

  • field. Also see the version of seek() that accepts a field name.

  • Returns true if successful, false if the field is not known (or if the

  • packer is in an invalid mode).

*/

setUnpackData()

C++ Interface: set_unpack_data(const DCPacker self, bytes data)

/**
  • Sets up the unpack_data pointer. You may call this before calling the

  • version of begin_unpack() that takes only one parameter.

*/

/**
  • Sets up the unpack_data pointer. You may call this before calling the

  • version of begin_unpack() that takes only one parameter.

*/

set_unpack_data()

C++ Interface: set_unpack_data(const DCPacker self, bytes data)

/**
  • Sets up the unpack_data pointer. You may call this before calling the

  • version of begin_unpack() that takes only one parameter.

*/

/**
  • Sets up the unpack_data pointer. You may call this before calling the

  • version of begin_unpack() that takes only one parameter.

*/

unpackAndFormat()

C++ Interface: unpack_and_format(const DCPacker self) unpack_and_format(const DCPacker self, ostream out, bool show_field_names) unpack_and_format(const DCPacker self, bool show_field_names)

/**
  • Unpacks an object and formats its value into a syntax suitable for parsing

  • in the dc file (e.g. as a default value), or as an input to parse_object.

*/

/**
  • Unpacks an object and formats its value into a syntax suitable for parsing

  • in the dc file (e.g. as a default value), or as an input to parse_object.

*/

unpackBlob()

C++ Interface: unpack_blob(const DCPacker self)

/**
  • Unpacks the current binary data value from the stream.

*/

/**
  • Unpacks the current numeric or string value from the stream.

*/

unpackDouble()

C++ Interface: unpack_double(const DCPacker self)

/**
  • Unpacks the current numeric or string value from the stream.

*/

/**
  • Unpacks the current numeric or string value from the stream.

*/

unpackInt()

C++ Interface: unpack_int(const DCPacker self)

/**
  • Unpacks the current numeric or string value from the stream.

*/

/**
  • Unpacks the current numeric or string value from the stream.

*/

unpackInt64()

C++ Interface: unpack_int64(const DCPacker self)

/**
  • Unpacks the current numeric or string value from the stream.

*/

/**
  • Unpacks the current numeric or string value from the stream.

*/

unpackLiteralValue()

C++ Interface: unpack_literal_value(const DCPacker self)

/**
  • Returns the literal string that represents the packed value of the current

  • field, and advances the field pointer.

*/

/**
  • Returns the literal string that represents the packed value of the current

  • field, and advances the field pointer.

*/

unpackObject()

C++ Interface: unpack_object(const DCPacker self)

unpackSkip()

C++ Interface: unpack_skip(const DCPacker self)

/**
  • Skips the current field without unpacking it and advances to the next

  • field. If the current field contains nested fields, skips all of them.

*/

unpackString()

C++ Interface: unpack_string(const DCPacker self)

/**
  • Unpacks the current numeric or string value from the stream.

*/

/**
  • Unpacks the current numeric or string value from the stream.

*/

unpackUint()

C++ Interface: unpack_uint(const DCPacker self)

/**
  • Unpacks the current numeric or string value from the stream.

*/

/**
  • Unpacks the current numeric or string value from the stream.

*/

unpackUint64()

C++ Interface: unpack_uint64(const DCPacker self)

/**
  • Unpacks the current numeric or string value from the stream.

*/

/**
  • Unpacks the current numeric or string value from the stream.

*/

unpackValidate()

C++ Interface: unpack_validate(const DCPacker self)

/**
  • Internally unpacks the current numeric or string value and validates it

  • against the type range limits, but does not return the value. If the

  • current field contains nested fields, validates all of them.

*/

unpack_and_format()

C++ Interface: unpack_and_format(const DCPacker self) unpack_and_format(const DCPacker self, ostream out, bool show_field_names) unpack_and_format(const DCPacker self, bool show_field_names)

/**
  • Unpacks an object and formats its value into a syntax suitable for parsing

  • in the dc file (e.g. as a default value), or as an input to parse_object.

*/

/**
  • Unpacks an object and formats its value into a syntax suitable for parsing

  • in the dc file (e.g. as a default value), or as an input to parse_object.

*/

unpack_blob()

C++ Interface: unpack_blob(const DCPacker self)

/**
  • Unpacks the current binary data value from the stream.

*/

/**
  • Unpacks the current numeric or string value from the stream.

*/

unpack_double()

C++ Interface: unpack_double(const DCPacker self)

/**
  • Unpacks the current numeric or string value from the stream.

*/

/**
  • Unpacks the current numeric or string value from the stream.

*/

unpack_int()

C++ Interface: unpack_int(const DCPacker self)

/**
  • Unpacks the current numeric or string value from the stream.

*/

/**
  • Unpacks the current numeric or string value from the stream.

*/

unpack_int64()

C++ Interface: unpack_int64(const DCPacker self)

/**
  • Unpacks the current numeric or string value from the stream.

*/

/**
  • Unpacks the current numeric or string value from the stream.

*/

unpack_literal_value()

C++ Interface: unpack_literal_value(const DCPacker self)

/**
  • Returns the literal string that represents the packed value of the current

  • field, and advances the field pointer.

*/

/**
  • Returns the literal string that represents the packed value of the current

  • field, and advances the field pointer.

*/

unpack_object()

C++ Interface: unpack_object(const DCPacker self)

unpack_skip()

C++ Interface: unpack_skip(const DCPacker self)

/**
  • Skips the current field without unpacking it and advances to the next

  • field. If the current field contains nested fields, skips all of them.

*/

unpack_string()

C++ Interface: unpack_string(const DCPacker self)

/**
  • Unpacks the current numeric or string value from the stream.

*/

/**
  • Unpacks the current numeric or string value from the stream.

*/

unpack_uint()

C++ Interface: unpack_uint(const DCPacker self)

/**
  • Unpacks the current numeric or string value from the stream.

*/

/**
  • Unpacks the current numeric or string value from the stream.

*/

unpack_uint64()

C++ Interface: unpack_uint64(const DCPacker self)

/**
  • Unpacks the current numeric or string value from the stream.

*/

/**
  • Unpacks the current numeric or string value from the stream.

*/

unpack_validate()

C++ Interface: unpack_validate(const DCPacker self)

/**
  • Internally unpacks the current numeric or string value and validates it

  • against the type range limits, but does not return the value. If the

  • current field contains nested fields, validates all of them.

*/