GridLab
Grid Application Toolkit

A simple API for Grid Applications
GAT

Menu



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

GATReservationCPI.h

Go to the documentation of this file.
00001 /** @file GATReservationCPI.h
00002  *  Header file for the GATReservationCPI class.
00003  *
00004  *  @date Thu Oct 23 2003
00005  *
00006  *  @version $Header: /export/cvs-gridlab/wp-1/Codes/GATEngine/C-reference/src/GATReservationCPI.h,v 1.7 2004/03/24 19:30:58 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(_GATRESERVATIONCPI_H_)
00018 #define _GATRESERVATIONCPI_H_
00019 
00020 typedef struct GATReservationCPI_S *GATReservationCPI;
00021 
00022 #include "GATContext.h"
00023 #include "GATPreferences.h"
00024 #include "GATReservation.h"
00025 
00026 /* Versioning constants for the GATReservationCPI_Data struct */
00027 #define GATRESERVATIONCPI_VERSION1 1 
00028 
00029 /* the newest version we know of */
00030 #define GATRESERVATIONCPI_VERSION  GATRESERVATIONCPI_VERSION1
00031 
00032 /**
00033  *  The @c #GATReservationCPI_Instance structure holds all data items supplied 
00034  *  by the client during the construction of the corresponding GAT object.
00035  */
00036 typedef struct 
00037 {
00038   GATContext context;   /* the GAT context to use for all GATFile operations */
00039   char *unique_name;      /* the identifying name for this reservation */
00040   GATType type;           /* the actual type of this object */
00041   GATBool isdirty;        /* dirty status for the whole object */
00042   GATMonitorable_Impl monitorable;  /* monitoring support */
00043   GATObject_const source; /* the object this CPI is associated with */
00044   void *instance_data;    /* eventually supplied CPI provider instance data */
00045 } GATReservationCPI_Instance;
00046 
00047 /* prototypes for the adapter callback functions */
00048 typedef void (*GATReservationCPI_Adaptor_Destroy)(void *);
00049 
00050 typedef GATResult (*GATReservationCPI_Adaptor_ServiceActions)(void *, 
00051   GATReservationCPI_Instance *, GATTimePeriod_const);
00052 
00053 /* instance specific functions */
00054 typedef void (*GATReservationCPI_Adaptor_DestroyInstance)(void *, 
00055   GATReservationCPI_Instance *);
00056 
00057 typedef GATResult (*GATReservationCPI_Adaptor_CreateInstance)(void *, 
00058   GATReservationCPI_Instance *);
00059 
00060 typedef GATResult (*GATReservationCPI_Adaptor_CloneInstance)(void *, 
00061   GATReservationCPI_Instance const *, GATReservationCPI_Instance *);
00062 
00063 typedef GATResult (*GATReservationCPI_Adaptor_EqualsInstance)(void *, 
00064   GATReservationCPI_Instance const *, GATReservationCPI_Instance const *, 
00065   GATBool *);
00066 
00067 /* CPI specific API */
00068 typedef GATResult (*GATReservationCPI_Adaptor_Cancel)(void *, 
00069   GATReservationCPI_Instance *);
00070   
00071 typedef GATResult (*GATReservationCPI_Adaptor_GetResource)(void *, 
00072   GATReservationCPI_Instance const *, GATResource_const *);
00073   
00074 typedef struct
00075 {
00076   /* CPI data (type local data) */
00077   void *data;
00078   GATReservationCPI_Adaptor_Destroy destroy;
00079   GATReservationCPI_Adaptor_ServiceActions service_actions;
00080   
00081   /* CPI instance data */
00082   GATReservationCPI_Adaptor_CreateInstance create_instance;
00083   GATReservationCPI_Adaptor_DestroyInstance destroy_instance;
00084   GATReservationCPI_Adaptor_CloneInstance clone_instance;
00085   GATReservationCPI_Adaptor_EqualsInstance equals_instance;
00086 
00087   /* CPI functionality */
00088   GATReservationCPI_Adaptor_Cancel cancel;
00089   GATReservationCPI_Adaptor_GetResource get_resource;
00090 } GATReservationCPI_Data;
00091 
00092 #ifdef __cplusplus
00093 extern "C" {
00094 #endif
00095 
00096 /* Adaptor API */
00097 GATReservationCPI GATReservationCPI_Create(unsigned long int version,
00098   GATReservationCPI_Data *data);
00099 
00100 /* API internal to the GAT engine */
00101 void GATReservationCPI_Destroy(GATReservationCPI *cpi);
00102 
00103 /* CPI instance specific functions */
00104 GATResult GATReservationCPI_CreateInstance(GATReservationCPI cpi, 
00105   GATReservationCPI_Instance *instance_data);
00106   
00107 void GATReservationCPI_DestroyInstance(GATReservationCPI cpi, 
00108   GATReservationCPI_Instance *instance_data);
00109 
00110 GATResult GATReservationCPI_CloneInstance(GATReservationCPI cpi, 
00111   GATReservationCPI_Instance const *instance_data, 
00112   GATReservationCPI_Instance *new_instance_data);
00113 
00114 GATResult GATReservationCPI_EqualsInstance(GATReservationCPI cpi, 
00115   GATReservationCPI_Instance const *lhs, 
00116   GATReservationCPI_Instance const *rhs, GATBool *isequal);
00117 
00118 /* CPI specific API */
00119 
00120 /* Cancel the given reservation */
00121 GATResult GATReservationCPI_Cancel(GATReservationCPI reservation, 
00122   GATReservationCPI_Instance *instance_data);
00123 
00124 /* get the associated GATResource instance */
00125 GATResult GATReservationCPI_GetResource(GATReservationCPI reservation, 
00126   GATReservationCPI_Instance const *instance_data, 
00127   GATResource_const *resource);
00128   
00129 #ifdef __cplusplus
00130 } /* extern "C" */
00131 #endif
00132 
00133 #endif /* !defined(_GATRESERVATIONCPI_H_) */