MateComponentStreamMem

MateComponentStreamMem — In-memory implementation of MateComponent::Stream interface.

Synopsis

struct              MateComponentStreamMem;
                    MateComponentStreamMemClass;
MateComponentStreamMem * matecomponent_stream_mem_construct
                                                        (MateComponentStreamMem *stream_mem,
                                                         const char *buffer,
                                                         size_t size,
                                                         gboolean read_only,
                                                         gboolean resizable);
MateComponentObject * matecomponent_stream_mem_create   (const char *buffer,
                                                         size_t size,
                                                         gboolean read_only,
                                                         gboolean resizable);
const char *        matecomponent_stream_mem_get_buffer (MateComponentStreamMem *stream_mem);
size_t              matecomponent_stream_mem_get_size   (MateComponentStreamMem *stream_mem);

Object Hierarchy

  GObject
   +----MateComponentObject
         +----MateComponentStreamMem

Description

The MateComponentStreamMem is an implementation of the IDL:MateComponent/Stream:1.0 interface. This implementation allows an in-memory buffer to be exposed as a IDL:MateComponent/Stream:1.0 to clients.

Here is a sample way of exposing a C string as an IDL:MateComponent/Stream:1.0:

Example 22. Sample MateComponentStreamMem usage

1
2
3
4
MateComponentStream *make_matecomponent_stream_on_string (char *string)
{
    return matecomponent_stream_mem_create (string, strlen (string), TRUE, FALSE);
}


This example will make the string argument be exposed as a CORBA stream.

Details

struct MateComponentStreamMem

struct MateComponentStreamMem;


MateComponentStreamMemClass

typedef struct {
	MateComponentObjectClass parent_class;

	POA_MateComponent_Stream__epv epv;

	char           *(*get_buffer) (MateComponentStreamMem *stream_mem);
	size_t          (*get_size)   (MateComponentStreamMem *stream_mem);
} MateComponentStreamMemClass;


matecomponent_stream_mem_construct ()

MateComponentStreamMem * matecomponent_stream_mem_construct
                                                        (MateComponentStreamMem *stream_mem,
                                                         const char *buffer,
                                                         size_t size,
                                                         gboolean read_only,
                                                         gboolean resizable);


matecomponent_stream_mem_create ()

MateComponentObject * matecomponent_stream_mem_create   (const char *buffer,
                                                         size_t size,
                                                         gboolean read_only,
                                                         gboolean resizable);

Creates a new MateComponentStreamMem object.

If buffer is non-NULL, size bytes are copied from it into a new buffer. If buffer is NULL, a new buffer of size size is created and filled with zero bytes.

When data is read out of or (if read_only is FALSE) written into the returned MateComponentStream object, the read() and write() operations operate on the new buffer. If resizable is TRUE, writing or seeking past the end of the buffer will cause the buffer to be expanded (with the new space zero-filled for a seek).

buffer :

The data for which a MateComponentStreamMem object is to be created.

size :

The size in bytes of buffer.

read_only :

Specifies whether or not the returned MateComponentStreamMem object should allow write() operations.

resizable :

Whether or not the buffer should be resized as needed.

Returns :

the constructed MateComponentStream object

matecomponent_stream_mem_get_buffer ()

const char *        matecomponent_stream_mem_get_buffer (MateComponentStreamMem *stream_mem);

Returns the buffer associated with a MateComponentStreamMem. If the stream is set to automatically resize itself, this buffer is only guaranteed to stay valid until the next write operation on the stream.

stream_mem :

a MateComponentStreamMem

Returns :

a buffer containing the data written to the stream (or the data the stream was initialized with if nothing has been written).

matecomponent_stream_mem_get_size ()

size_t              matecomponent_stream_mem_get_size   (MateComponentStreamMem *stream_mem);

Returns the size of the data associated with a MateComponentStreamMem see matecomponent_stream_mem_get_buffer

stream_mem :

a MateComponentStreamMem

Returns :

the size.

See Also

MateComponentStream

An abstract class to implement IDL:MateComponent/Streams.

IDL:MateComponent/Stream:1.0

The CORBA interface implemented .