GridLab
Grid Application Toolkit

A simple API for Grid Applications
GAT

Menu



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

GATResourceDescription.h

Go to the documentation of this file.
00001 /** @file template.h
00002  *  Source file for the implementation of the different resourceDescription 
00003  *  classes
00004  * 
00005  *  GATSoftwareResourceDescription and GATHardwareResourceDescription are to 
00006  *  used to describe software and hardware resources are used to specify and 
00007  *  find resources, which may then be used, for instance, to submit a GATJob.
00008  * 
00009  *  @date Wed Oct 8 2003
00010  * 
00011  *  @version $Header: /export/cvs-gridlab/wp-1/Codes/GATEngine/C-reference/src/GATResourceDescription.h,v 1.14 2004/03/24 19:30:58 hartmutkaiser Exp $
00012  *
00013  *  Copyright (C) Hartmut Kaiser
00014  *  This file is part of the GAT Engine.
00015  *  Contributed by Hartmut Kaiser <hartmutkaiser [at] t-online [dot] de>.
00016  *
00017  *  Use, modification and distribution is subject to the Gridlab Software
00018  *  License. (See accompanying file GLlicense.txt or copy at
00019  *  http://www.gridlab.org/GLlicense.txt)
00020  */
00021 
00022 #ifndef _RESOURCEDESCRIPTION_H_
00023 #define _RESOURCEDESCRIPTION_H_ 1
00024 
00025 /* GAT Header Files */
00026 #include "GATObject.h"
00027 #include "GATType.h"
00028 #include "GATTable.h"
00029 #include "GATList.h"
00030 
00031 /* Structures, unions and enums */
00032 
00033 /* 
00034  *  Declare the type specific interface functions for the 
00035  *  GATList_GATResourceDescription list 
00036  */
00037 GATLIST_DECLARE_QUALIFIED(extern, GATResourceDescription, 
00038   GATList_GATResourceDescription);
00039   
00040 /* Macros */
00041 #define GATRESOURCEDESCRIPTION_PROTOTYPE(type)                                \
00042   typedef struct GAT ## type ## ResourceDescription_S                         \
00043     *GAT ## type ## ResourceDescription;                                      \
00044   typedef struct GAT ## type ## ResourceDescription_S const                   \
00045     *GAT ## type ## ResourceDescription_const;                                \
00046   \
00047   GATOBJECT_DECLARE_CONVERTERS(GAT ## type ## ResourceDescription);           \
00048   GATOBJECT_DECLARE_CONVERTERS_QUALIFIED_EX(extern,                           \
00049     GAT ## type ## ResourceDescription, GATResourceDescription);              \
00050   \
00051   GAT ## type ## ResourceDescription                                          \
00052     GAT ## type ## ResourceDescription_Create(GATTable requirements);         \
00053   \
00054   GATResult GAT ## type ## ResourceDescription_Equals(                        \
00055     GAT ## type ## ResourceDescription_const lhs,                             \
00056     GAT ## type ## ResourceDescription_const rhs, GATBool *isequal);          \
00057   \
00058   void GAT ## type ## ResourceDescription_Destroy(                            \
00059     GAT## type ## ResourceDescription *resource);                             \
00060   \
00061   GATType GAT ## type ## ResourceDescription_GetType(                         \
00062     GAT ## type ## ResourceDescription_const resource);                       \
00063   \
00064   GATResult GAT ## type ## ResourceDescription_Clone(                         \
00065     GAT ## type ## ResourceDescription_const resource,                        \
00066     GAT ## type ## ResourceDescription *new_resource);                        \
00067   \
00068   GATResult GAT ## type ## ResourceDescription_GetInterface(                  \
00069     GAT ## type ## ResourceDescription_const object, GATInterface iftype,     \
00070     void const **ifp);                                                        \
00071   \
00072   GATResult GAT ## type ## ResourceDescription_SetDescription(                \
00073     GAT ## type ## ResourceDescription resource, GATTable requirements);      \
00074   \
00075   GATTable_const GAT ## type ## ResourceDescription_GetDescription(           \
00076     GAT ## type ## ResourceDescription_const resource);                       \
00077   \
00078   GATResult GAT ## type ## ResourceDescription_AddResourceAttribute_GATObject(\
00079     GAT ## type ## ResourceDescription resource, char const *name,            \
00080     GATObject_const value);                                                   \
00081   \
00082   GATResult GAT ## type ## ResourceDescription_AddResourceAttribute_String(   \
00083     GAT ## type ## ResourceDescription resource, char const *name,            \
00084     char const *value);                                                       \
00085   \
00086   GATResult GAT ## type ## ResourceDescription_AddResourceAttribute_int(      \
00087     GAT ## type ## ResourceDescription resource, char const *name,            \
00088     int value);                                                               \
00089   \
00090   GATResult GAT ## type ## ResourceDescription_AddResourceAttribute_short(    \
00091     GAT ## type ## ResourceDescription resource, char const *name,            \
00092     short value);                                                             \
00093   \
00094   GATResult GAT ## type ## ResourceDescription_AddResourceAttribute_double(   \
00095     GAT ## type ## ResourceDescription resource, char const *name,            \
00096     double value);                                                            \
00097   \
00098   GATResult GAT ## type ## ResourceDescription_AddResourceAttribute_float(    \
00099     GAT ## type ## ResourceDescription resource, char const *name,            \
00100     float value);                                                             \
00101   \
00102   GATResult GAT ## type ## ResourceDescription_RemoveResourceAttribute(       \
00103     GAT ## type ## ResourceDescription resource, char const *name);           \
00104   \
00105   GATList_GATResourceDescription_const                                        \
00106     GAT ## type ## ResourceDescription_GetResourceDescriptions(               \
00107       GAT ## type ## ResourceDescription_const resource);                     \
00108   \
00109   GATResult GAT ## type ## ResourceDescription_SetResourceDescriptions(       \
00110     GAT ## type ## ResourceDescription resource,                              \
00111     GATList_GATResourceDescription_const resources);                          \
00112   \
00113   GATResult GAT ## type ## ResourceDescription_AddResourceDescription(        \
00114     GAT ## type ## ResourceDescription resource,                              \
00115     GATResourceDescription to_add);                                           \
00116   \
00117   GATResult GAT ## type ## ResourceDescription_RemoveResourceDescription(     \
00118     GAT ## type ## ResourceDescription resource,                              \
00119     GATResourceDescription to_remove);                                        \
00120   \
00121   GATResult GAT ## type ## ResourceDescription_Serialise(                     \
00122     GAT ## type ## ResourceDescription object, GATObject stream,              \
00123     GATBool clear_dirty);                                                     \
00124   \
00125   GAT ## type ## ResourceDescription                                          \
00126     GAT ## type ## ResourceDescription_DeSerialise(                           \
00127       GATContext context, GATObject stream, GATResult *result);               \
00128   \
00129   GATResult GAT ## type ## ResourceDescription_GetIsDirty(                    \
00130     GAT ## type ## ResourceDescription_const object, GATBool *isdirty)       \
00131   /**/
00132 
00133 #ifdef __cplusplus
00134 extern "C" {
00135 #endif
00136 
00137 /* Declare the converters to/from GATObject */
00138 GATOBJECT_DECLARE_CONVERTERS(GATResourceDescription);
00139 
00140 /** void GATResourceDescription_Destroy(GATResourceDescription *resource)
00141  *
00142  *  The function GATResourceDescription_Destroy is the destructor used to
00143  *  free all the memory allocated by an GATResourceDescription instance.
00144  *
00145  *  @param description The pointer to the GATResourceDescription to destroy
00146  */
00147 void
00148   GATResourceDescription_Destroy(GATResourceDescription *resource);
00149 
00150 /** GATType GATResourceDescription_GetType(GATResourceDescription_const resource)
00151  *  @brief Return the type of the GATResourceDescription
00152  *
00153  *  The function @c GATResourceDescription_GetType always returns 
00154  *  @c #GATType_GATResourceDescription. 
00155  *
00156  *  @param object The object to inspect
00157  *
00158  *  @return Returns always @c #GATType_GATResourceDescription. 
00159  */
00160 GATType
00161   GATResourceDescription_GetType(GATResourceDescription_const resource);
00162 
00163 /** GATResourceDescription_Clone
00164  *  @brief Clone the given GATResourceDescription
00165  *
00166  *  The function @c GATResourceDescription_Clone generates a (deep) copy of 
00167  *  the given GATResourceDescription. 
00168  *
00169  *  @param description The object to clone
00170  *  @param new_object The pointer, through which the result is to be 
00171  *        returned.
00172  *
00173  *  @return An error type.
00174  */
00175 GATResult
00176   GATResourceDescription_Clone(GATType type, 
00177     GATResourceDescription_const resource, GATResourceDescription *new_object);
00178 
00179 /** GATResourceDescription_Equals
00180  *  @brief Compare two GATResourceDescription objects
00181  *
00182  *  The function @c GATResourceDescription_Equals compares two objects of the
00183  *  @c GATResourceDescription type.
00184  *
00185  *  @param lhs The first list to compare
00186  *  @param rhs The second list to compare
00187  *  @param isequal The pointer to the location, where the outcome of the 
00188  *        function has to be stored.
00189  *
00190  *  @return An error code.
00191  */
00192 GATResult
00193   GATResourceDescription_Equals(GATResourceDescription_const resource,
00194     GATResourceDescription_const comparewith, GATBool *isequal);
00195 
00196 /** GATResult GATResourceDescription_GetInterface(GATResourceDescription_const file, GATInterface iftype, void const **ifp)
00197  *  @brief Get an interface supported by a GATObject
00198  *
00199  *  The function GATResourceDescription_GetInterface allows to get a pointer to an 
00200  *  additional interface supported by this GATResourceDescription.
00201  *
00202  *  @param object The object to be asked for the new interface.
00203  *  @param iftype The interface the object is to be asked for.
00204  *  @param ifp The pointer, through which the result is to be returned.
00205  *
00206  *  @return An error type.
00207  */
00208 GATResult 
00209   GATResourceDescription_GetInterface(GATResourceDescription_const object,
00210     GATInterface iftype, void const **ifp);
00211       
00212 
00213 /* GATAdvertiseable API */
00214 #define GATRESOURCEDESCRIPTION_VERSION1    0x0100
00215 #define GATRESOURCEDESCRIPTION_LASTVERSION GATRESOURCEDESCRIPTION_VERSION1
00216 #define GATRESOURCEDESCRIPTION_MINOR_MASK  0x00ff
00217 
00218 /** GATResult  GATResourceDescription_Serialise(GATResourceDescription file, GATObject stream, GATBool clear_dirty)
00219  *  @brief Serialise a GATResourceDescription object
00220  *
00221  *  The function GATResourceDescription_Serialise serialises the given GATFIle 
00222  *  object into the given stream. 
00223  *
00224  *  @param object The GATResourceDescription object to serialise.
00225  *  @param stream The stream interface to use for the serialisation.
00226  *  @param clear_dirty If the clear_dirty parameter is set to GATTrue, the 
00227  *        internal dirty flag of this object is to be reset (no used here)
00228  *
00229  *  @return An error code.
00230  */
00231 GATResult  
00232   GATResourceDescription_Serialise(GATResourceDescription object, 
00233     GATObject stream, GATBool clear_dirty);
00234 
00235 /** GATResourceDescription GATResourceDescription_DeSerialise(GATContext context, GATObject stream, GATBool clear_dirty)
00236  *  @brief De-serialise a GATResourceDescription object
00237  *
00238  *  The function GATResourceDescription_DeSerialise de-serialises a streamed 
00239  *  GATResourceDescription object from the given stream  It constructs a new 
00240  *  instance of the de-serialised object.
00241  *
00242  *  @param context The GAT context to be used for object construction.
00243  *  @param stream The stream interface to use for the serialisation.
00244  *  @param result The pointer to a variable, which receives the status code of
00245  *        the operation.
00246  *
00247  *  @return The newly constructed GATResourceDescription object.
00248  */
00249 GATResourceDescription 
00250   GATResourceDescription_DeSerialise(GATContext context, GATObject stream, 
00251     GATResult *result);
00252 
00253 /** GATResourceDescription_GetIsDirty
00254  *  
00255  *  The function GATResourceDescription_GetIsDirty retrieves the status of the 
00256  *  dirty flag of this GATResourceDescription object.
00257  *
00258  *  @param object The GATResourceDescription object to inspect for its dirty status.
00259  *  @param isdirty The pointer to a variable, which receives the dirty status.
00260  *
00261  *  @return An error code.
00262  */
00263 GATResult  
00264   GATResourceDescription_GetIsDirty(GATResourceDescription_const object, 
00265     GATBool *isdirty);
00266 
00267 /* declare the type specific API functions for */
00268 GATRESOURCEDESCRIPTION_PROTOTYPE(Software);  /* GATSoftwareResourceDescription */
00269 GATRESOURCEDESCRIPTION_PROTOTYPE(Hardware);  /* GATHardwareResourceDescription */
00270   
00271 #ifdef __cplusplus
00272 } /* extern "C" */
00273 #endif
00274 
00275 #undef GATRESOURCEDESCRIPTION_PROTOTYPE
00276 
00277 #endif /* _RESOURCEDESCRIPTION_H_ */