cta_pack.h File Reference

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.

Detailed Description

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 Documentation

#define CTA_PACK_RESET   (-1)

Reset pack/unpack pointer of pack object

Definition at line 43 of file cta_pack.h.


Typedef Documentation

Definition at line 40 of file cta_pack.h.


Function Documentation

CTAEXPORT int CTA_Pack_Add ( CTA_Pack  hpack,
void *  data,
int  lendat 
)

Add data to pack object.

Parameters:
hpack IO handle of pack object
data I data that must be packed
lendat I size of the data to be packed (chars)
Returns:
error status: CTA_OK if successful
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)

Parameters:
hpack I handle of pack object
lendat I number of added elements (chars)
Returns:
length packed data
CTAEXPORT int CTA_Pack_Create ( int  initsize,
CTA_Pack hpack 
)

Create a pack instance.

Parameters:
initsize I the initial size >=0 of the buffer
hpack O receives handle of new pack object
Returns:
error status: CTA_OK if successful
CTAEXPORT int CTA_Pack_Free ( CTA_Pack hpack  ) 

Free a pack instance.

Parameters:
hpack IO handle of pack object, replaced by CTA_NULL on return
Returns:
error status: CTA_OK if successful
CTAEXPORT int CTA_Pack_Get ( CTA_Pack  hpack,
void *  data,
int  lendat 
)

Unpack (get) data from pack object.

Parameters:
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)
Returns:
error status: CTA_OK if successful
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

Parameters:
hpack I handle of pack object
ip1 O unpack pointer
ip2 O pack pointer
Returns:
length packed data
CTAEXPORT int CTA_Pack_GetLen ( CTA_Pack  hpack  ) 

Get length of packed data in pack-buffer.

Parameters:
hpack I handle of pack object
Returns:
length packed data
CTAEXPORT char* CTA_Pack_GetPtr ( CTA_Pack  hpack  ) 

Get pointer to pack-buffer.

Parameters:
hpack I handle of pack object
Returns:
pointer to buffer
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

Parameters:
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
Returns:
length packed data

Generated on 4 Mar 2014 for OpenDA by  doxygen 1.6.1