GridLab
Grid Application Toolkit

A simple API for Grid Applications
GAT

Menu



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

GATSelfCPI.h

Go to the documentation of this file.
00001 /** @file GATSelfCPI.h
00002  *  Header file for the GATSelfCPI class.
00003  *
00004  *  @date Fri Jan 23 2004
00005  *
00006  *  @version $Header: /export/cvs-gridlab/wp-1/Codes/GATEngine/C-reference/src/GATSelfCPI.h,v 1.8 2004/04/01 17:21:28 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(_GATSELFCPI_H_)
00018 #define _GATSELFCPI_H_
00019 
00020 #include "GATContext.h"
00021 #include "GATPreferences.h"
00022 
00023 /* Versioning constants for the GATSelfCPI_Data struct */
00024 #define GATSELFCPI_VERSION1 1 
00025 
00026 /* the newest version we know of */
00027 #define GATSELFCPI_VERSION  GATSELFCPI_VERSION1
00028 
00029 /**
00030  *  The @c #GATSelfCPI_Instance structure holds all data items supplied 
00031  *  by the client during the construction of the corresponding GAT object.
00032  */
00033 typedef struct 
00034 {
00035   void *instance_data;  /* eventually supplied CPI provider instance data */
00036 } GATSelfCPI_Instance;
00037 
00038 
00039 /* prototypes for the adapter callback functions */
00040 typedef void (*GATSelfCPI_Adaptor_Destroy)(void *);
00041 
00042 /* instance specific functions */
00043 typedef GATResult (*GATSelfCPI_Adaptor_ServiceActions)(void *, 
00044   GATSelfCPI_Instance *, GATTimePeriod_const);
00045 
00046 typedef GATResult (*GATSelfCPI_Adaptor_CreateInstance)(void *, 
00047   GATSelfCPI_Instance *);
00048 
00049 typedef void (*GATSelfCPI_Adaptor_DestroyInstance)(void *, 
00050   GATSelfCPI_Instance *);
00051 
00052 /* CPI specific API */
00053 typedef GATResult (*GATSelfCPI_Adaptor_GetJob)(void *, 
00054   GATSelfCPI_Instance *, GATContext, GATJob *);
00055 
00056 typedef GATResult (*GATSelfCPI_Adaptor_CreateRequestForListener)(void *, 
00057   GATSelfCPI_Instance *, GATContext, GATRequestListener, void *, 
00058   GATRequestType, GATTable_const, const char *, GATRequest *);
00059 
00060 typedef GATResult (*GATSelfCPI_Adaptor_DestroyRequestForListener)(void *, 
00061   GATSelfCPI_Instance *, GATContext, GATRequest *);
00062 
00063 
00064 /* CPI data passed from the adaptor while registering the CPI */
00065 typedef struct
00066 {
00067   /* CPI data (type local data) */
00068   void *data;
00069   GATSelfCPI_Adaptor_Destroy destroy;
00070 
00071   /* CPI instance data */
00072   GATSelfCPI_Adaptor_ServiceActions service_actions;
00073   GATSelfCPI_Adaptor_CreateInstance create_instance;
00074   GATSelfCPI_Adaptor_DestroyInstance destroy_instance;
00075 
00076   /* CPI functionality */
00077   GATSelfCPI_Adaptor_GetJob get_selfjob;
00078   GATSelfCPI_Adaptor_CreateRequestForListener create_requestforlistener;
00079   GATSelfCPI_Adaptor_DestroyRequestForListener destroy_requestforlistener;
00080 } GATSelfCPI_Data;
00081 
00082 #ifdef __cplusplus
00083 extern "C" {
00084 #endif
00085 
00086 /* Adaptor API */
00087 
00088 /** GATSelfCPI_Create
00089  *  The  GATSelfCPI constructor.
00090  *  new_cpi is the constructor for GATSelfCPI objects.
00091  *  
00092  *  @param version Version of the GATSelfCPI_Data structure
00093  *  @param data Pointer to adaptor CPI instance data structure.
00094  *
00095  * @return A new GATSelfCPI
00096  */
00097 GATSelfCPI GATSelfCPI_Create(unsigned long int version,
00098   GATSelfCPI_Data *data);
00099 
00100 
00101 /* API internal to the GAT engine */
00102 
00103 /** GATSelfCPI_Destroy
00104  *  @brief The GATSelfCPI destructor.
00105  *
00106  *  This is the destructor for GATSelfCPI objects.
00107  *
00108  *  @param this An old GATSelfCPI
00109  */
00110 void GATSelfCPI_Destroy(GATSelfCPI *cpi);
00111 
00112 /* CPI instance specific functions */
00113 
00114 /** GATSelfCPI_CreateInstance
00115  *  @brief Create a new CPI object instance
00116  *
00117  *  Calls the adaptor to create a new CPI object instance.
00118  *
00119  *  @param this The CPI object.
00120  *  @param context a GATContext
00121  *  @param instance_data The instance data of the attached CPI object
00122  *
00123  *  @return An error code.
00124  */
00125 GATResult 
00126   GATSelfCPI_CreateInstance(GATSelfCPI cpi, 
00127     GATSelfCPI_Instance *instance_data);
00128   
00129 /** GATSelfCPI_DestroyInstance
00130  *  @brief Create a new CPI object instance
00131  *
00132  *  Calls the adaptor to destroy a CPI object instance.
00133  *
00134  *  @param this The CPI object.
00135  *  @param instance_data The instance data of the attached CPI object
00136  */
00137 void 
00138   GATSelfCPI_DestroyInstance(GATSelfCPI cpi, 
00139     GATSelfCPI_Instance *instance_data);
00140 
00141 
00142 /* CPI specific API */
00143 
00144 /** GATSelfCPI_GetJob
00145  *
00146  *
00147  *  @return An error code.
00148  */
00149 GATResult 
00150   GATSelfCPI_GetJob(GATSelfCPI cpi, GATSelfCPI_Instance *instance_data,
00151     GATContext context, GATJob *job);
00152 
00153 /** GATSelfCPI_CreateRequestForListener
00154  *
00155  *
00156  *  @return An error code.
00157  */
00158 GATResult 
00159   GATSelfCPI_CreateRequestForListener(GATSelfCPI cpi, 
00160     GATSelfCPI_Instance *instance_data, GATContext context, 
00161     GATRequestListener listener, void *data, GATRequestType type, 
00162     GATTable_const parameters, const char *name, GATRequest *request);
00163 
00164 /** GATSelfCPI_DestroyRequestForListener
00165  *
00166  *
00167  *  @return An error code.
00168  */
00169 GATResult 
00170   GATSelfCPI_DestroyRequestForListener(GATSelfCPI cpi, 
00171     GATSelfCPI_Instance *instance_data, GATContext context, 
00172     GATRequest *request);
00173 
00174 #ifdef __cplusplus
00175 } /* extern "C" */
00176 #endif
00177 
00178 #endif /* !defined(_GATSELFCPI_H_) */
00179