The interface description of the COSTA pack component. More...
#include "cta_system.h"
#include "cta_handles.h"
#include "cta_datatypes.h"
Go to the source code of this file.
Defines | |
#define | CTA_PACK_RESET (-1) |
Typedefs | |
typedef CTA_Handle | CTA_Pack |
Functions | |
CTAEXPORT int | CTA_Pack_Create (int initsize, CTA_Pack *hpack) |
Create a pack instance. | |
CTAEXPORT int | CTA_Pack_Free (CTA_Pack *hpack) |
Free a pack instance. | |
CTAEXPORT int | CTA_Pack_Add (CTA_Pack hpack, void *data, int lendat) |
Add data to pack object. | |
CTAEXPORT int | CTA_Pack_Get (CTA_Pack hpack, void *data, int lendat) |
Unpack (get) data from pack object. | |
CTAEXPORT char * | CTA_Pack_GetPtr (CTA_Pack hpack) |
Get pointer to pack-buffer. | |
CTAEXPORT int | CTA_Pack_GetLen (CTA_Pack hpack) |
Get length of packed data in pack-buffer. | |
CTAEXPORT int | CTA_Pack_AddCnt (CTA_Pack hpack, int lendat) |
Only update administration for added elements. | |
CTAEXPORT int | CTA_Pack_GetIndx (CTA_Pack hpack, int *ip1, int *ip2) |
Get the internal pack and unpack pointers. | |
CTAEXPORT int | CTA_Pack_SetIndx (CTA_Pack hpack, int ip1, int ip2) |
Set the internal pack and unpack pointers. |
The interface description of the COSTA pack component.
The pack component is used for storing non-sequential data before it is saved to file communicated in a parallel environment. The pack component contains a memory buffer that can be filled with data. The size of the buffer is automatically increased when new data is added.
The pack component uses the FIFO princeple. Data that is added first can be retreved first.
Definition in file cta_pack.h.
#define CTA_PACK_RESET (-1) |
Reset pack/unpack pointer of pack object
Definition at line 43 of file cta_pack.h.
typedef CTA_Handle CTA_Pack |
Definition at line 40 of file cta_pack.h.
CTAEXPORT int CTA_Pack_Add | ( | CTA_Pack | hpack, | |
void * | data, | |||
int | lendat | |||
) |
Add data to pack object.
hpack | IO handle of pack object | |
data | I data that must be packed | |
lendat | I size of the data to be packed (chars) |
CTAEXPORT int CTA_Pack_AddCnt | ( | CTA_Pack | hpack, | |
int | lendat | |||
) |
Only update administration for added elements.
This function can be used to update the administration after the pack-buffer is filled externally (e.g. using an mpi_recv)
hpack | I handle of pack object | |
lendat | I number of added elements (chars) |
CTAEXPORT int CTA_Pack_Create | ( | int | initsize, | |
CTA_Pack * | hpack | |||
) |
Create a pack instance.
initsize | I the initial size >=0 of the buffer | |
hpack | O receives handle of new pack object |
CTAEXPORT int CTA_Pack_Free | ( | CTA_Pack * | hpack | ) |
Free a pack instance.
hpack | IO handle of pack object, replaced by CTA_NULL on return |
CTAEXPORT int CTA_Pack_Get | ( | CTA_Pack | hpack, | |
void * | data, | |||
int | lendat | |||
) |
Unpack (get) data from pack object.
hpack | IO handle of pack object | |
data | O buffer that receives data that is unpacked from pack-buffer (buffer length must be >= lendat) | |
lendat | I size of the data to be unpacked (chars) |
CTAEXPORT int CTA_Pack_GetIndx | ( | CTA_Pack | hpack, | |
int * | ip1, | |||
int * | ip2 | |||
) |
Get the internal pack and unpack pointers.
This function can be used to save to pointers and reset the state of the pack component after unpacking or adding some data
hpack | I handle of pack object | |
ip1 | O unpack pointer | |
ip2 | O pack pointer |
CTAEXPORT int CTA_Pack_GetLen | ( | CTA_Pack | hpack | ) |
Get length of packed data in pack-buffer.
hpack | I handle of pack object |
CTAEXPORT char* CTA_Pack_GetPtr | ( | CTA_Pack | hpack | ) |
Get pointer to pack-buffer.
hpack | I handle of pack object |
CTAEXPORT int CTA_Pack_SetIndx | ( | CTA_Pack | hpack, | |
int | ip1, | |||
int | ip2 | |||
) |
Set the internal pack and unpack pointers.
This function can be used to restore the pointers and reset the state of the pack component after unpacking or adding some data
hpack | I handle of pack object | |
ip1 | I unpack pointer. In order to reset all unpackin set to CTA_PACK_RESET | |
ip2 | I pack pointer. In order to reset the whole pack object set to CTA_PACK_RESET |