GridLab
Grid Application Toolkit

A simple API for Grid Applications
GAT

Menu



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

GATLogicalFile.h

Go to the documentation of this file.
00001 /** @file GATLogicalFile.h
00002  * Header file for the GATLogicalFile class.
00003  *
00004  * @date Thu Oct 16 2003
00005  *
00006  * @version $Header: /export/cvs-gridlab/wp-1/Codes/GATEngine/C-reference/src/GATLogicalFile.h,v 1.18 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(_GATLOGICALFILE_H_)
00018 #define _GATLOGICALFILE_H_
00019 
00020 #include "GATType.h"
00021 #include "GATList.h"
00022 #include "GATMonitorable.h"
00023 
00024 #ifdef __cplusplus
00025 extern "C" {
00026 #endif
00027 
00028 /* GATList_GATLogicalFile */
00029 GATLIST_DECLARE_QUALIFIED(extern, GATFile, GATList_GATFile);
00030 
00031 /* Declare the converters to/from GATObject */
00032 GATOBJECT_DECLARE_CONVERTERS(GATLogicalFile);
00033 
00034 /** GATLogicalFile_Create
00035  *  The  GATLogicalFile constructor.
00036  *  This is the constructor for GATLogicalFile objects.
00037  *
00038  * @return A new GATLogicalFile
00039  */
00040 GATLogicalFile 
00041   GATLogicalFile_Create(GATContext context, GATLocation location, 
00042     GATLogicalFileMode mode, GATPreferences_const preferences);
00043 
00044 /** GATLogicalFile_Destroy
00045  *  The GATLogicalFile destructor.
00046  *  This is the destructor for GATLogicalFile objects.
00047  *
00048  * @param this An old GATLogicalFile
00049  */
00050 void 
00051   GATLogicalFile_Destroy(GATLogicalFile *listhandle);
00052 
00053 /** int GATLogicalFile_Equals(GATLogicalFile_const lhs, GATLogicalFile_const rhs, GATBool *isequal)
00054  *  @brief Compares two GATLogicalFile objects
00055  *
00056  *  The function @c GATLogicalFile_Equals compares two file objects of type 
00057  *  @c #GATLogicalFile.
00058  *
00059  *  @param lhs The first file object to compare
00060  *  @param rhs The second file object to compare
00061  *  @param isequal The pointer to the GATBool variable, which should receive 
00062  *        the result if the comparision
00063  *
00064  *  @return An error code.
00065  */
00066 GATResult
00067   GATLogicalFile_Equals(GATLogicalFile_const lhs, GATLogicalFile_const rhs, 
00068     GATBool *isequal);
00069 
00070 /** int GATLogicalFile_GetType(GATLogicalFile_const file)
00071  *  @brief Return the type of the GATLogicalFile
00072  *
00073  *  The function @c GATLogicalFile_GetType always returns GATType_GATLogicalFile. 
00074  *
00075  *  @param object The object to inspect
00076  *
00077  *  @return returns always @c #GATType_GATLogicalFile.
00078  */
00079 GATType
00080   GATLogicalFile_GetType(GATLogicalFile_const logfile);
00081   
00082 /** int GATLogicalFile_Clone(GATLogicalFile_const filehandle, GATLogicalFile *new_file)
00083  *  @brief Clone the given GATLogicalFile
00084  *
00085  *  The function @c GATLogicalFile_Clone generates a (deep) copy of the given
00086  *  GATLogicalFile. 
00087  *
00088  *  @param filehandle The object to clone
00089  *  @param new_file The pointer, through which the result is to be 
00090  *        returned.
00091  *
00092  *  @return An error type.
00093  */
00094 GATResult
00095   GATLogicalFile_Clone(GATLogicalFile_const logfile, GATLogicalFile *new_list);
00096   
00097 /** int GATLogicalFile_GetInterface(GATLogicalFile_const file, GATInterface iftype, void const **ifp)
00098  *  @brief Get an interface supported by a GATLogicalFile
00099  *
00100  *  The function GATLogicalFile_GetInterface allows to get a pointer to an 
00101  *  additional interface supported by this GATLogicalFile.
00102  *
00103  *  @param object The object to be asked for the new interface.
00104  *  @param iftype The interface the object is to be asked for.
00105  *  @param ifp The pointer, through which the result is to be returned.
00106  *
00107  *  @return An error type.
00108  */
00109 GATResult 
00110   GATLogicalFile_GetInterface(GATLogicalFile_const file, GATInterface iftype, 
00111     void const **ifp);
00112 
00113 /** int GATLogicalFile_AddFile(GATLogicalFile filehandle, GATFile target)
00114  *  @brief Add a file to the logical file store.
00115  *
00116  *  The function @c GATLogicalFile_AddFile adds the passed GATFile instance to 
00117  *  the set of physical files represented by this GATLogicalFile instance.
00118  *
00119  *  @param filehandle The logfile to which the physical should be added.
00120  *  @param target The physical file to be added to the logical file store.
00121  *
00122  *  @return An error code.
00123  */ 
00124 GATResult
00125   GATLogicalFile_AddFile(GATLogicalFile logfile, GATFile_const target);
00126   
00127 /** int GATLogicalFile_RemoveFile(GATLogicalFile filehandle, GATFile target)
00128  *  @brief Remove a file from the logical file store
00129  *
00130  *  The functions @c GATLogicalFile_RemoveFile removes the passed GATFile 
00131  *  instance from the set of physical files represented by this GATLogicalFile
00132  *  instance.
00133  *
00134  *  @param filehandle The logfile from which the physical should be removed.
00135  *  @param target The physical file to be removed from the logical file store.
00136  *
00137  *  @return An error code.
00138  */
00139 GATResult
00140   GATLogicalFile_RemoveFile(GATLogicalFile logfile, GATFile_const target);
00141 
00142 /** int GATLogicalFile_Replicate(GATLogicalFile_const filehandle, GATLocation_const target)
00143  *  @brief Replicate the logical file store
00144  *
00145  *  The functions GATLogicalFile_Replicate replicates the logical file 
00146  *  represented by this instance to the physical file specified by the passed 
00147  *  GATLocation.
00148  *
00149  *  @param filehandle The logfile from which the physical should be removed.
00150  *  @param target The physical file to replicate the logical file store to.
00151  *
00152  *  @return An error code.
00153  */
00154 GATResult
00155   GATLogicalFile_Replicate(GATLogicalFile_const logfile, 
00156     GATLocation_const target);
00157     
00158 /** int GATLogicalFile_GetFiles(GATLogicalFile_const logfile, GATList_GATFile *files)
00159  *  @brief Get the list of files of a logical file store.
00160  *
00161  *  The function GATLogicalFile_GetFiles returns a List of GATFile instances 
00162  *  each of which is a GATFile corresponding to a physical file represented by 
00163  *  this GATLogicalFile instance.
00164  *
00165  *  @param filehandle The logfile from which the physical should be removed.
00166  *  @param files The pointer to the variable, where the list of files is to be 
00167  *        returned to.
00168  *
00169  *  @return An error code.
00170  */
00171 GATResult
00172   GATLogicalFile_GetFiles(GATLogicalFile_const logfile, 
00173     GATList_GATFile *files);
00174 
00175 /** int GATLogicalFile_Remove(GATLogicalFile filehandle)
00176  *  @brief Removes the logical file store 
00177  *
00178  *  The functions @c GATLogicalFile_Remove removes the set of physical files 
00179  *  represented by this GATLogicalFile instance. All references to physical 
00180  *  files contained in this set are removed too.
00181  *
00182  *  @param filehandle The logfile, which should be removed.
00183  *
00184  *  @return An error code.
00185  */
00186 GATResult GATLogicalFile_Remove(GATLogicalFile logfile);
00187 
00188 
00189 /* GATMonitorable API */
00190 
00191 /** GATLogicalFile_AddMetricListener
00192  *
00193  *  The function GATLogicalFile_AddMetricListener adds the passed instance of a 
00194  *  GATMetricListener to the list of GATMetricListeners which are notified of 
00195  *  fired GATMetricEvents of the type described by the provided GATMetric 
00196  *  instance.
00197  *
00198  *  @param file The GATLogicalFile instance to add the GATMetricListener to.
00199  *  @param listener The GTAMetricListener to call, when the corresponding 
00200  *        GATMetricEvent is fired.
00201  *  @param listener_data The client supplied data, which will be passed through
00202  *        to the GATMetricListener.
00203  *  @param metric The GATMetric instance describing the GATMetricEvent to pass
00204  *        to the GATMetricListener.
00205  *  @param cookie The returned value should be used to remove the 
00206  *        GATMetricListener from this GATMonitorable.
00207  *
00208  *  @return An error code.
00209  */ 
00210 GATResult 
00211   GATLogicalFile_AddMetricListener(GATLogicalFile file, 
00212     GATMetricListener listener, void *listener_data, GATMetric metric,
00213     GATuint32 *cookie);
00214 
00215 /** GATLogicalFile_RegisterPolling
00216  *
00217  *  The function GATLogicalFile_RegisterPolling registers a continuous 
00218  *  metric with the given GATFile instance.
00219  *
00220  *  @param file The GATLogicalFile instance to register the metric with.
00221  *  @param metric The GATMetric instance describing the GATMetricEvent to pass
00222  *        to the GATMetricListener. This metric instance must be of type
00223  *        GATMeasurementType_Continuous, otherwise an error is returned.
00224  *  @param event The pointer to a variable, which should receive the resulting
00225  *        GATMetricEvent. The GATMetricEvent instance should be freed by the 
00226  *        caller when it isn't used anymore.
00227  *  @param cookie The returned value should be used to remove the 
00228  *        GATMetricListener from this GATLogicalFile.
00229  *
00230  *  @return An error code.
00231  */ 
00232 GATResult 
00233   GATLogicalFile_RegisterPolling(GATLogicalFile file, GATMetric metric, 
00234     GATMetricEvent *event, GATuint32 *cookie);
00235 
00236 /** GATLogicalFile_RemoveRegisteredMetric
00237  *
00238  *  The function GATLogicalFile_RemoveRegisteredMetric removes a GATMetricListener, 
00239  *  which was previously registered with GATLogicalFile_AddMetricListener.
00240  *
00241  *  @param file The GATLogicalFile instance to remove the GATMetricListener from.
00242  *  @param listener The GTAMetricListener to call, when the corresponding 
00243  *        GATMetricEvent is fired.
00244  *  @param metric The GATMetric instance describing the GATMetricEvent to pass
00245  *        to the GATMetricListener.
00246  *  @param cookie This value identifies the GATMetricListener to remove, it 
00247  *        was returned from the corresponding GATMonitorable_AddMetricListener 
00248  *        or GATMonitorable_MetricRegisterPolling functions.
00249  *  
00250  *  @return An error code.
00251  */
00252 GATResult 
00253   GATLogicalFile_RemoveRegisteredMetric(GATLogicalFile file, 
00254     GATMetric metric, GATuint32 cookie);
00255 
00256 /** GATLogicalFile_GetMetrics
00257  *
00258  *  The function GATLogicalFile_GetMetrics returns a list of metrics supported 
00259  *  by this GATLogicalFile.
00260  *
00261  *  @param file The GATLogicalFile instance, for which the supported metrics 
00262  *        should be returned.
00263  *  @param metrics The pointer to the variable, which receives the resulting 
00264  *        list of metrics.
00265  *
00266  *  @return An error code.
00267  */
00268 GATResult 
00269   GATLogicalFile_GetMetrics(GATLogicalFile_const file, 
00270     GATList_GATMetric *metrics);
00271 
00272 
00273 /* GATAdvertiseable API */
00274 #define GATLOGICALFILE_VERSION1    0x0100
00275 #define GATLOGICALFILE_LASTVERSION GATLOGICALFILE_VERSION1
00276 #define GATLOGICALFILE_MINOR_MASK  0x00ff
00277 
00278 /** int GATLogicalFile_Serialise(GATLogicalFile file, GATObject stream, GATBool clear_dirty)
00279  *  @brief Serialise a GATLogicalFile object
00280  *
00281  *  The function GATLogicalFile_Serialise serialises the given GATLogicalFile 
00282  *  object into the given stream. 
00283  *
00284  *  @param file The GATLogicalFile object to serialise.
00285  *  @param stream The stream interface to use for the serialisation.
00286  *  @param clear_dirty If the clear_dirty parameter is set to GATTrue, the 
00287  *        internal dirty flag of this object is to be reset (no used here)
00288  *
00289  *  @return An error code.
00290  */
00291 GATResult GATLogicalFile_Serialise(GATLogicalFile file, GATObject stream, 
00292   GATBool clear_dirty);
00293 
00294 /** GATLogicalFile GATLogicalFile_DeSerialise(GATContext context, GATObject stream, GATBool clear_dirty)
00295  *  @brief De-serialise a GATLogicalFile object
00296  *
00297  *  The function GATLogicalFile_DeSerialise de-serialises a streamed 
00298  *  GATLogicalFile object from the given stream  It constructs a new instance 
00299  *  of the de-serialised object.
00300  *
00301  *  @param context The GAT context to be used for object construction.
00302  *  @param stream The stream interface to use for the serialisation.
00303  *  @param result The pointer to a variable, which receives the status code of
00304  *        the operation.
00305  *
00306  *  @return The newly constructed GATLogicalFile object.
00307  */
00308 GATLogicalFile GATLogicalFile_DeSerialise(GATContext context, GATObject stream, 
00309   GATResult *result);
00310 
00311 /** GATLogicalFile_GetIsDirty
00312  *  
00313  *  The function GATLogicalFile_GetIsDirty retrieves the status of the dirty 
00314  *  flag of this GATLogicalFile object.
00315  *
00316  *  @param file The GATLogicalFile object to inspect for its dirty status.
00317  *  @param isdirty The pointer to a variable, which receives the dirty status.
00318  *
00319  *  @return An error code.
00320  */
00321 GATResult GATLogicalFile_GetIsDirty(GATLogicalFile_const file, GATBool *isdirty);
00322   
00323 #ifdef __cplusplus
00324 }
00325 #endif
00326 
00327 #endif /* !defined(_GATLOGICALFILE_H_) */