GridLab
Grid Application Toolkit

A simple API for Grid Applications
GAT

Menu



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

GATResource.h

Go to the documentation of this file.
00001 /** @file GATResource.h
00002  *  Header file for the GATResource class.
00003  *
00004  *  @date Thu Oct 23 2003
00005  *
00006  *  @version $Header: /export/cvs-gridlab/wp-1/Codes/GATEngine/C-reference/src/GATResource.h,v 1.13 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(_GATRESOURCE_H_)
00018 #define _GATRESOURCE_H_
00019 
00020 /* GAT Header Files */
00021 #include "GATObject.h"
00022 #include "GATType.h"
00023 #include "GATMonitorable.h"
00024 #include "GATResourceDescription.h"
00025 #include "GATSoftwareDescription.h"
00026 
00027 /* define a macro, which declares all the GATResource API functions */
00028 #define GATRESOURCE_PROTOTYPE(type)                                           \
00029   GATOBJECT_DECLARE_CONVERTERS(type);                                         \
00030   GATOBJECT_DECLARE_CONVERTERS_QUALIFIED_EX(extern, type, GATResource);       \
00031   \
00032   type type ## _Create(GATContext context, GATPreferences_const prefs,        \
00033     void *instance_data);                                                     \
00034   void type ## _Destroy(type *object);                                        \
00035   GATResult type ## _Equals(type ## _const lhs, type ## _const rhs,           \
00036     GATBool *isequal);                                                        \
00037   GATResult type ## _Clone(type ## _const object, type *new_object);          \
00038   GATType type ## _GetType(type ## _const object);                            \
00039   GATResult type ## _GetInterface(type ## _const object, GATInterface iftype, \
00040     void const **ifp);                                                        \
00041   \
00042   GATResult type ## _GetResourceDescription(type ## _const object,            \
00043     type ## Description_const *);                                             \
00044   GATResult type ## _GetReservation(type ## _const object,                    \
00045     GATReservation_const *);                                                  \
00046   \
00047   GATResult type ## _AddMetricListener(type object, GATMetricListener listener,\
00048     void *listener_data, GATMetric metric, GATuint32 *cookie);                \
00049   GATResult type ## _RegisterPolling(type object, GATMetric metric,           \
00050     GATMetricEvent *event, GATuint32 *cookie);                                \
00051   GATResult type ## _RemoveRegisteredMetric(type object, GATMetric metric,    \
00052     GATuint32 cookie);                                                        \
00053   GATResult type ## _GetMetrics(type ## _const object,                        \
00054     GATList_GATMetric *metrics);                                              \
00055   \
00056   GATResult type ## _Serialise(type object, GATObject stream,                 \
00057     GATBool clear_dirty);                                                     \
00058   type type ## _DeSerialise(GATContext context, GATObject stream,             \
00059     GATResult *result);                                                       \
00060   GATResult type ## _GetIsDirty(type ## _const object, GATBool *isdirty)      \
00061   /**/
00062   
00063 /* GATAdvertiseable API */
00064 #define GATRESOURCE_VERSION1    0x0100
00065 #define GATRESOURCE_LASTVERSION GATRESOURCE_VERSION1
00066 #define GATRESOURCE_MINOR_MASK  0x00ff
00067 
00068 /* Structures, unions and enums */
00069 
00070 #ifdef __cplusplus
00071 extern "C" {
00072 #endif
00073 
00074 /* GATResource */
00075 
00076 /** GATResource_Clone
00077  *  @brief Clone the given GATResource
00078  *
00079  *  The function @c GATResource_Clone generates a (deep) copy of 
00080  *  the given GATResource. 
00081  *
00082  *  @param description The object to clone
00083  *  @param new_object The pointer, through which the result is to be 
00084  *        returned.
00085  *
00086  *  @return An error type.
00087  *
00088  *  @remark The concrete function name to use is determined by the type to be
00089  *        stored inside the list. For instance, a list containing @c int's 
00090  *        would  be destroyed with the function @c GATList_int_Destroy.
00091  */
00092 GATResult
00093   GATResource_Clone(GATResource_const handle, GATResource *new_handle);
00094 
00095 /** void GATResource_Destroy(GATResource *resource)
00096  *
00097  *  The function GATResource_Destroy is the destructor used to
00098  *  free all the memory allocated by an GATResource instance.
00099  *
00100  *  @param description The pointer to the GATResource to destroy
00101  *
00102  *  @remark The concrete function name to use is determined by the type to be
00103  *        stored inside the list. For instance, a list containing @c int's 
00104  *        would  be destroyed with the function @c GATList_int_Destroy.
00105  */
00106 void
00107   GATResource_Destroy(GATResource *object);
00108   
00109 GATResult
00110   GATResource_Equals(GATResource_const lhs, GATResource_const rhs, 
00111     GATBool *isequal);
00112 
00113 GATType
00114   GATResource_GetType(GATResource_const object);
00115 
00116 GATResult 
00117   GATResource_GetInterface(GATResource_const object, GATInterface iftype, 
00118     void const **ifp);
00119 
00120 
00121 /* GATAdvertiseable API */
00122 GATResult 
00123   GATResource_Serialise(GATResource file, GATObject stream, 
00124     GATBool clear_dirty);
00125 
00126 GATResource 
00127   GATResource_DeSerialise(GATContext context, GATObject stream, 
00128     GATResult *result);
00129 
00130 GATResult 
00131   GATResource_GetIsDirty(GATResource_const object, GATBool *isdirty);
00132 
00133 /* Declare the converters to/from GATObject */
00134 GATOBJECT_DECLARE_CONVERTERS(GATResource);
00135 
00136 GATRESOURCE_PROTOTYPE(GATSoftwareResource);
00137 GATRESOURCE_PROTOTYPE(GATHardwareResource);
00138 
00139 #ifdef __cplusplus
00140 } /* extern "C" */
00141 #endif
00142 
00143 #endif /* !defined(_GATRESOURCE_H_) */