GridLab
Grid Application Toolkit

A simple API for Grid Applications
GAT

Menu



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

GATType.h

Go to the documentation of this file.
00001 /** @file GATType.h
00002  * Header file defining an enum for the GATTypes.
00003  * 
00004  * We need to distinguish between the types of various GAT objects
00005  * or primitive types at various points.  This header file defines
00006  * an enum which can be used.
00007  * 
00008  * @date Tue Sep 23 2003
00009  * 
00010  * @version $Header: /export/cvs-gridlab/wp-1/Codes/GATEngine/C-reference/src/GATType.h,v 1.53 2004/04/28 10:50:10 hartmutkaiser Exp $
00011  *
00012  *  Copyright (C) Tom Goodale
00013  *  This file is part of the GAT Engine.
00014  *  Contributed by Tom Goodale <goodale@aei.mpg.de>.
00015  *
00016  *  Use, modification and distribution is subject to the Gridlab Software
00017  *  License. (See accompanying file GLlicense.txt or copy at
00018  *  http://www.gridlab.org/GLlicense.txt)
00019  */
00020 
00021 #ifndef _GATTYPE_H_
00022 #define _GATTYPE_H_ 1
00023 
00024 #include "xds.h"
00025 
00026 /* the GAT equivalent to a normal boolean type */
00027 typedef enum {
00028   GATFalse = 0,
00029   GATTrue = 1
00030 } GATBool;
00031 
00032 /* GAT Primitive Types */
00033 typedef xds_int8_t   GATint8;
00034 typedef xds_uint8_t  GATuint8;
00035 typedef xds_int16_t  GATint16;
00036 typedef xds_uint16_t GATuint16;
00037 typedef xds_int32_t  GATint32;
00038 typedef xds_uint32_t GATuint32;
00039 typedef xds_float_t  GATfloat32;
00040 typedef xds_double_t GATdouble64;
00041 
00042 /* 64bit Integral GAT Primitive Types */
00043 #ifdef XDS_HAVE_64_BIT_SUPPORT
00044 typedef xds_int64_t  GATint64;
00045 typedef xds_uint64_t GATuint64;
00046 #endif
00047 
00048 /* The error/result code type */
00049 typedef GATint32 GATResult;
00050 
00051 /* forward declaration of all interface types */
00052 /* GATObject handle */
00053 typedef struct GATObject_S *GATObject;
00054 typedef struct GATObject_S const *GATObject_const;
00055 
00056 /* GATSerialise handle */
00057 typedef struct GATSerialise_S *GATSerialise;
00058 typedef struct GATSerialise_S const *GATSerialise_const;
00059 
00060 /* GATStreamable handle */
00061 typedef struct GATStreamable_S *GATStreamable;
00062 typedef struct GATStreamable_S const *GATStreamable_const;
00063 
00064 /* GATResource handle */
00065 typedef struct GATResource_S *GATResource;
00066 typedef struct GATResource_S const *GATResource_const;
00067 
00068 /* GATMonitorable handle */
00069 typedef struct GATMonitorable_S *GATMonitorable;
00070 typedef struct GATMonitorable_S const *GATMonitorable_const;
00071 
00072 /* GATMetricEvent handle */
00073 typedef struct GATMetricEvent_S *GATMetricEvent;
00074 typedef struct GATMetricEvent_S const *GATMetricEvent_const;
00075 
00076 /* The GATObject_ISerialisable_vtable_S needs to be forward declared too */
00077 struct GATObject_ISerialisable_vtable_S;
00078 
00079 /* forward declaration of all GATObject derived types */
00080 
00081 /* GATRegistry handle */
00082 typedef struct GATRegistry_S *GATRegistry;
00083 typedef struct GATRegistry_S const *GATRegistry_const;
00084 
00085 /* GATConfig handle */
00086 typedef struct GATConfig_S *GATConfig;
00087 typedef struct GATConfig_S const *GATConfig_const;
00088 
00089 /* GATContext handle */
00090 typedef struct GATContext_S *GATContext;
00091 typedef struct GATContext_S const *GATContext_const;
00092 
00093 /* GATAdvertService handle */
00094 typedef struct GATAdvertService_S *GATAdvertService;
00095 typedef struct GATAdvertService_S const *GATAdvertService_const;
00096 
00097 /* GATFile handle */
00098 typedef struct GATFile_S *GATFile;
00099 typedef struct GATFile_S const *GATFile_const;
00100 
00101 /* GATJob handle */
00102 typedef struct GATJob_S *GATJob;
00103 typedef struct GATJob_S const *GATJob_const;
00104 
00105 /* GATJobDescription handle */
00106 typedef struct GATJobDescription_S *GATJobDescription;
00107 typedef struct GATJobDescription_S const *GATJobDescription_const;
00108 
00109 /* GATLocation handle */
00110 typedef struct GATLocation_S *GATLocation;
00111 typedef struct GATLocation_S const *GATLocation_const;
00112 
00113 /* GATLogicalFile handle */
00114 typedef struct GATLogicalFile_S *GATLogicalFile;
00115 typedef struct GATLogicalFile_S const *GATLogicalFile_const;
00116 
00117 /* GATMemoryStream handle */
00118 typedef struct GATMemoryStream_S *GATMemoryStream;
00119 typedef struct GATMemoryStream_S const *GATMemoryStream_const;
00120 
00121 /* GATMetric handle */
00122 typedef struct GATMetric_S *GATMetric;
00123 typedef struct GATMetric_S const *GATMetric_const;
00124 
00125 /* GATPreferences handle */
00126 typedef struct GATPreferences_S *GATPreferences;
00127 typedef struct GATPreferences_S const *GATPreferences_const;
00128 
00129 /* GATReservation handle */
00130 typedef struct GATReservation_S *GATReservation;
00131 typedef struct GATReservation_S const *GATReservation_const;
00132 
00133 /* GATResourceBroker handle */
00134 typedef struct GATResourceBroker_S *GATResourceBroker;
00135 typedef struct GATResourceBroker_S const *GATResourceBroker_const;
00136 
00137 /* GATResourceDescription handle */
00138 typedef struct GATResourceDescription_S *GATResourceDescription;
00139 typedef struct GATResourceDescription_S const *GATResourceDescription_const;
00140 
00141 /* GATSoftwareResourceDescription handle */
00142 /* No multiple decs
00143 typedef struct GATSoftwareResourceDescription_S *
00144   GATSoftwareResourceDescription;
00145 typedef struct GATSoftwareResourceDescription_S const *
00146   GATSoftwareResourceDescription_const;
00147 */
00148 
00149 /* GATHardwareResourceDescription handle */
00150 /* No multiple decs
00151 typedef struct GATHardwareResourceDescription_S *
00152   GATHardwareResourceDescription;
00153 typedef struct GATHardwareResourceDescription_S const *
00154   GATHardwareResourceDescription_const;
00155 */
00156 
00157 /* GATSoftwareDescription handle */
00158 typedef struct GATSoftwareDescription_S *GATSoftwareDescription;
00159 typedef struct GATSoftwareDescription_S const *GATSoftwareDescription_const;
00160 
00161 /* GATSoftwareResource handle */
00162 typedef struct GATSoftwareResource_S *GATSoftwareResource;
00163 typedef struct GATSoftwareResource_S const *GATSoftwareResource_const;
00164 
00165 /* GATHardwareResource handle */
00166 typedef struct GATHardwareResource_S *GATHardwareResource;
00167 typedef struct GATHardwareResource_S const *GATHardwareResource_const;
00168 
00169 /* GATStatus handle */
00170 typedef struct GATStatus_S *GATStatus;
00171 typedef struct GATStatus_S const *GATStatus_const;
00172 
00173 /* GATString handle */
00174 typedef struct GATString_S *GATString;
00175 typedef struct GATString_S const *GATString_const;
00176 
00177 /* GATTime handle */
00178 typedef struct GATTime_S *GATTime;
00179 typedef struct GATTime_S const *GATTime_const;
00180 
00181 /* GATTable handle */
00182 typedef struct GATTable_S *GATTable;
00183 typedef struct GATTable_S const *GATTable_const;
00184 
00185 /* GATTimePeriod handle */
00186 typedef struct GATTimePeriod_S *GATTimePeriod;
00187 typedef struct GATTimePeriod_S const *GATTimePeriod_const;
00188 
00189 /* GATEndpoint handle */
00190 typedef struct GATEndpoint_S *GATEndpoint;
00191 typedef struct GATEndpoint_S const *GATEndpoint_const;
00192 
00193 /* GATPipe handle */
00194 typedef struct GATPipe_S *GATPipe;
00195 typedef struct GATPipe_S const *GATPipe_const;
00196 
00197 /* GATFileStream handle */
00198 typedef struct GATFileStream_S *GATFileStream;
00199 typedef struct GATFileStream_S const *GATFileStream_const;
00200 
00201 /* The jobId uniquely identifies a concrete job */
00202 typedef GATString GATJobID;
00203 typedef GATString_const GATJobID_const;
00204 
00205 /* GATSelf handle */
00206 typedef struct GATSelf_S *GATSelf;
00207 typedef struct GATSelf_S const *GATSelf_const;
00208 
00209 /* GATRequest handle */
00210 typedef struct GATRequest_S *GATRequest;
00211 typedef struct GATRequest_S const *GATRequest_const;
00212 
00213 /* GATRequestNotifier handle */
00214 typedef struct GATRequestNotifier_S *GATRequestNotifier;
00215 typedef struct GATRequestNotifier_S const *GATRequestNotifier_const;
00216 
00217 /* GATSecurityContext handle */
00218 typedef struct GATSecurityContext_S *GATSecurityContext;
00219 typedef struct GATSecurityContext_S const *GATSecurityContext_const;
00220 
00221 /*
00222  *  Handle definitions for the GATList and GATListIterator
00223  */
00224 typedef struct GATList_S *GATList;
00225 typedef struct GATList_S const *GATList_const;
00226 typedef struct GATListNode_S *GATListIterator;
00227 typedef struct GATListNode_S const *GATListIterator_const;
00228 
00229 /* GATMetricListener */
00230 typedef GATResult (*GATMetricListener)(void *, GATMetricEvent);
00231 
00232 /* GATRequestListener */
00233 typedef GATResult (*GATRequestListener)(void *, GATRequest_const);
00234 
00235 /* GATPipeListener */
00236 typedef GATResult (*GATPipeListener)(void *, GATPipe);
00237 
00238 /** ErrorMessageHandler
00239  *  
00240  *  The ErrorMessageHandler function prototype is used for callbacks, which have 
00241  *  to be registered with the GATSelf_AddErrorMessageHandler. These callbacks
00242  *  are called to get the textual representation of a specific error code (error 
00243  *  messages).
00244  *  The engine decides, which callback function to call based on the facility
00245  *  code (bits 16...27 of the error code value). This way every single adaptor
00246  *  may define its own range of error values and can return the error message 
00247  *  corresponding to a given error code.
00248  *
00249  *  @param err_code The error code, for which the system needs to get the error 
00250  *        message.
00251  *  @param buffer The buffer, where to return the resulting error message.
00252  *  @param length The size of the given buffer. If this size is insufficient for 
00253  *        the error message to return, the error callback function should return
00254  *        the required length in the written output parameter and it should 
00255  *        additionally return the GAT_BUFFER_TOO_SMALL return value to the 
00256  *        caller.
00257  *  @param written The pointer to a variable, which should receive the real
00258  *        size of the generated error message.
00259  *
00260  *  @return An error code.
00261  */
00262 typedef GATResult (*GATErrorMessageHandler)(GATResult err_code, char *buffer, 
00263     GATuint32 length, GATuint32 *written);
00264 
00265 /* the GATType enum holds all the different GAT types */
00266 typedef enum 
00267 {
00268   GATType_GATint16                       = 1,
00269   GATType_GATint32                       = 2,
00270   GATType_GATuint16                      = 3,
00271   GATType_GATuint32                      = 4,
00272   GATType_GATfloat32                     = 5,
00273   GATType_GATdouble64                    = 6,
00274   GATType_String                         = 7,
00275   GATType_PlainOldData                   = 8,
00276   GATType_GATObject                      = 0x00010000, /* this is actually a flag */
00277   GATType_GATStatus                      = 0x00010020,
00278   GATType_GATList                        = 0x00010021,
00279   GATType_GATTable                       = 0x00010022,
00280   GATType_GATResourceDescription         = 0x00010023,
00281   GATType_GATSoftwareResourceDescription = 0x00010024,
00282   GATType_GATHardwareResourceDescription = 0x00010025,
00283   GATType_GATFile                        = 0x00010026,
00284   GATType_GATLogicalFile                 = 0x00010027,
00285   GATType_GATLocation                    = 0x00010028,
00286   GATType_GATTime                        = 0x00010029,
00287   GATType_GATTimePeriod                  = 0x0001002A,
00288   GATType_GATSoftwareDescription         = 0x0001002B,
00289   GATType_GATPreferences                 = 0x0001002C,
00290   GATType_GATString                      = 0x0001002D,
00291   GATType_GATResourceBroker              = 0x0001002E,
00292   GATType_GATResource                    = 0x0001002F,
00293   GATType_GATSoftwareResource            = 0x00010030,
00294   GATType_GATHardwareResource            = 0x00010031,
00295   GATType_GATReservation                 = 0x00010032,
00296   GATType_GATJob                         = 0x00010033,
00297   GATType_GATJobDescription              = 0x00010034,
00298   GATType_GATMemoryStream                = 0x00010035,
00299   GATType_GATMetric                      = 0x00010036,
00300   GATType_GATMetricEvent                 = 0x00010037,
00301   GATType_GATMonitorable_Impl            = 0x00010038,
00302   GATType_GATEndpoint                    = 0x00010039,
00303   GATType_GATPipe                        = 0x0001003A,
00304   GATType_GATFileStream                  = 0x0001003B,
00305   GATType_GATSelf                        = 0x0001003C,
00306   GATType_GATRequest                     = 0x0001003D,
00307   GATType_GATRequestNotifier             = 0x0001003E,
00308   GATType_GATContext                     = 0x0001003F,
00309   GATType_GATErrorContext                = 0x00010040,
00310   GATType_GATSecurityContext             = 0x00010041,
00311   GATType_GATAdvertService               = 0x00010042,
00312   GATType_GATRegistry                    = 0x00010043,
00313   GATType_NoType                         = ~0x0
00314 } GATType;
00315 
00316 /* The GATInterface enum holds all the different interfaces GATObjects may 
00317    support */
00318 typedef enum 
00319 {
00320   GATInterface_ISerialisable = 1,
00321   GATInterface_IResource = 2,
00322   GATInterface_IAdvertisable = 3,
00323   GATInterface_IStreamable = 4,
00324   GATInterface_IAsyncStreamable = 5,  /* derived from IStreamable */
00325   GATInterface_IMonitorable = 6,
00326   GATInterface_IMetricListener = 7
00327 } GATInterface;
00328 
00329 /* The GATOrigin enum holds the origin from which to calculate the new 
00330    seek-pointer location for the GATStreamable_Seek functionality */
00331 typedef enum
00332 {
00333   GATOrigin_Set = 0,      /* relative to the beginning of the stream. */
00334   GATOrigin_Current = 1,  /* relative to the current seek pointer location */
00335   GATOrigin_End = 2       /* offset relative to the end of the stream */
00336 } GATOrigin;
00337 
00338 /* Measurement type of the value associated with a GATMetric */
00339 typedef enum 
00340 {
00341   GATMeasurementType_Unknown = 0,
00342   GATMeasurementType_Continuous = 1,  /* data is always available */ 
00343   GATMeasurementType_EventLike = 2    /* data only becomes available when some 
00344         external event happens */
00345 } GATMeasurementType;
00346 
00347 /* Mode for creating a GATLogicalFile */
00348 typedef enum
00349 {
00350   GATLogicalFileMode_Open = 0,      /* open, if log file exists */
00351   GATLogicalFileMode_Create = 1,    /* create new, if log file does not exist */
00352   GATLogicalFileMode_Truncate = 2,  /* create new, if log file exists */
00353 } GATLogicalFileMode;
00354 
00355 /* Mode for opening a GATFileStream */
00356 typedef enum
00357 {
00358   GATFileStreamMode_Read = 0,       /* Open file for reading. The stream is 
00359         positioned at the beginning of the file. */
00360   GATFileStreamMode_Write = 1,      /* Open file for writing. The stream is 
00361         positioned at the beginning of the file. */
00362   GATFileStreamMode_Append = 2,     /* Open file for appending. The stream is 
00363         positioned at the end of the file. */
00364   GATFileStreamMode_ReadWrite = 3   /* Open or create file for reading and 
00365         writing. The stream is positioned at the beginning of the file. */
00366 } GATFileStreamMode;
00367 
00368 /* Mode for copy and move operations on a GATFile */
00369 typedef enum
00370 {
00371   GATFileMode_FailIfExists = 0,     /* fail operation, if destination exists */
00372   GATFileMode_Overwrite = 1,        /* overwrite, if file exists */
00373 } GATFileMode;
00374 
00375 /* The possible states of a GATJob */
00376 typedef enum {
00377   GATJobState_Unknown = 0,
00378   GATJobState_Initial = 1,          /* The GATJob instance has been submitted 
00379         to an underlying resource management service but has not yet been 
00380         submitted to a specific resource. */
00381   GATJobState_Scheduled = 2,        /* The GATJob instance has been submitted 
00382         by an underlying resource management service to a resource, and the 
00383         GATJob is scheduled to run. */
00384   GATJobState_SubmissionError = 3,  /* An error occurred when trying to submit 
00385         this job, either to an underlying resource management service, or when 
00386         such a service tried to submit to a queuing system or otherwise 
00387         dispatch the job. A description of the error SHOULD be available from a 
00388         GATStatus instance available by invoking the GetStatus operation. */
00389   GATJobState_Running = 4,          /* The process represented by the GATJob 
00390         instance is being executed. */
00391   GATJobState_Stopped = 5           /* The GATJob instance was running but is 
00392         not currently running. That state can be reached by a successful call 
00393         to the operation Stop, or due to the GATJob completing, or crashing. */
00394 } GATJobState;
00395 
00396 /* The possible types of a GAT request */
00397 typedef enum 
00398 {
00399   GATRequestType_Command = 0,     /* A GAT application specifies that it can 
00400         perform some operation */
00401   GATRequestType_Information = 1  /* A GAT application specifies that it can 
00402         provide some information */
00403 } GATRequestType;
00404 
00405 /* Possible GATSecurityContext types */
00406 typedef enum 
00407 {
00408   GATSecurityContextType_Password,
00409   GATSecurityContextType_Certificate,
00410   GATSecurityContextType_Remote
00411 } GATSecurityContextType;
00412 
00413 /* Function prototypes */
00414 
00415 /** GATType_GetName
00416  *  
00417  *  The function GATType_GetName returns a string containing the readable
00418  *  representation of the given GATType.
00419  *
00420  *  @param type The type, for which the readble name should be returned.
00421  *
00422  *  @return The readable name of the given GATType or NULL if the type 
00423  *        parameter doesn't refer to a known GATType.
00424  */
00425 char const *GATType_GetName(GATType type);
00426 
00427 #endif /* _GATTYPE_H_ */