GridLab
Grid Application Toolkit

A simple API for Grid Applications
GAT

Menu



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

GATSelf.h

Go to the documentation of this file.
00001 /** @file GATSelf.h
00002  * Header file for the GATSelf class.
00003  * 
00004  * The GATSelf class corresponds to the current GAT job.  There is
00005  * only ever one instance of this class, which is
00006  * obtained by the GetInstance method.  This object can be used to
00007  * change various properties of this job, such as whether it is
00008  * checkpointable or not, and what metrics or events it can report.  It
00009  * can also provide the  GATJob instance associated with this
00010  * job, which may then be advertised.
00011  * 
00012  * @date Tue Sep 2 2003
00013  * 
00014  * @version $Header: /export/cvs-gridlab/wp-1/Codes/GATEngine/C-reference/src/GATSelf.h,v 1.15 2004/05/12 18:56:01 hartmutkaiser Exp $
00015  *
00016  *  Copyright (C) Tom Goodale
00017  *  This file is part of the GAT Engine.
00018  *  Contributed by Tom Goodale <goodale@aei.mpg.de>.
00019  *
00020  *  Use, modification and distribution is subject to the Gridlab Software
00021  *  License. (See accompanying file GLlicense.txt or copy at
00022  *  http://www.gridlab.org/GLlicense.txt)
00023  */
00024 
00025 
00026 #ifndef _GATSELF_H_
00027 #define _GATSELF_H_ 1
00028 
00029 #include "GATContext.h"
00030 #include "GATJob.h"
00031 #include "GATRequest.h"
00032 
00033 #include "GATRegistry.h"
00034 
00035 #ifdef __cplusplus
00036 extern "C" 
00037 {
00038 #endif
00039 
00040 /* Declare the converters to/from GATObject */
00041 GATOBJECT_DECLARE_CONVERTERS(GATSelf);
00042 
00043 /** GATSelf_GetInstance
00044  *  
00045  */
00046 GATSelf_const 
00047   GATSelf_GetInstance(GATContext context);
00048 
00049 /** GATSelf_AddRequestListener
00050  *  
00051  */
00052 GATResult 
00053   GATSelf_AddRequestListener(GATContext context, GATRequestListener listener, 
00054     void *data, GATRequestType type, GATTable_const parameters, 
00055     const char *name, GATuint32 *cookie);
00056 
00057 /** GATSelf_RemoveRequestListener
00058  *  
00059  */
00060 GATResult
00061   GATSelf_RemoveRequestListener(GATContext context, GATuint32 cookie);
00062 
00063 /** GATSelf_GetJob
00064  *  
00065  */
00066 GATResult 
00067   GATSelf_GetJob(GATContext context, GATJob *job);
00068 
00069 /** GATSelf_AddErrorMessageHandler
00070  *  
00071  *  The GATSelf_AddErrorMessageHandler function registeres the given callback 
00072  *  function with the engine. This callback function is used by the engine to 
00073  *  get the error message corresponding to a given error code. The callback
00074  *  function is called for error codes belonging to the given facility (the 
00075  *  facility code is contained in the error code, namely bits 16...27).
00076  *
00077  *  @param facility The facility code, for which this callback function has to 
00078  *        be called.
00079  *  @param callback The callback function to call to get the error messages for 
00080  *        error codes belon ing to the given facility.
00081  *  @param cookie The pointer to a variable, which receives a unique cookie
00082  *        representing the registered function, which should be used to remove
00083  *        the registration of this function later on.
00084  *
00085  *  @return An error code.
00086  */
00087 GATResult
00088   GATSelf_AddErrorMessageHandler(GATuint32 facility, 
00089     GATErrorMessageHandler handler, GATuint32 *cookie);
00090   
00091 /** GATSelf_RemoveErrorMessageHandler
00092  *  
00093  *  The GATSelf_RemoveErrorMessageHandler function removes the registration of
00094  *  the error message handler associated with the given cookie.
00095  */
00096 GATResult
00097   GATSelf_RemoveErrorMessageHandler(GATuint32 *cookie);
00098 
00099 /** GATSelf_ResolveErrorMessage
00100  *  
00101  *  The function GATSelf_ResolveErrorMessage returns an error message 
00102  *  associated with the given error code.
00103  *
00104  *  @param err_code The error code, for which the system needs to get the error 
00105  *        message.
00106  *  @param buffer The buffer, where to return the resulting error message.
00107  *  @param length The size of the given buffer. If this size is insufficient for 
00108  *        the error message to return, the error callback function should return
00109  *        the required length in the written output parameter and it should 
00110  *        additionally return the GAT_BUFFER_TOO_SMALL return value to the 
00111  *        caller.
00112  *  @param written The pointer to a variable, which should receive the real
00113  *        size of the generated error message.
00114  *
00115  *  @return An error code.
00116  */
00117 GATResult
00118   GATSelf_ResolveErrorMessage(GATResult err_code, char *buffer, 
00119     GATuint32 length, GATuint32 *written);
00120     
00121 #ifdef __cplusplus
00122 }
00123 #endif
00124 
00125 #endif /* _GATSELF_H_ */