GridLab
Grid Application Toolkit

A simple API for Grid Applications
GAT

Menu



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

GATMetric.h

Go to the documentation of this file.
00001 /** @file GATMetric.h
00002  * Header file for the GATMetric class.
00003  * 
00004  * A GATMetric represents a measurable quantity within a monitoring system.
00005  * 
00006  * @date Wed Sep 23 2003
00007  * 
00008  * @version $Header: /export/cvs-gridlab/wp-1/Codes/GATEngine/C-reference/src/GATMetric.h,v 1.15 2004/03/24 19:30:58 hartmutkaiser Exp $
00009  *
00010  *  Copyright (C) Tom Goodale
00011  *  This file is part of the GAT Engine.
00012  *  Contributed by Tom Goodale <goodale@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 _GATMETRIC_H_
00020 #define _GATMETRIC_H_ 1
00021 
00022 /* GAT Header Files */
00023 #include "GATObject.h"
00024 #include "GATType.h"
00025 #include "GATMonitorable.h"
00026 
00027 /* typedefs */
00028 /* data types used to initialise a GATMetric from static data */
00029 typedef struct GATStaticParameter_S 
00030 {
00031   char const *key;                    /* name of this parameter */
00032   GATType type;                       /* type of this parameter */
00033   union {                             /* parameter data */
00034     GATint16 int16_data;      
00035     GATint32 int32_data;
00036     GATdouble64 double_data;
00037     GATfloat32 float_data;
00038     char const *string_data;
00039   } d;
00040 } GATStaticParameter;
00041 
00042 typedef struct GATStaticMetric_S 
00043 {
00044   char const *name;
00045   GATMeasurementType measurement_type;  /* metric measurement type */
00046   GATType data_type;                    /* metric data type */
00047   char const *unit;                     /* metric unit */
00048   GATuint32 parameter_count;            /* count of parameters */
00049   GATStaticParameter *parameters;       /* metric parameters */
00050 } GATStaticMetric;
00051 
00052 #ifdef __cplusplus
00053 extern "C" {
00054 #endif
00055 
00056 /* Declare the converters to/from GATObject */
00057 GATOBJECT_DECLARE_CONVERTERS(GATMetric);
00058 
00059  /** GATMetric_Create
00060  *  @brief Create a new GATMetric object.
00061  *
00062  *  The function @c GATMetric_Create creates a new GATMetric object.
00063  *
00064  *  @return Returns a handle to the newly created GATMetric object.
00065  *        Returns 0 (zero) if an error occurs.
00066  *
00067  *  @remark This is an internal function, do not use it directly.
00068  */
00069 GATMetric GATMetric_Create(char const *name, GATTable parameters,
00070   GATMeasurementType type, GATType datatype, char const *unit);
00071 
00072 /** int GATMetric_GetType(GATMetric_const file)
00073  *  @brief Return the type of the GATMetric
00074  *
00075  *  The function @c GATMetric_GetType always returns GATType_GATMetric. 
00076  *
00077  *  @param object The object to inspect
00078  *
00079  *  @return returns always @c #GATType_GATMetric.
00080  */
00081 GATType GATMetric_GetType(GATMetric_const table);
00082 
00083 /** GATMetric_Destroy
00084  *  The GATMetric destructor.
00085  *  This is the destructor for GATMetric objects.
00086  *
00087  * @param this An old GATMetric
00088  */
00089 void GATMetric_Destroy(GATMetric *metric);
00090 
00091 /** int GATMetric_Equals(GATMetric_const lhs, GATMetric_const rhs, GATBool *isequal)
00092  *  @brief Compares two GATMetric objects
00093  *
00094  *  The function @c GATMetric_Equals compares two file objects of type 
00095  *  @c #GATMetric.
00096  *
00097  *  @param lhs The first file object to compare
00098  *  @param rhs The second file object to compare
00099  *  @param isequal The pointer to the GATBool variable, which should receive 
00100  *        the result if the comparison
00101  *
00102  *  @return An error code.
00103  */
00104 GATResult 
00105   GATMetric_Equals(GATMetric_const lhs, GATMetric_const rhs, GATBool *isequal);
00106 
00107 /** int GATMetric_Clone(GATMetric_const filehandle, GATMetric *new_file)
00108  *  @brief Clone the given GATMetric
00109  *
00110  *  The function @c GATMetric_Clone generates a (deep) copy of the given
00111  *  GATMetric. 
00112  *
00113  *  @param filehandle The object to clone
00114  *  @param new_file The pointer, through which the result is to be 
00115  *        returned.
00116  *
00117  *  @return An error type.
00118  */
00119 GATResult 
00120   GATMetric_Clone(GATMetric_const metric, GATMetric *new_table);
00121 
00122 /** int GATMetric_GetInterface(GATMetric_const table, GATInterface iftype, void const **ifp)
00123  *  @brief Get an interface supported by a GATList
00124  *
00125  *  The function GATMetric_GetInterface allows to get a pointer to an 
00126  *  additional interface supported by this GATList.
00127  *
00128  *  @param object The object to be asked for the new interface.
00129  *  @param iftype The interface the object is to be asked for.
00130  *  @param ifp The pointer, through which the result is to be returned.
00131  *
00132  *  @return An error type.
00133  */
00134 GATResult 
00135   GATMetric_GetInterface(GATMetric_const table, GATInterface iftype, 
00136     void const **ifp);
00137 
00138 /* GATMetric API functions */
00139 
00140 /** GATMetric_GetName
00141  *
00142  *  The function GATMetric_GetName gets the name associated with this 
00143  *  GATMetric.
00144  *
00145  *  @param metric The metric to ask for its name.
00146  *
00147  *  @return The name associated with this metric.
00148  */
00149 char const *
00150   GATMetric_GetName(GATMetric_const metric);
00151 
00152 /** GATMetric_GetUnit
00153  *
00154  *  The function GATMetric_GetUnit gets the measurement unit 
00155  *  associated with this GATMetric.
00156  *
00157  *  @param metric The metric to ask for its measurement unit.
00158  *
00159  *  @return The unit associated with this metric.
00160  */
00161 char const *
00162   GATMetric_GetUnit(GATMetric_const metric);
00163 
00164 /** GATMetric_GetValueType
00165  *
00166  *  The function GATMetric_GetValueType gets the data type of the value 
00167  *  provided by this GATMetric.
00168  *
00169  *  @param metric The metric to ask for its data value type.
00170  *
00171  *  @return The data value type associated with this metric.
00172  */
00173 GATType
00174   GATMetric_GetValueType(GATMetric_const metric);
00175 
00176 /** GATMetric_GetParameters
00177  *
00178  *  The function GATMetric_GetParameters gets the GATMetric parameter 
00179  *  value associated with the passed GATMetric parameter name. Ther is returned 
00180  *  a 0 (zero) if there is no GATMetric parameter value with the passed name.
00181  *
00182  *  @param metric The metric to ask for its name.
00183  *  @param table The pointer to a variable, which receives the returned 
00184  *        parameter table.
00185  *
00186  *  @return An error code.
00187  */
00188 GATResult 
00189   GATMetric_GetParameters(GATMetric_const metric, GATTable *table);
00190 
00191 /** GATMetric_GetParameterTypeByName
00192  *
00193  *  The function GATMetric_GetParameterTypeByName gets the type of the 
00194  *  GATMetric parameter value associated with the passed GATMetric parameter 
00195  *  name. 
00196  *
00197  *  @param metric The metric to ask for its name.
00198  *  @param name The name of the parameter to query for.
00199  *
00200  *  @return The type of the associated value.
00201  */
00202 GATType
00203   GATMetric_GetParameterTypeByName(GATMetric_const metric, 
00204     char const *name);
00205 
00206 /** GATMetric_GetParameterByName
00207  *
00208  *  The function GATMetric_GetParameterByName gets the GATMetric 
00209  *  parameter value associated with the passed GATMetric parameter name. There 
00210  *  is returned a 0 (zero) if there is no GATMetric parameter value with the 
00211  *  passed name.
00212  *
00213  *  @param metric The metric to ask for its name.
00214  *  @param name The name of the parameter to query for.
00215  *  @param type The expected type of the value to be returned.
00216  *  @param buffer The buffer, where the retrieved value should be returned to.
00217  *  @param size The size of the buffer.
00218  *
00219  *  @return An error code.
00220  */
00221 GATResult
00222   GATMetric_GetParameterByName(GATMetric_const metric, char const *name,
00223     GATType type, void *buffer, GATuint32 size);
00224 
00225 /** GATMetric_CreateMetric
00226  *
00227  *  The function GATMetric_CreateMetric creates a GATMetric object from a given 
00228  *  static metric data. This is a pure helper function for adaptor writers.
00229  *
00230  *  @param data The address of the static metric data.
00231  *  @param metric The pointer to the variable, which receives the resulting 
00232  *        metric.
00233  *
00234  *  @return An error code.
00235  */
00236 GATResult
00237   GATMetric_CreateMetric(GATStaticMetric const *data, GATMetric *metric);
00238 
00239 /** GATMetric_CreateListOfMetrics
00240  *
00241  *  The function GATMetric_CreateListOfMetrics creates a list of GATMetric 
00242  *  objects from a given list of static metric data. This is a pure helper 
00243  *  function for adaptor writers.
00244  *
00245  *  @param data The address of the static metric data array.
00246  *  @param count The size of the given array of static metric data.
00247  *  @param list The pointer to the variable, which receives the resulting list
00248  *        of metrics.
00249  *
00250  *  @return An error code.
00251  */
00252 GATResult
00253   GATMetric_CreateListOfMetrics(GATStaticMetric *data, GATuint32 count,
00254     GATList_GATMetric *list);
00255 
00256 #ifdef __cplusplus
00257 }
00258 #endif
00259 
00260 #endif /* _GATMETRIC_H_ */
00261