GridLab
Grid Application Toolkit

A simple API for Grid Applications
GAT

Menu



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

GATAdvertService.h

Go to the documentation of this file.
00001 /** @file GATAdvertService.h
00002  *  Header file for the GATAdvertService class.
00003  *
00004  *  @date Fri Feb 13 2004
00005  *
00006  *  @version $Header: /export/cvs-gridlab/wp-1/Codes/GATEngine/C-reference/src/GATAdvertService.h,v 1.6 2004/04/03 10:49:47 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(_GATADVERTSERVICE_H_)
00018 #define  _GATADVERTSERVICE_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(GATAdvertService);
00032 
00033 /** GATAdvertService_Create
00034  *  @brief Create a new GATAdvertService object
00035  *
00036  *  The function @c GATAdvertService_Create creates a new 
00037  *  GATAdvertService object
00038  *
00039  *  @param context The GAT context to use while thie initialisation of the 
00040  *        new object.
00041  *  @param preferences The preferences to use wile selecting the adaptor for 
00042  *        the corresponding CPI.
00043  *
00044  *  @return Returns a handle to the newly created GATAdvertService object.
00045  *        Returns 0 (zero) if an error occurs.
00046  */
00047 GATAdvertService 
00048   GATAdvertService_Create(GATContext context, GATPreferences_const preferences);
00049 
00050 /** void GATAdvertService_Destroy(GATAdvertService *resource)
00051  *
00052  *  The function GATAdvertService_Destroy is the destructor used to
00053  *  free all the memory allocated by an GATAdvertService instance.
00054  *
00055  *  @param object The pointer to the GATAdvertService to destroy
00056  */
00057 void
00058   GATAdvertService_Destroy(GATAdvertService *object);
00059 
00060 /** GATAdvertService_Equals
00061  *  @brief Compare two GATAdvertService objects
00062  *
00063  *  The function @c GATAdvertService_Equals compares two objects of the
00064  *  @c GATAdvertService type.
00065  *
00066  *  @param lhs The first list to compare
00067  *  @param rhs The second list to compare
00068  *  @param isequal The pointer to the location, where the outcome of the 
00069  *        function has to be stored.
00070  *
00071  *  @return An error code.
00072  */
00073 GATResult 
00074   GATAdvertService_Equals(GATAdvertService_const lhs,
00075     GATAdvertService_const rhs, GATBool *isequal);
00076 
00077 /** GATAdvertService_Clone
00078  *  @brief Clone the given GATAdvertService
00079  *
00080  *  The function @c GATAdvertService_Clone generates a (deep) copy of 
00081  *  the given GATAdvertService. 
00082  *
00083  *  @param description The object to clone
00084  *  @param new_object The pointer, through which the result is to be 
00085  *        returned.
00086  *
00087  *  @return An error type.
00088  */
00089 GATResult 
00090   GATAdvertService_Clone(GATAdvertService_const object, 
00091     GATAdvertService *new_object);
00092 
00093 /** GATType GATAdvertService_GetType(GATAdvertService_const resource)
00094  *  @brief Return the type of the GATAdvertService
00095  *
00096  *  The function @c GATAdvertService_GetType always returns 
00097  *  @c #GATType_GATAdvertService. 
00098  *
00099  *  @param object The object to inspect
00100  *
00101  *  @return Returns always @c #GATType_GATAdvertService. 
00102  */
00103 GATType
00104   GATAdvertService_GetType(GATAdvertService_const object);
00105 
00106 /** GATResult GATAdvertService_GetInterface(GATAdvertService_const file, GATInterface iftype, void const **ifp)
00107  *  @brief Get an interface supported by a GATObject
00108  *
00109  *  The function GATAdvertService_GetInterface allows to get a pointer to an 
00110  *  additional interface supported by this GATAdvertService.
00111  *
00112  *  @param object The object to be asked for the new interface.
00113  *  @param iftype The interface the object is to be asked for.
00114  *  @param ifp The pointer, through which the result is to be returned.
00115  *
00116  *  @return An error type.
00117  */
00118 GATResult  
00119   GATAdvertService_GetInterface(GATAdvertService_const object, 
00120     GATInterface iftype, void const **ifp);
00121 
00122 
00123 /* GATMonitorable API */
00124 
00125 /** GATAdvertService_AddMetricListener
00126  *
00127  *  The function GATAdvertService_AddMetricListener adds the passed instance of a 
00128  *  GATMetricListener to the list of GATMetricListeners which are notified of 
00129  *  fired GATMetricEvents of the type described by the provided GATMetric 
00130  *  instance.
00131  *
00132  *  @param object The GATAdvertService instance to add the GATMetricListener to.
00133  *  @param listener The GTAMetricListener to call, when the corresponding 
00134  *        GATMetricEvent is fired.
00135  *  @param listener_data The client supplied data, which will be passed through
00136  *        to the GATMetricListener.
00137  *  @param metric The GATMetric instance describing the GATMetricEvent to pass
00138  *        to the GATMetricListener.
00139  *  @param cookie The returned value should be used to remove the 
00140  *        GATMetricListener from this GATMonitorable.
00141  *
00142  *  @return An error code.
00143  */ 
00144 GATResult  
00145   GATAdvertService_AddMetricListener(GATAdvertService object, 
00146     GATMetricListener listener, void *listener_data, GATMetric metric,
00147     GATuint32 *cookie);
00148 
00149 /** GATAdvertService_RegisterPolling
00150  *
00151  *  The function GATAdvertService_RegisterPolling registers a continuous 
00152  *  metric with the given GATAdvertService instance.
00153  *
00154  *  @param object The GATAdvertService instance to register the metric with.
00155  *  @param metric The GATMetric instance describing the GATMetricEvent to pass
00156  *        to the GATMetricListener. This metric instance must be of type
00157  *        GATMeasurementType_Continuous, otherwise an error is returned.
00158  *  @param event The pointer to a variable, which should receive the resulting
00159  *        GATMetricEvent. The GATMetricEvent instance should be freed by the 
00160  *        caller when it isn't used anymore.
00161  *  @param cookie The returned value should be used to remove the 
00162  *        GATMetricListener from this GATAdvertService.
00163  *
00164  *  @return An error code.
00165  */ 
00166 GATResult  
00167   GATAdvertService_RegisterPolling(GATAdvertService object, GATMetric metric, 
00168     GATMetricEvent *event, GATuint32 *cookie);
00169 
00170 /** GATAdvertService_RemoveRegisteredMetric
00171  *
00172  *  The function GATAdvertService_RemoveRegisteredMetric removes a GATMetricListener, 
00173  *  which was previously registered with GATAdvertService_AddMetricListener.
00174  *
00175  *  @param object The GATAdvertService instance to remove the GATMetricListener from.
00176  *  @param listener The GATMetricListener to call, when the corresponding 
00177  *        GATMetricEvent is fired.
00178  *  @param metric The GATMetric instance describing the GATMetricEvent to pass
00179  *        to the GATMetricListener.
00180  *  @param cookie This value identifies the GATMetricListener to remove, it 
00181  *        was returned from the corresponding GATMonitorable_AddMetricListener 
00182  *        or GATMonitorable_MetricRegisterPolling functions.
00183  *  
00184  *  @return An error code.
00185  */
00186 GATResult  
00187   GATAdvertService_RemoveRegisteredMetric(GATAdvertService object, 
00188     GATMetric metric, GATuint32 cookie);
00189 
00190 /** GATAdvertService_GetMetrics
00191  *
00192  *  The function GATAdvertService_GetMetrics returns a list of metrics supported 
00193  *  by this GATAdvertService.
00194  *
00195  *  @param object The GATAdvertService instance, for which the supported metrics 
00196  *        should be returned.
00197  *  @param metrics The pointer to the variable, which receives the resulting 
00198  *        list of metrics.
00199  *
00200  *  @return An error code.
00201  */
00202 GATResult  
00203   GATAdvertService_GetMetrics(GATAdvertService_const object, 
00204     GATList_GATMetric *metrics);
00205 
00206 /** GATAdvertService_Add
00207  *  
00208  *  The function GATAdvertService_Add adds an Advertizable instance and related 
00209  *  meta data to the GATAdvertService, at path (absolute or relative to PWD). 
00210  *  If an GATAdvertService entry exists at the specified path, that entry gets 
00211  *  overwritten.
00212  *
00213  *  @param object The GATAdvertService instance, to which the advertisable 
00214  *        should be added.
00215  *  @param advertisable The advertisable object, which should be stored in the 
00216  *        given advertservice.
00217  *  @param metadata The meta data to rassociate with the newly created entry.
00218  *  @param path The path inside the advert service, where the newly created 
00219  *        entry is to be stored.
00220  *
00221  *  @return An error code.
00222  */
00223 GATResult  
00224   GATAdvertService_Add(GATAdvertService object, GATObject_const advertisable, 
00225     GATTable metadata, GATString_const path);
00226 
00227 /** GATAdvertService_Delete
00228  *  
00229  *  The function GATAdvertService_Delete deletes the specified entry from the 
00230  *  GATAdvertService.
00231  *
00232  *  @param object The GATAdvertService instance, from which the given path 
00233  *        should be deleted.
00234  *  @param path The path of the entry to delete from the given advert service.
00235  *
00236  *  @return An error code.
00237  */
00238 GATResult
00239   GATAdvertService_Delete(GATAdvertService object, GATString_const path);
00240 
00241 /** GATAdvertService_GetMetaData
00242  *  
00243  *  The function GATAdvertService_GetMetaData gets the meta data for the 
00244  *  specified AD entry.
00245  *
00246  *  @param object The GATAdvertService instance, from which the metadata of the
00247  *        given path should be returned.
00248  *  @param path The path of the entry, for which the meta data should be 
00249  *        retrieved.
00250  *  @param The pointer to a variable, which receives the requested meta data 
00251  *        (the returned GATTable object should be free'd by the user of this
00252  *        function).
00253  *
00254  *  @return An error code.
00255  */
00256 GATResult
00257   GATAdvertService_GetMetaData(GATAdvertService_const object, 
00258     GATString_const path, GATTable *metadata);
00259 
00260 /** GATAdvertService_GetAdvertisable
00261  *  
00262  *  The function GATAdvertService_GetAdvertisable gets the Advertisable instance 
00263  *  for the specified GATAdvertService entry.
00264  *
00265  *  @param object The GATAdvertService instance, from which the advertisable of 
00266  *        the given path should be returned.
00267  *  @param path The path of the entry, for which the stroed advertisable should 
00268  *        be retrieved.
00269  *  @param advertisable The pointer to a variable, which should receive the 
00270  *        requested advertisable object (the returned GATObject should be 
00271  *        free'd by the user of this function).
00272  *
00273  *  @return An error code.
00274  */
00275 GATResult
00276   GATAdvertService_GetAdvertisable(GATAdvertService_const object, 
00277     GATString_const path, GATObject *advertisable);
00278 
00279 /** GATAdvertService_Find
00280  *  
00281  *  The function GATAdvertService_Find queries the GATAdvertService for entries 
00282  *  matching the specified set of meta data.
00283  *
00284  *  @param object The GATAdvertService instance, inside which the query should 
00285  *        be executed.
00286  *  @param metadata The meta data search criteria to use for the query.
00287  *  @param paths The pointer to a variable, which should receive the list of
00288  *        paths pointing to matching entries inside the given advert service
00289  *        (the returned list of strings should be free'd by the user of this 
00290  *        function).
00291  *
00292  *  @return An error code.
00293  */
00294 GATResult
00295   GATAdvertService_Find(GATAdvertService_const object, GATTable_const metadata,
00296     GATList_String *paths);
00297 
00298 /** GATAdvertService_SetPWD
00299  *  
00300  *  The function GATAdvertService_SetPWD specifies the element of the 
00301  *  GATAdvertService namespace to be used as reference for relative paths.
00302  *
00303  *  @param object The GATAdvertService instance, for which the reference should 
00304  *        be set.
00305  *  @param path The path referencing the namespace element to be used as the
00306  *        reference for relative paths.
00307  *
00308  *  @return An error code.
00309  */
00310 GATResult 
00311   GATAdvertService_SetPWD(GATAdvertService object, GATString_const path);
00312 
00313 /** GATAdvertService_GetPWD
00314  *  
00315  *  The function GATAdvertService_GetPWD gets the path of the element of the 
00316  *  GATAdvertService namespace, which is used as reference for relative paths.
00317  *
00318  *  @param object The GATAdvertService instance, for which the reference should 
00319  *        be retrieved.
00320  *  @param path The pointer of the variable, which should receive the path 
00321  *        referencing the namespace element, which is used as the reference for 
00322  *        relative paths.
00323  *
00324  *  @return An error code.
00325  */
00326 GATResult 
00327   GATAdvertService_GetPWD(GATAdvertService object, GATString *path);
00328 
00329 #ifdef __cplusplus
00330 } /* extern "C" */
00331 #endif
00332 
00333 #endif /* !defined(_GATADVERTSERVICE_H_) */
00334