GridLab
Grid Application Toolkit

A simple API for Grid Applications
GAT

Menu



Main Page   Alphabetical List   Compound List   File List   Compound Members   File Members  

GATMemoryStream.h

Go to the documentation of this file.
00001 /** @file GATMemoryStream.h
00002  *  Header file for the GATMemoryStream class.
00003  *
00004  *  @date Wed Oct 29 2003
00005  *
00006  *  @version $Header: /export/cvs-gridlab/wp-1/Codes/GATEngine/C-reference/src/GATMemoryStream.h,v 1.7 2004/03/24 19:30:58 hartmutkaiser Exp $
00007  *
00008  *  Copyright (C) Hartmut Kaiser
00009  *  This file is part of the GAT Engine.
00010  *  Contributed by Hartmut Kaiser <hartmutkaiser [at] t-online [dot] de>.
00011  *
00012  *  Use, modification and distribution is subject to the Gridlab Software
00013  *  License. (See accompanying file GLlicense.txt or copy at
00014  *  http://www.gridlab.org/GLlicense.txt)
00015  */
00016  
00017 #if !defined(_GATMemoryStream_H_)
00018 #define  _GATMemoryStream_H_
00019 
00020 /* GAT Header Files */
00021 #include "GATObject.h"
00022 #include "GATType.h"
00023 
00024 /* Structures, unions and enums */
00025 
00026 #ifdef __cplusplus
00027 extern "C" {
00028 #endif
00029 
00030 /* Declare the converters to/from GATObject */
00031 GATOBJECT_DECLARE_CONVERTERS(GATMemoryStream);
00032 
00033 /* Create and initialize a new GATMemoryStream instance */
00034 GATMemoryStream 
00035   GATMemoryStream_Create(void *initial_buffer, GATuint32 initial_size,
00036     GATBool takeover_ownership);
00037 
00038 /* Access the internal buffer of this stream object */
00039 void *
00040   GATMemoryStream_GetBuffer(GATMemoryStream object,
00041     GATuint32 *buffer_size, GATBool lend_ownership);
00042   
00043 /* GATObject implementation */
00044 /* Delete an existing GATMemoryStream object */
00045 void
00046   GATMemoryStream_Destroy(GATMemoryStream *object);
00047 
00048 /* Compare two GATMemoryStream objects */
00049 GATResult
00050   GATMemoryStream_Equals(GATMemoryStream_const lhs,
00051     GATMemoryStream_const rhs, GATBool *isequal);
00052 
00053 /* Clone a GATMemoryStream object */
00054 GATResult
00055   GATMemoryStream_Clone(GATMemoryStream_const object, 
00056     GATMemoryStream *new_object);
00057 
00058 /* Return the type of a GATMemoryStream object */
00059 GATType
00060   GATMemoryStream_GetType(GATMemoryStream_const object);
00061 
00062 /* return one of the implemented interfaces */
00063 GATResult 
00064   GATMemoryStream_GetInterface(GATMemoryStream_const file, 
00065     GATInterface iftype, void const **ifp);
00066 
00067 /* IStreamable implementation */
00068 /* Reads from this GATStreamable into the given buffer */
00069 GATResult
00070   GATMemoryStream_Read(GATMemoryStream object, void *buffer, 
00071     GATuint32 size, GATuint32 *read_bytes);
00072 
00073 /* Writes data from the given Buffer through the GATStreamable */
00074 GATResult
00075   GATMemoryStream_Write(GATMemoryStream object, void const *buffer, 
00076     GATuint32 size, GATuint32 *written_bytes);
00077 
00078 /* reposition the internal stream position */
00079 GATResult
00080   GATMemoryStream_Seek(GATMemoryStream object, GATOrigin origin,
00081     GATint32 offset, GATuint32 *new_position);
00082     
00083 /* Closes this GATStreamable instance. */
00084 GATResult
00085   GATMemoryStream_Close(GATMemoryStream object);
00086 
00087 #if 0
00088 /* Reads from this GATStreamable into the given Buffer, but returning 
00089    immediately */
00090 GATResult
00091   GATMemoryStream_IRead(GATMemoryStream object, void *buffer, 
00092     GATuint32 size);
00093 
00094 /* This finishes the current IRead call on this GATStreamable */
00095 GATResult
00096   GATMemoryStream_ReadFinish(GATMemoryStream object, GATBool *got_data,
00097     GATuint32 *got_bytes);
00098 
00099 /* This tests if data has been received in the current IRead */
00100 GATResult
00101   GATMemoryStream_ReadTest(GATMemoryStream object, GATBool *can_read);
00102 
00103 /* Writes data from the given Buffer through the GATStreamable, but returns 
00104    immediately */
00105 GATResult
00106   GATMemoryStream_IWrite(GATMemoryStream object, void const *buffer,  
00107     GATuint32 size);
00108   
00109 /* This finishes the current IWrite call on this GATStreamable */
00110 GATResult
00111   GATMemoryStream_WriteFinish(GATMemoryStream object, 
00112     GATuint32 *written_bytes);
00113 
00114 /* Tests if data has been sent from the current IWrite call on this 
00115    GATStreamable */
00116 GATResult
00117   GATMemoryStream_WriteTest(GATMemoryStream object, 
00118     GATuint32 *written_bytes);
00119 #endif /* 0 */
00120 
00121 #ifdef __cplusplus
00122 } /* extern "C" */
00123 #endif
00124 
00125 #endif /* !defined(_GATMemoryStream_H_) */