4. Packing and Unpacking#
-
PyObject *CpTypeOf(PyObject *value)#
-
PyObject *CpTypeOf_Field(CpFieldObject *field)#
-
PyObject *CpTypeOf_Common(PyObject *op)#
- Return value: New reference.
Returns the type of the given atom object.
-
PyObject *CpSizeOf(PyObject *atom, PyObject *globals)#
- Return value: New reference.
Returns the size of the given atom object.
-
int CpPack(PyObject *op, PyObject *atom, PyObject *io, PyObject *globals)#
Packs the given value using the given atom object and returns :code::0 if successful. Returns
-1
if an error occurs. The globals parameter may be NULL.
-
int _CpPack_EvalLength(CpLayerObject *layer, PyObject *length, Py_ssize_t size, bool *seq_greedy, Py_ssize_t *seq_length)#
Evaluates the length of the sequence to pack.
This funtion can be utilized to evaluate the length of the sequence to pack. It uses the
size
parameter to validate the input sequence. Although, thesize
parameter is not mandatory, it is recommended - a value of-1
will disable the check mentioned before.- Parameters:
layer – the current layer that is marked as sequential
size – the size of the input sequence to pack (might be -1, see above)
seq_greedy – destination pointer to store the result whether the sequence should be parsed greedily
seq_length – destination pointer to store the length of the sequence
- Returns:
0
if successful,-1
if an error occurs
-
PyObject *CpUnpack(PyObject *atom, PyObject *io, PyObject *globals)#
- Return value: New reference.
TODO