All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Data Structures | Macros | Enumerations | Functions
as_stream.h File Reference
#include <aerospike/as_std.h>
#include <aerospike/as_util.h>
#include <aerospike/as_val.h>
+ Include dependency graph for as_stream.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  as_stream
 
struct  as_stream_hooks
 

Macros

#define AS_STREAM_END   ((void *) 0)
 

Enumerations

enum  as_stream_status { AS_STREAM_OK = 0, AS_STREAM_ERR = 1 }
 

Functions

static void as_stream_destroy (as_stream *stream)
 
AS_EXTERN void as_stream_free (void *ptr)
 
static as_streamas_stream_init (as_stream *stream, void *data, const as_stream_hooks *hooks)
 
AS_EXTERN void * as_stream_malloc (size_t size)
 
static as_streamas_stream_new (void *data, const as_stream_hooks *hooks)
 
static as_valas_stream_read (const as_stream *stream)
 
static bool as_stream_readable (const as_stream *stream)
 
static void * as_stream_source (const as_stream *stream)
 
static bool as_stream_writable (const as_stream *stream)
 
static as_stream_status as_stream_write (const as_stream *stream, as_val *value)
 

Macro Definition Documentation

#define AS_STREAM_END   ((void *) 0)

Definition at line 32 of file as_stream.h.

Enumeration Type Documentation

Stream Status Codes

Enumerator
AS_STREAM_OK 
AS_STREAM_ERR 

Definition at line 43 of file as_stream.h.

Function Documentation

static void as_stream_destroy ( as_stream stream)
inlinestatic

Destroy the as_stream and associated resources.

Parameters
streamThe stream to destroy.
Returns
0 on success, otherwise 1.

Definition at line 162 of file as_stream.h.

References as_stream_free(), as_util_hook, and as_stream::free.

AS_EXTERN void as_stream_free ( void *  ptr)
static as_stream * as_stream_init ( as_stream stream,
void *  data,
const as_stream_hooks hooks 
)
inlinestatic

Initializes a stack allocated as_stream for a given source and hooks.

Parameters
streamThe stream to initialize.
dataThe source feeding the stream
hooksThe hooks that interface with the source
Returns
On success, the initialized stream. Otherwise NULL.

Definition at line 122 of file as_stream.h.

References data, as_stream::data, as_stream::free, and as_stream::hooks.

AS_EXTERN void* as_stream_malloc ( size_t  size)

Wrapper functions to ensure each CF allocation-related function call has a unique line.

static as_stream * as_stream_new ( void *  data,
const as_stream_hooks hooks 
)
inlinestatic

Creates a new heap allocated as_stream for a given source and hooks.

Parameters
dataThe source feeding the stream
hooksThe hooks that interface with the source
Returns
On success, a new stream. Otherwise NULL.

Definition at line 142 of file as_stream.h.

References as_stream_malloc(), data, as_stream::data, as_stream::free, and as_stream::hooks.

static as_val * as_stream_read ( const as_stream stream)
inlinestatic

Reads a value from the stream

Parameters
streamThe stream to be read.
Returns
the element read from the stream or STREAM_END

Definition at line 197 of file as_stream.h.

References as_util_hook.

static bool as_stream_readable ( const as_stream stream)
inlinestatic

Is the stream readable? Tests whether the stream has a read function.

Parameters
streamThe stream to test.
Returns
true if the stream can be read from

Definition at line 211 of file as_stream.h.

References as_stream::hooks.

static void * as_stream_source ( const as_stream stream)
inlinestatic

Get the source for the stream

Parameters
streamThe stream to get the source from
Returns
pointer to the source of the stream

Definition at line 183 of file as_stream.h.

References as_stream::data.

static bool as_stream_writable ( const as_stream stream)
inlinestatic

Is the stream writable? Tests whether the stream has a write function.

Parameters
streamThe stream to test.
Returns
true if the stream can be written to.

Definition at line 241 of file as_stream.h.

References as_stream::hooks.

static as_stream_status as_stream_write ( const as_stream stream,
as_val value 
)
inlinestatic

Write a value to the stream

Parameters
streamThe stream to write to.
valueThe element to write to the stream.
Returns
AS_STREAM_OK on success, otherwise is failure.

Definition at line 226 of file as_stream.h.

References AS_STREAM_ERR, and as_util_hook.