GridLab
Grid Application Toolkit

A simple API for Grid Applications
GAT

Menu



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

GATMonitorable.h

Go to the documentation of this file.
00001 /** @file GATMonitorable.h
00002  *  Header file for the GATMonitorable class.
00003  *
00004  *  This declaration of the GATMonitorable interface, which is meant as a 
00005  *  generic helper class, which may be used by other GATObjects to implement 
00006  *  its GATMonitorable interface.
00007  *
00008  *  The GATMonitorable_Impl class is essentially a table of lists, where the 
00009  *  GATMetric is used as the key type for the table and the list contains the
00010  *  GATMetricListener's for the GATMetric used as the key.
00011  *
00012  *  @date Mon Nov 3 2003
00013  *
00014  *  @version $Header: /export/cvs-gridlab/wp-1/Codes/GATEngine/C-reference/src/GATMonitorable.h,v 1.7 2004/03/24 19:30:58 hartmutkaiser Exp $
00015  *
00016  *  Copyright (C) Hartmut Kaiser
00017  *  This file is part of the GAT Engine.
00018  *  Contributed by Hartmut Kaiser <hartmutkaiser [at] t-online [dot] de>.
00019  *
00020  *  Use, modification and distribution is subject to the Gridlab Software
00021  *  License. (See accompanying file GLlicense.txt or copy at
00022  *  http://www.gridlab.org/GLlicense.txt)
00023  */
00024  
00025 #ifndef _GATMONITORABLE_H_
00026 #define _GATMONITORABLE_H_ 1
00027 
00028 #include "GATType.h"
00029 #include "GATList.h"
00030 
00031 /* typedefs */
00032 typedef struct GATMonitorable_Impl_S *GATMonitorable_Impl;
00033 typedef struct GATMonitorable_Impl_S const *GATMonitorable_Impl_const;
00034 
00035 #ifdef __cplusplus
00036 extern "C" {
00037 #endif
00038 
00039 /* Declare the converters to/from GATObject */
00040 GATOBJECT_DECLARE_CONVERTERS(GATMonitorable_Impl);
00041 
00042 /* Declare the GATList_GATMetric list. */
00043 GATLIST_DECLARE_QUALIFIED(extern, GATMetric, GATList_GATMetric);
00044 
00045 /** GATMonitorable_Impl_Create
00046  *
00047  *  Create a new instance of the GATMonitorable_Impl class.
00048  *
00049  *  @param metrics The list of metrics, which should be supported by this 
00050  *        instance of an GATMonitorable_Impl.
00051  *
00052  *  @return The newly constructed instance.
00053  */
00054 GATMonitorable_Impl GATMonitorable_Impl_Create(GATList_GATMetric metrics);
00055 
00056 /** GATMonitorable_Impl_Destroy
00057  *  The GATMonitorable_Impl destructor.
00058  *  This is the destructor for GATMonitorable_Impl objects.
00059  *
00060  * @param monitorable An old GATMonitorable_Impl
00061  */
00062 void GATMonitorable_Impl_Destroy(GATMonitorable_Impl *monitorable);
00063 
00064 /** int GATMonitorable_Impl_Equals(GATMonitorable_Impl_const lhs, GATMonitorable_Impl_const rhs, GATBool *isequal)
00065  *  @brief Compares two GATMonitorable_Impl objects
00066  *
00067  *  The function @c GATMonitorable_Impl_Equals compares two file objects of type 
00068  *  @c #GATMonitorable_Impl.
00069  *
00070  *  @param lhs The first file object to compare
00071  *  @param rhs The second file object to compare
00072  *  @param isequal The pointer to the GATBool variable, which should receive 
00073  *        the result if the comparision
00074  *
00075  *  @return An error code.
00076  */
00077 GATResult 
00078 GATMonitorable_Impl_Equals(GATMonitorable_Impl_const lhs, 
00079   GATMonitorable_Impl_const rhs, GATBool *isequal);
00080 
00081 /** int GATMonitorable_Impl_Clone(GATMonitorable_Impl_const filehandle, GATMonitorable_Impl *new_file)
00082  *  @brief Clone the given GATMonitorable_Impl
00083  *
00084  *  The function @c GATMonitorable_Impl_Clone generates a (deep) copy of the given
00085  *  GATMonitorable_Impl. 
00086  *
00087  *  @param filehandle The object to clone
00088  *  @param new_file The pointer, through which the result is to be 
00089  *        returned.
00090  *
00091  *  @return An error type.
00092  */
00093 GATResult 
00094 GATMonitorable_Impl_Clone(GATMonitorable_Impl_const monitorable, 
00095   GATMonitorable_Impl *new_object);
00096 
00097 /** GATMonitorable_Impl_AddMetricListener
00098  *
00099  *  The function GATMonitorable_Impl_AddMetricListener adds the passed instance 
00100  *  of a GATMetricListener to the list of GATMetricListeners which are notified 
00101  *  of fired GATMetricEvents of the type described by the provided GATMetric 
00102  *  instance.
00103  *
00104  *  @param monitorable The GATMonitorable instance to add the GATMetricListener
00105  *        to.
00106  *  @param listener The GATMetricListener to call, when the corresponding 
00107  *        GATMetricEvent is fired.
00108  *  @param listener_data The client supplied data, which will be passed through
00109  *        to the GATMetricListener.
00110  *  @param metric The GATMetric instance describing the GATMetricEvent to pass
00111  *        to the GATMetricListener. This metric instance must be of type
00112  *        GATMeasurementType_EventLike, otherwise an error is returned.
00113  *  @param cookie The returned value should be used to remove the 
00114  *        GATMetricListener from this GATMonitorable.
00115  *
00116  *  @return An error code.
00117  */ 
00118 GATResult 
00119   GATMonitorable_Impl_AddMetricListener(GATMonitorable_Impl monitorable,
00120     GATMetricListener listener, void *listener_data, GATMetric metric,
00121     GATuint32 *cookie);
00122 
00123 /** GATMonitorable_Impl_RegisterPolling
00124  *
00125  *  The function GATMonitorable_Impl_RegisterPolling registers a continuous 
00126  *  metric with the given GATMonitorable instance.
00127  *
00128  *  @param monitorable The GATMonitorable instance to register the metric
00129  *        with.
00130  *  @param metric The GATMetric instance describing the GATMetricEvent to pass
00131  *        to the GATMetricListener. This metric instance must be of type
00132  *        GATMeasurementType_Continuous, otherwise an error is returned.
00133  *  @param event The pointer to a variable, which should receive the resulting
00134  *        GATMetricEvent (this parameter is ignored for this function).
00135  *  @param cookie The returned value should be used to remove the 
00136  *        GATMetricListener from this GATMonitorable.
00137  *
00138  *  @return An error code.
00139  */ 
00140 GATResult 
00141   GATMonitorable_Impl_RegisterPolling(GATMonitorable_Impl monitorable,
00142     GATMetric metric, GATMetricEvent *event, GATuint32 *cookie);
00143 
00144 /** GATMonitorable_Impl_RemoveRegisteredMetric
00145  *
00146  *  The function GATMonitorable_Impl_RemoveRegisteredMetric removes a 
00147  *  GATMetricListener, which was previously registered with 
00148  *  GATMonitorable_AddMetricListener.
00149  *
00150  *  @param monitorable The GATMonitorable instance to remove the metric from.
00151  *  @param metric The GATMetric instance describing the GATMetricEvent to pass
00152  *        to the GATMetricListener.
00153  *  @param cookie This value identifies the GATMetricListener to remove, it 
00154  *        was returned from the corresponding GATMonitorable_AddMetricListener 
00155  *        or GATMonitorable_MetricRegisterPolling functions.
00156  *  
00157  *  @return An error code.
00158  */
00159 GATResult 
00160   GATMonitorable_Impl_RemoveRegisteredMetric(GATMonitorable_Impl monitorable,
00161     GATMetric metric, GATuint32 cookie);
00162 
00163 /** GATMonitorable_Impl_GetMetrics
00164  *
00165  *  The function GATMonitorable_Impl_GetMetrics returns a list of metrics supported 
00166  *  by this GATMonitorable.
00167  *
00168  *  @param monitorable The GATMonitorable instance, for which the supported 
00169  *        metrics should be returned.
00170  *  @param metrics The pointer to the variable, which receives the resulting 
00171  *        list of metrics.
00172  *
00173  *  @return An error code.
00174  */
00175 GATResult
00176   GATMonitorable_Impl_GetMetrics(GATMonitorable_Impl_const monitorable,
00177     GATList_GATMetric *metrics);
00178 
00179 /** GATMonitorable_Impl_FireEvent
00180  *
00181  *  The function GATMonitorable_Impl_FireEvent may be used by an adaptor to 
00182  *  raise a specific event.
00183  *
00184  *  @param monitorable The GATMonitorable instance, through which the given 
00185  *        metric event should be raised.
00186  *  @param metric Describes the type of the event to be raised.
00187  *  @param event The event to be raised. 
00188  *
00189  *  @return An error code.
00190  */
00191 GATResult 
00192   GATMonitorable_Impl_FireEvent(GATMonitorable_Impl_const monitorable,
00193     GATMetric metric, GATMetricEvent event);
00194     
00195 #ifdef __cplusplus
00196 }
00197 #endif
00198 
00199 #endif /* _GATMONITORABLE_H_ */