Bonobo API Reference Manual
<<< Previous Page | Home | Up | Next Page >>>

# BonoboStream

## Name

BonoboStream -- Abstract object for file (stream) access.

## Synopsis

    #define     BONOBO_IO_DRIVER_FS
    #define     BONOBO_IO_DRIVER_EFS
    #define     BONOBO_IO_DRIVER_VFS
    typedef     BonoboStream;
    typedef     BonoboStreamClass;
    POA_Bonobo_Stream__epv* bonobo_stream_get_epv
                                                (void);
    Bonobo_Stream bonobo_stream_corba_object_create
                                                (BonoboObject *object);
    BonoboStream* bonobo_stream_open            (const char *driver,
                                                 const char *path,
                                                 gint flags,
                                                 gint mode);
    BonoboStream* bonobo_stream_open_full       (const char *driver,
                                                 const char *path,
                                                 gint flags,
                                                 gint mode,
                                                 CORBA_Environment *opt_ev);

## Description

This is an abstract class for the various Stream implementations in Bonobo. There are at least: file based streams, memory based streams and structured storage streams. The BonoboStream abstract class can be used to implement new servers that implement the IDL:Bonobo/Stream:1.0 interface.

If you are writing a component, this is one interface that your component should not really support. You probably want to implement the a BonoboPersist interface such as BonoboPersistStream. This allows a component to serialize itself and de-persist itself using a stream supplied by a container.

If you are implementing a stream you probably want to see some of the helpful wrappers first.

## Details

### BONOBO_IO_DRIVER_FS

    #define BONOBO_IO_DRIVER_FS  "fs"

### BONOBO_IO_DRIVER_EFS

    #define BONOBO_IO_DRIVER_EFS "efs"

### BONOBO_IO_DRIVER_VFS

    #define BONOBO_IO_DRIVER_VFS "vfs"

### BonoboStream

    typedef struct {
            BonoboObject object;
    } BonoboStream;

### BonoboStreamClass

    typedef struct {
    	BonoboObjectClass parent_class;

    	/*
    	 * virtual methods
    	 */

    	Bonobo_StorageInfo *(*get_info) (BonoboStream *stream,
    					 const Bonobo_StorageInfoFields mask,
    					 CORBA_Environment *ev);
    	void          (*set_info)       (BonoboStream *stream,
    					 const Bonobo_StorageInfo *info,
    					 const Bonobo_StorageInfoFields mask,
    					 CORBA_Environment *ev);
    	void          (*write)          (BonoboStream *stream,
    					 const Bonobo_Stream_iobuf *buffer,
    					 CORBA_Environment *ev);
    	void          (*read)           (BonoboStream *stream,
    					 CORBA_long count,
    					 Bonobo_Stream_iobuf **buffer,
    					 CORBA_Environment *ev);
            CORBA_long    (*seek)           (BonoboStream *stream,
    					 CORBA_long offset,
    					 Bonobo_Stream_SeekType whence,
    					 CORBA_Environment *ev);
            void          (*truncate)       (BonoboStream *stream,
    					 const CORBA_long new_size,
    					 CORBA_Environment *ev);
    	void          (*copy_to)        (BonoboStream *stream,
    					 const CORBA_char * dest,
    					 const CORBA_long bytes,
    					 CORBA_long *read,
    					 CORBA_long *written,
    					 CORBA_Environment *ev);
            void          (*commit)         (BonoboStream *stream,
    					 CORBA_Environment *ev);
            void          (*revert)         (BonoboStream *stream,
    					 CORBA_Environment *ev);
    } BonoboStreamClass;

### bonobo_stream_get_epv ()

    POA_Bonobo_Stream__epv* bonobo_stream_get_epv
                                                (void);

Returns : |

### bonobo_stream_corba_object_create ()

    Bonobo_Stream bonobo_stream_corba_object_create
                                                (BonoboObject *object);

Creates and activates the CORBA object that is wrapped by the `object` BonoboObject.

`object` : | the GtkObject that will wrap the CORBA object
Returns : | An activated object reference to the created object or `CORBA_OBJECT_NIL` in case of failure.

### bonobo_stream_open ()

    BonoboStream* bonobo_stream_open            (const char *driver,
                                                 const char *path,
                                                 gint flags,
                                                 gint mode);

Opens or creates the file named at `path` with the stream driver `driver`.

`driver` is one of: "fs" or "vfs" for now.

`driver` : | driver to use for opening.
`path` : | path where the base file resides
`flags` : | Bonobo Storage OpenMode
`mode` : | Unix open(2) mode
Returns : | a created BonoboStream object.

### bonobo_stream_open_full ()

    BonoboStream* bonobo_stream_open_full       (const char *driver,
                                                 const char *path,
                                                 gint flags,
                                                 gint mode,
                                                 CORBA_Environment *opt_ev);

`driver` : |
`path` : |
`flags` : |
`mode` : |
`opt_ev` : |
Returns : |

## See Also

bonobo-stream-client, BonoboPersistStream, BonoboPersist, BonoboStreamFile, BonoboStreamMem

<<< Previous Page | Home | Up | Next Page >>>
bonobo-storage | BonoboStreamMem