GridLab
Grid Application Toolkit

A simple API for Grid Applications
GAT

Menu



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

GATRequestCPI.h

Go to the documentation of this file.
00001 /** @file GATRequestCPI.h
00002  *  Header file for the GATRequestCPI class.
00003  *
00004  *  A GATRequestCPI represents the adaptor supplied interface for an 
00005  *  information or command request coming from another process.
00006  *
00007  *  @date Fri Jan 30 2004
00008  *
00009  *  @version $Header: /export/cvs-gridlab/wp-1/Codes/GATEngine/C-reference/src/GATRequestCPI.h,v 1.7 2004/04/01 17:21:28 hartmutkaiser Exp $
00010  *
00011  *  Copyright (C) Hartmut Kaiser
00012  *  This file is part of the GAT Engine.
00013  *  Contributed by Hartmut Kaiser <hartmutkaiser [at] t-online [dot] de>.
00014  *
00015  *  Use, modification and distribution is subject to the Gridlab Software
00016  *  License. (See accompanying file GLlicense.txt or copy at
00017  *  http://www.gridlab.org/GLlicense.txt)
00018  */
00019 
00020 #if !defined(_GATREQUESTCPI_H_)
00021 #define _GATREQUESTCPI_H_
00022 
00023 typedef struct GATRequestCPI_S *GATRequestCPI;
00024 
00025 #include "GATContext.h"
00026 #include "GATPreferences.h"
00027 #include "GATRequest.h"
00028 
00029 /* Versioning constants for the GATRequestCPI_Data struct */
00030 #define GATREQUESTCPI_VERSION1 1 
00031 
00032 /* the newest version we know of */
00033 #define GATREQUESTCPI_VERSION  GATREQUESTCPI_VERSION1
00034 
00035 /**
00036  *  The @c #GATRequestCPI_Instance structure holds all data items supplied 
00037  *  by the client during the construction of the corresponding GAT object.
00038  */
00039 typedef struct GATRequestCPI_Instance_S
00040 {
00041   GATContext context;   /* the GAT context to use for all GATFile operations */
00042   
00043   GATRequestType type;          /* the type of the request */
00044   char *request_name;           /* the name of the request */
00045   GATRequestListener listener;  /* the request listener to call */
00046   void *client_contextdata;     /* the data to give to the request listener */
00047   GATTable parameters;          /* the parameters given at construction time */
00048   
00049   GATRequest_const source;      /* the object this CPI is associated with */
00050   GATRequestNotifier_const notifier;  /* the request notifier to use */
00051   void *instance_data;    /* eventually supplied CPI provider instance data */
00052 } GATRequestCPI_Instance;
00053 
00054 
00055 /* prototypes for the adapter callback functions */
00056 typedef void (*GATRequestCPI_Adaptor_Destroy)(void *);
00057 
00058 typedef GATResult (*GATRequestCPI_Adaptor_ServiceActions)(void *, 
00059   GATRequestCPI_Instance *, GATTimePeriod_const);
00060 
00061 /* instance specific functions */
00062 typedef void (*GATRequestCPI_Adaptor_DestroyInstance)(void *, 
00063   GATRequestCPI_Instance *);
00064 
00065 typedef GATResult (*GATRequestCPI_Adaptor_CreateInstance)(void *, 
00066   GATRequestCPI_Instance *, void *);
00067 
00068 typedef GATResult (*GATRequestCPI_Adaptor_CloneInstance)(void *, 
00069   GATRequestCPI_Instance const *, GATRequestCPI_Instance *);
00070 
00071 typedef GATResult (*GATRequestCPI_Adaptor_EqualsInstance)(void *, 
00072   GATRequestCPI_Instance const *, GATRequestCPI_Instance const *, 
00073   GATBool *);
00074 
00075 
00076 /* CPI specific API */
00077 typedef GATResult (*GATRequestCPI_Adaptor_InitRequestNotifier)(void *,
00078   GATRequestCPI_Instance const *, GATRequestNotifier_const *);
00079 
00080 
00081 /* CPI data passed from the adaptor while registering the CPI */
00082 typedef struct
00083 {
00084   /* CPI data (type local data) */
00085   void *data;
00086   GATRequestCPI_Adaptor_Destroy destroy;
00087 
00088   /* CPI instance data */
00089   GATRequestCPI_Adaptor_ServiceActions service_actions;
00090   GATRequestCPI_Adaptor_CreateInstance create_instance;
00091   GATRequestCPI_Adaptor_DestroyInstance destroy_instance;
00092   GATRequestCPI_Adaptor_CloneInstance clone_instance;
00093   GATRequestCPI_Adaptor_EqualsInstance equals_instance;
00094 
00095   /* CPI functionality */
00096   GATRequestCPI_Adaptor_InitRequestNotifier init_notifier;
00097   
00098 } GATRequestCPI_Data;
00099 
00100 #ifdef __cplusplus
00101 extern "C" {
00102 #endif
00103 
00104 /* Adaptor API */
00105 
00106 /** GATRequestCPI_Create
00107  *  The  GATRequestCPI constructor.
00108  *  new_cpi is the constructor for GATRequestCPI objects.
00109  *  
00110  *  @param version Version of the GATRequestCPI_Data structure
00111  *  @param data Pointer to adaptor CPI instance data structure.
00112  *
00113  * @return A new GATRequestCPI
00114  */
00115 GATRequestCPI GATRequestCPI_Create(unsigned long int version,
00116   GATRequestCPI_Data *data);
00117 
00118 
00119 /* API internal to the GAT engine */
00120 
00121 /** GATRequestCPI_Destroy
00122  *  @brief The GATRequestCPI destructor.
00123  *
00124  *  This is the destructor for GATRequestCPI objects.
00125  *
00126  *  @param this An old GATRequestCPI
00127  */
00128 void GATRequestCPI_Destroy(GATRequestCPI *cpi);
00129 
00130 /* CPI instance specific functions */
00131 
00132 /** GATRequestCPI_CreateInstance
00133  *  @brief Create a new CPI object instance
00134  *
00135  *  Calls the adaptor to create a new CPI object instance.
00136  *
00137  *  @param this The CPI object.
00138  *  @param context a GATContext
00139  *  @param instance_data The instance data of the attached CPI object
00140  *
00141  *  @return An error code.
00142  */
00143 GATResult GATRequestCPI_CreateInstance(GATRequestCPI cpi, 
00144   GATRequestCPI_Instance *instance_data, void *initialisation_data);
00145   
00146 /** GATRequestCPI_DestroyInstance
00147  *  @brief Create a new CPI object instance
00148  *
00149  *  Calls the adaptor to destroy a CPI object instance.
00150  *
00151  *  @param this The CPI object.
00152  *  @param instance_data The instance data of the attached CPI object
00153  */
00154 void GATRequestCPI_DestroyInstance(GATRequestCPI cpi, 
00155   GATRequestCPI_Instance *instance_data);
00156 
00157 /** GATRequestCPI_EqualsInstance
00158  *  @brief Compares two CPI object instances.
00159  *
00160  *  Calls the adaptor to compare two CPI object instances.
00161  *
00162  *  @param this The CPI object.
00163  *  @param lhs The instance data of the left CPI object
00164  *  @param rhs The instance data of the right CPI object
00165  *  @param isequal The pointer to the variable, where the result is to be 
00166  *        returned to.
00167  *
00168  *  @return An error code.
00169  */
00170 GATResult GATRequestCPI_EqualsInstance(GATRequestCPI cpi, 
00171   GATRequestCPI_Instance const *lhs, GATRequestCPI_Instance const *rhs, 
00172   GATBool *isequal);
00173 
00174 /** GATRequestCPI_CloneInstance
00175  *  @brief Clones a CPI object instance.
00176  *
00177  *  Calls the adaptor to clone a CPI object instance.
00178  *
00179  *  @param this The CPI object.
00180  *  @param instance_data The instance data of the CPI object to clone.
00181  *  @param new_instance_data The new instance data is to be returned here.
00182  *
00183  *  @return An error code.
00184  */
00185 GATResult GATRequestCPI_CloneInstance(GATRequestCPI cpi, 
00186   GATRequestCPI_Instance const *instance_data,
00187   GATRequestCPI_Instance *new_instance_data);
00188 
00189 /* CPI specific API */
00190 
00191 /** GATRequestCPI_InitRequestNotifier
00192  *
00193  *  Calls the adaptor to return the associated request notifier.
00194  *
00195  *  @param this The CPI object.
00196  *  @param instance_data The instance data of the CPI object to ask for the 
00197  *        request notifier.
00198  *  @param notifier The pointer to a variable, which should receive the 
00199  *        returned request notifier.
00200  *
00201  *  @return An error code.
00202  */
00203 GATResult GATRequestCPI_InitRequestNotifier(GATRequestCPI cpi, 
00204   GATRequestCPI_Instance const *instance_data,
00205   GATRequestNotifier_const *notifier);
00206   
00207 #ifdef __cplusplus
00208 } /* extern "C" */
00209 #endif
00210 
00211 #endif /* !defined(_GATREQUESTCPI_H_) */
00212