GridLab
Grid Application Toolkit

A simple API for Grid Applications
GAT

Menu



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

GATPipe.h

Go to the documentation of this file.
00001 /** @file GATPipe.h
00002  * Header file for the GATPipe class.
00003  * 
00004  * An GATPipe represents a connection to another process.
00005  * 
00006  * @date $Date: 2004/03/24 19:30:58 $
00007  * 
00008  * @version $Header: /export/cvs-gridlab/wp-1/Codes/GATEngine/C-reference/src/GATPipe.h,v 1.8 2004/03/24 19:30:58 hartmutkaiser Exp $
00009  *
00010  *  Copyright (C) Kelly Davis
00011  *  This file is part of the GAT Engine.
00012  *  Contributed by Kelly Davis <kdavis@aei.mpg.de>.
00013  *
00014  *  Use, modification and distribution is subject to the Gridlab Software
00015  *  License. (See accompanying file GLlicense.txt or copy at
00016  *  http://www.gridlab.org/GLlicense.txt)
00017  */
00018  
00019 #ifndef _GATPIPE_H_
00020 #define _GATPIPE_H_ 1
00021 
00022 #include "GATType.h"
00023 #include "GATObject.h"
00024 
00025 #ifdef __cplusplus
00026 extern "C" {
00027 #endif
00028 
00029 /* Declare the converters to/from GATObject */
00030 GATOBJECT_DECLARE_CONVERTERS(GATPipe);
00031 
00032 /* GATObject API */
00033 
00034 /** GATPipe_Destroy
00035  *  The GATPipe destructor.
00036  *  This is the destructor for GATPipe objects.
00037  *
00038  * @param this An old GATPipe
00039  */
00040 void GATPipe_Destroy(GATPipe *peep);
00041 
00042 /** int GATPipe_GetType(GATPipe_const peep)
00043  *  @brief Return the type of the GATPipe
00044  *
00045  *  The function @c GATPipe_GetType always returns GATType_GATPipe. 
00046  *
00047  *  @param object The object to inspect
00048  *
00049  *  @return returns always @c #GATType_GATPipe.
00050  */
00051 GATType GATPipe_GetType(GATPipe_const peep);
00052 
00053 /** int GATPipe_Clone(GATPipe_const peep, GATPipe *new_peep)
00054  *  @brief Clone the given GATPipe
00055  *
00056  *  The function @c GATPipe_Clone generates a (deep) copy of the given
00057  *  GATPipe. 
00058  *
00059  *  @param peep The object to clone
00060  *  @param new_peep The pointer, through which the result is to be 
00061  *        returned.
00062  *
00063  *  @return An error type.
00064  */
00065 GATResult GATPipe_Clone(GATPipe_const peep, GATPipe *new_peep);
00066 
00067 /** int GATPipe_Equals(GATPipe_const lhs, GATPipe_const rhs, GATBool *isequal)
00068  *  @brief Compares two GATPipe objects
00069  *
00070  *  The function @c GATPipe_Equals compares two peep objects of type 
00071  *  @c #GATPipe.
00072  *
00073  *  @param lhs The first peep object to compare
00074  *  @param rhs The second peep object to compare
00075  *  @param isequal The pointer to the GATBool variable, which should receive 
00076  *        the result if the comparision
00077  *
00078  *  @return An error code.
00079  */
00080 GATResult 
00081 GATPipe_Equals(GATPipe_const lhs, GATPipe_const rhs, GATBool *isequal);
00082 
00083 /** int GATPipe_GetInterface(GATPipe_const peep, GATInterface iftype, void const **ifp)
00084  *  @brief Get an interface supported by a GATPipe
00085  *
00086  *  The function GATPipe_GetInterface allows to get a pointer to an 
00087  *  additional interface supported by this GATPipe.
00088  *
00089  *  @param object The object to be asked for the new interface.
00090  *  @param iftype The interface the object is to be asked for.
00091  *  @param ifp The pointer, through which the result is to be returned.
00092  *
00093  *  @return An error type.
00094  */
00095 GATResult 
00096 GATPipe_GetInterface(GATPipe_const peep, GATInterface iftype, void const **ifp);
00097 
00098 
00099 /* GATPipe API */
00100 
00101 /** GATPipe_Create
00102  *  Constructs an instance of this class.
00103  *
00104  * @param context Used to broker resources.
00105  * @param preferences User preferences for this instance.
00106  * @param information Other information required to construct a GATPipe.
00107  */
00108 GATPipe 
00109 GATPipe_Create(GATContext context, GATPreferences_const preferences, 
00110   void *information);
00111 
00112 /* GATMonitorable API */
00113 
00114 /** GATPipe_AddMetricListener
00115  *
00116  *  The function GATPipe_AddMetricListener adds the passed instance of a 
00117  *  GATMetricListener to the list of GATMetricListeners which are notified of 
00118  *  fired GATMetricEvents of the type described by the provided GATMetric 
00119  *  instance.
00120  *
00121  *  @param peep The GATPipe instance to add the GATMetricListener to.
00122  *  @param listener The GTAMetricListener to call, when the corresponding 
00123  *        GATMetricEvent is fired.
00124  *  @param listener_data The client supplied data, which will be passed through
00125  *        to the GATMetricListener.
00126  *  @param metric The GATMetric instance describing the GATMetricEvent to pass
00127  *        to the GATMetricListener.
00128  *  @param cookie The returned value should be used to remove the 
00129  *        GATMetricListener from this GATMonitorable.
00130  *
00131  *  @return An error code.
00132  */ 
00133 GATResult GATPipe_AddMetricListener(GATPipe peep, GATMetricListener listener,
00134   void *listener_data, GATMetric metric, GATuint32 *cookie);
00135 
00136 /** GATPipe_RegisterPolling
00137  *
00138  *  The function GATPipe_RegisterPolling registers a continuous 
00139  *  metric with the given GATPipe instance.
00140  *
00141  *  @param peep The GATPipe instance to register the metric with.
00142  *  @param metric The GATMetric instance describing the GATMetricEvent to pass
00143  *        to the GATMetricListener. This metric instance must be of type
00144  *        GATMeasurementType_Continuous, otherwise an error is returned.
00145  *  @param event The pointer to a variable, which should receive the resulting
00146  *        GATMetricEvent. The GATMetricEvent instance should be freed by the 
00147  *        caller when it isn't used anymore.
00148  *  @param cookie The returned value should be used to remove the 
00149  *        GATMetricListener from this GATPipe.
00150  *
00151  *  @return An error code.
00152  */ 
00153 GATResult 
00154   GATPipe_RegisterPolling(GATPipe peep, GATMetric metric, 
00155     GATMetricEvent *event, GATuint32 *cookie);
00156 
00157 /** GATPipe_RemoveRegisteredMetric
00158  *
00159  *  The function GATPipe_RemoveRegisteredMetric removes a GATMetricListener, 
00160  *  which was previously registered with GATPipe_AddMetricListener.
00161  *
00162  *  @param peep The GATPipe instance to remove the GATMetricListener from.
00163  *  @param metric The GATMetric instance describing the GATMetricEvent to pass
00164  *        to the GATMetricListener.
00165  *  @param cookie This value identifies the GATMetricListener to remove, it 
00166  *        was returned from the corresponding GATMonitorable_AddMetricListener 
00167  *        or GATMonitorable_MetricRegisterPolling functions.
00168  *  
00169  *  @return An error code.
00170  */
00171 GATResult GATPipe_RemoveRegisteredMetric(GATPipe peep, GATMetric metric, 
00172   GATuint32 cookie);
00173 
00174 /** GATPipe_GetMetrics
00175  *
00176  *  The function GATPipe_GetMetrics returns a list of metrics supported by this
00177  *  GATPipe.
00178  *
00179  *  @param peep The GATPipe instance, for which the supported metrics should be 
00180  *        returned.
00181  *  @param metrics The pointer to the variable, which receives the resulting 
00182  *        list of metrics.
00183  *
00184  *  @return An error code.
00185  */
00186 GATResult GATPipe_GetMetrics(GATPipe_const peep, GATList_GATMetric *metrics);
00187 
00188 
00189 /* IStreamable implementation */
00190 
00191 /* Reads from this GATStreamable into the given buffer */
00192 GATResult GATPipe_Read(GATPipe object, void *buffer, GATuint32 size, GATuint32 *read_bytes);
00193 
00194 /* Writes data from the given Buffer through the GATStreamable */
00195 GATResult GATPipe_Write(GATPipe object, void const *buffer, GATuint32 size, GATuint32 *written_bytes);
00196 
00197 /* reposition the internal stream position */
00198 GATResult GATPipe_Seek(GATPipe object, GATOrigin origin, GATint32 offset, GATuint32 *new_position);
00199     
00200 /* Closes this GATStreamable instance. */
00201 GATResult GATPipe_Close(GATPipe object);
00202 
00203 
00204 #ifdef __cplusplus
00205 }
00206 #endif
00207 
00208 #endif /* _GATPIPE_H_ */
00209