Main Page Alphabetical List Compound List File List Compound Members File Members
GATFile.c File Reference#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include "GAT.h"
#include "GATRegistry.h"
#include "GATInternal.h"
#include "GATFileCPI.h"
#include "GATMetricEvent.h"
#include "GATXdsWrapper.h"
Include dependency graph for GATFile.c:
Go to the source code of this file.
|
Compounds |
| struct | GATFile_S |
Functions |
| | GATOBJECT_DEFINE_VTABLE (GATFile) |
| | GATSERIALISABLE_DEFINE_VTABLE (GATFile) |
| | GATMONITORABLE_DEFINE_VTABLE (GATFile) |
| | GATOBJECT_DEFINE_CONVERTERS (GATFile) |
| GATResult | GATFile_DeSerialise_Create (GATContext context, GATObject stream, char const *name, GATFile *new_file) |
| | GATFile_DeSerialise_Create.
|
| GATResult | GATFile_GetCPIInstanceData (GATFile file, void **data) |
| GATResult | GATFile_Register_GATSerialisable (void) |
| | GATFile_Register_GATSerialisable The GATFile_Register_GATSerialisable function registers the serialization vtable with the GAT engine to allow generic object creation.
|
| GATFile | GATFile_Create (GATContext context, GATLocation_const location, GATPreferences_const preferences) |
| | GATFile_Create The GATFile constructor.
|
| GATFile | GATFile_Create_Name (GATContext context, char const *name, GATPreferences preferences) |
| | GATFile_Create_Name The GATFile constructor.
|
| void | GATFile_Destroy (GATFile *file) |
| | GATFile_Destroy The GATFile destructor.
|
| GATType | GATFile_GetType (GATFile_const file) |
| | int GATFile_GetType(GATFile_const file) Return the type of the GATFile
|
| GATResult | GATFile_Clone (GATFile_const filehandle, GATFile *new_object) |
| | int GATFile_Clone(GATFile_const filehandle, GATFile *new_file) Clone the given GATFile
|
| GATResult | GATFile_Equals (GATFile_const lhs, GATFile_const rhs, GATBool *isequal) |
| | int GATFile_Equals(GATFile_const lhs, GATFile_const rhs, GATBool *isequal) Compares two GATFile objects
|
| GATResult | GATFile_GetInterface (GATFile_const file, GATInterface iftype, void const **ifp) |
| | int GATFile_GetInterface(GATFile_const file, GATInterface iftype, void const **ifp) Get an interface supported by a GATFile
|
| GATLocation_const | GATFile_GetLocation (GATFile_const file) |
| | GATFile_GetLocation This method returns the Location of this File.
|
| GATResult | GATFile_Copy (GATFile_const file, GATLocation_const targetLocation, GATFileMode mode) |
| | GATFile_Copy Copy a file from one location to another.
|
| GATResult | GATFile_Move (GATFile_const file, GATLocation_const targetLocation, GATFileMode mode) |
| | GATFile_Move Move a file from one location to another.
|
| GATResult | GATFile_Delete (GATFile_const file) |
| | GATFile_Delete Delete a file.
|
| GATResult | GATFile_IsReadable (GATFile_const file) |
| | GATFile_IsReadable Check the file attributes for the readable flag.
|
| GATResult | GATFile_IsWritable (GATFile_const file) |
| | GATFile_IsWritable Check the file attributes for the writable flag.
|
| GATResult | GATFile_GetLength (GATFile_const file, unsigned long *length) |
| | GATFile_GetLength Returns the size of the given file.
|
| GATResult | GATFile_LastWriteTime (GATFile_const file, GATTime *lw_time) |
| | GATFile_LastWriteTime Returns the time of last modification of the given file.
|
| GATResult | GATFile_AddMetricListener (GATFile file, GATMetricListener listener, void *listener_data, GATMetric metric, GATuint32 *cookie) |
| | GATFile_AddMetricListener.
|
| GATResult | GATFile_RegisterPolling (GATFile file, GATMetric metric, GATMetricEvent *event, GATuint32 *cookie) |
| | GATFile_RegisterPolling.
|
| GATResult | GATFile_RemoveRegisteredMetric (GATFile file, GATMetric metric, GATuint32 cookie) |
| | GATFile_RemoveRegisteredMetric.
|
| GATResult | GATFile_GetMetrics (GATFile_const file, GATList_GATMetric *metrics) |
| | GATFile_GetMetrics.
|
| GATResult | GATFileCPI_SerialiseCallback (GATObject object, GATObject stream, GATBool clear_dirty) |
| | GATFileCPI_SerialiseCallback.
|
| GATResult | GATFile_Serialise (GATFile file, GATObject stream, GATBool clear_dirty) |
| | int GATFile_Serialise(GATFile file, GATObject stream, GATBool clear_dirty) Serialise a GATFile object
|
| GATBool | GATFileCPI_VersionCallback (GATuint32 version) |
| | GATFileCPI_VersionCallback.
|
| GATResult | GATFileCPI_DeSerialiseCallback (GATContext context, GATObject stream, GATObject *object, GATuint32 version, va_list args) |
| | GATFileCPI_DeSerialiseCallback.
|
| GATFile | GATFile_DeSerialise (GATContext context, GATObject stream, GATResult *result) |
| | GATFile GATFile_DeSerialise(GATContext context, GATObject stream, GATBool clear_dirty) De-serialise a GATFile object.
|
| GATResult | GATFile_GetIsDirty (GATFile_const file, GATBool *isdirty) |
| | GATFile_GetIsDirty.
|
Variables |
| const char * | rcsid = "$Header: /export/cvs-gridlab/wp-1/Codes/GATEngine/C-reference/src/GATFile.c,v 1.61 2004/04/20 12:33:22 hartmutkaiser Exp $" |
| GATFile_vtable | GATFile__vtable |
| GATFile_ISerialisable_vtable | GATFile_ISerialisable__vtable |
| GATFile_IMonitorable_vtable | GATFile_IMonitorable__vtable |
Function Documentation
| GATOBJECT_DEFINE_VTABLE |
( |
GATFile |
|
) |
|
|
| GATSERIALISABLE_DEFINE_VTABLE |
( |
GATFile |
|
) |
|
|
| GATMONITORABLE_DEFINE_VTABLE |
( |
GATFile |
|
) |
|
|
| GATOBJECT_DEFINE_CONVERTERS |
( |
GATFile |
|
) |
|
|
|
|
GATFile_DeSerialise_Create.
The function GATFile_DeSerialise_Create creates a new GATFile object and tries to find a CPI provider to associate with this file object. The CPI provider is selected by testing, which adapter is able to handle the streamed instance data of the original CPI provider. - Parameters:
-
| context |
The GAT context to use for creation of the GATFile object. |
| stream |
The object from which the adaptor should read the streamed instance data. |
| name |
This is the URI of the file to reconstruct. |
| new_object |
The pointer to the variable, which should receive the newly constructed GATFile object. |
- Returns:
-
An error code.
Definition at line 1099 of file GATFile.c.
References GATFileCPI_Instance::context, GATFile_S::cpi, GATFile_S::cpilist, GATFile_S::data, GAT_CREATE_STATUS, GAT_CURRENT_STATUS, GAT_INVALID_PARAMETER, GAT_MEMORYFAILURE, GAT_NO_MATCHING_CPI, GAT_NO_REGISTERED_CPI, GAT_NOTIMPL, GAT_RETURN_STATUS, GAT_SUCCEEDED, GAT_SUCCESS, GAT_USES_STATUS, GATBool, GATContext_GetPreferences(), GATContext_internal_GetRegistry(), GATFalse, GATFile__vtable, GATFile_Destroy(), GATFile_IMonitorable__vtable, GATFile_ISerialisable__vtable, GATFileCPI_DeSerialise(), GATFileCPI_GetMetrics(), GATLocation_Create(), GATFile_S::GATMonitorable__vtable, GATMonitorable_Impl_Create(), GATFile_S::GATObject__vtable, GATOrigin_Current, GATOrigin_Set, GATPreferences_const, GATRegistry_const, GATResult, GATFile_S::GATSerialisable__vtable, GATStreamable_Seek(), GATTrue, GATuint32, GATFileCPI_Instance::isdirty, GATFileCPI_Instance::location, GATFileCPI_Instance::monitorable, name, and GATFileCPI_Instance::source.
Referenced by GATFileCPI_DeSerialiseCallback(). |
| GATResult GATFile_Register_GATSerialisable |
( |
void |
|
) |
|
|
|
|
GATFile_Create The GATFile constructor.
This is the constructor for GATFile objects.
- Returns:
-
A new GATFile
Definition at line 115 of file GATFile.c.
References GATFileCPI_Instance::context, GATFile_S::cpi, GATFile_S::cpilist, GATFile_S::data, GAT_CREATE_STATUS, GAT_CURRENT_STATUS, GAT_FAILED, GAT_MEMORYFAILURE, GAT_NO_REGISTERED_CPI, GAT_NOTIMPL, GAT_STATUS_APIENTRY, GAT_STORE_STATUS, GAT_SUCCEEDED, GAT_SUCCESS, GATBool, GATContext_GetPreferences(), GATContext_internal_GetRegistry(), GATFalse, GATFile__vtable, GATFile_Destroy(), GATFile_IMonitorable__vtable, GATFile_ISerialisable__vtable, GATFileCPI_CreateInstance(), GATFileCPI_GetMetrics(), GATLocation_Clone(), GATLocation_const, GATFile_S::GATMonitorable__vtable, GATMonitorable_Impl_Create(), GATFile_S::GATObject__vtable, GATPreferences_const, GATRegistry_const, GATResult, GATFile_S::GATSerialisable__vtable, GATTrue, GATFileCPI_Instance::isdirty, GATFileCPI_Instance::location, GATFileCPI_Instance::monitorable, and GATFileCPI_Instance::source.
Referenced by create_gatfile(), GATFile_Create_Name(), logical_filestore_getfiles(), logical_filestore_replicate(), and main(). |
| void GATFile_Destroy |
( |
GATFile * |
file |
) |
|
|
|
|
GATFile_Destroy The GATFile destructor.
This is the destructor for GATFile objects. - Parameters:
-
Definition at line 252 of file GATFile.c.
References GATFileCPI_DestroyInstance(), GATLocation_Destroy(), and GATMonitorable_Impl_Destroy().
Referenced by create_software_description(), GATFile_Clone(), GATFile_Create(), GATFile_DeSerialise_Create(), GATFileCPI_DeSerialiseCallback(), get_sw_description_direct(), logical_filestore_getfiles(), logical_filestore_replicate(), main(), verify_direct_serialisation(), and verify_generic_serialisation(). |
|
|
int GATFile_Clone(GATFile_const filehandle, GATFile *new_file) Clone the given GATFile
The function GATFile_Clone generates a (deep) copy of the given GATFile. - Parameters:
-
| filehandle |
The object to clone |
| new_file |
The pointer, through which the result is to be returned. |
- Returns:
-
An error type.
Definition at line 297 of file GATFile.c.
References assert, GATFileCPI_Instance::context, GATFile_S::cpi, GATFile_S::cpilist, GATFile_S::data, GAT_CREATE_STATUS, GAT_CURRENT_STATUS, GAT_FAILED, GAT_INVALID_HANDLE, GAT_INVALID_PARAMETER, GAT_MEMORYFAILURE, GAT_RETURN_STATUS, GAT_SUCCEEDED, GAT_USES_STATUS, GATFalse, GATFile__vtable, GATFile_const, GATFile_Destroy(), GATFile_IMonitorable__vtable, GATFile_ISerialisable__vtable, GATFileCPI_CloneInstance(), GATLocation_Clone(), GATFile_S::GATMonitorable__vtable, GATMonitorable_Impl_Clone(), GATFile_S::GATObject__vtable, GATResult, GATFile_S::GATSerialisable__vtable, GATFileCPI_Instance::isdirty, GATFileCPI_Instance::location, GATFileCPI_Instance::monitorable, and GATFileCPI_Instance::source. |
|
|
int GATFile_Equals(GATFile_const lhs, GATFile_const rhs, GATBool *isequal) Compares two GATFile objects
The function GATFile_Equals compares two file objects of type #GATFile. - Parameters:
-
| lhs |
The first file object to compare |
| rhs |
The second file object to compare |
| isequal |
The pointer to the GATBool variable, which should receive the result if the comparision |
- Returns:
-
An error code.
Definition at line 401 of file GATFile.c.
References GAT_CREATE_STATUS, GAT_INVALID_HANDLE, GAT_INVALID_PARAMETER, GAT_RETURN_STATUS, GAT_STATUS_APIENTRY, GATBool, GATFile_const, GATFileCPI_EqualsInstance(), GATLocation_Equals(), and GATTrue.
Referenced by verify_direct_serialisation(), and verify_generic_serialisation(). |
|
|
int GATFile_GetInterface(GATFile_const file, GATInterface iftype, void const **ifp) Get an interface supported by a GATFile
The function GATFile_GetInterface allows to get a pointer to an additional interface supported by this GATFile. - Parameters:
-
| object |
The object to be asked for the new interface. |
| iftype |
The interface the object is to be asked for. |
| ifp |
The pointer, through which the result is to be returned. |
- Returns:
-
An error type.
Definition at line 438 of file GATFile.c.
References GAT_CREATE_STATUS, GAT_INVALID_HANDLE, GAT_INVALID_PARAMETER, GAT_NO_INTERFACE, GAT_RETURN_STATUS, GAT_STATUS_APIENTRY, GATFile_const, GATInterface, GATInterface_IAdvertisable, GATInterface_IMonitorable, and GATInterface_ISerialisable. |
|
|
GATFile_IsReadable Check the file attributes for the readable flag.
The function GATFile_IsReadable checks the file attributes of the given file and returns, whether it is readable. - Parameters:
-
| this |
The file to be inspected for its readability attribute. |
- Returns:
-
If the inspected file is readable, the function returns
#GAT_SUCCESS, if it is not readable, #GAT_FALSE is returned. Otherwise the function returns any of the possible errorcodes.
Definition at line 574 of file GATFile.c.
References GAT_CREATE_STATUS, GAT_INVALID_HANDLE, GAT_RETURN_STATUS, GAT_STATUS_APIENTRY, GATFile_const, and GATFileCPI_IsReadable().
Referenced by main(). |
|
|
GATFile_IsWritable Check the file attributes for the writable flag.
The function GATFile_IsWritable checks the file attributes of the given file and returns, whether it is writable. - Parameters:
-
| this |
The file to be inspected for its writability attribute. |
- Returns:
-
If the inspected file is writable, the function returns
#GAT_SUCCESS, if it is not writable, #GAT_FALSE is returned. Otherwise the function returns any of the possible errorcodes.
Definition at line 598 of file GATFile.c.
References GAT_CREATE_STATUS, GAT_INVALID_HANDLE, GAT_RETURN_STATUS, GAT_STATUS_APIENTRY, GATFile_const, and GATFileCPI_IsWritable().
Referenced by main(). |
|
|
GATFile_AddMetricListener.
The function GATFile_AddMetricListener adds the passed instance of a GATMetricListener to the list of GATMetricListeners which are notified of fired GATMetricEvents of the type described by the provided GATMetric instance. - Parameters:
-
| file |
The GATFile instance to add the GATMetricListener to. |
| listener |
The GTAMetricListener to call, when the corresponding GATMetricEvent is fired. |
| listener_data |
The client supplied data, which will be passed through to the GATMetricListener. |
| metric |
The GATMetric instance describing the GATMetricEvent to pass to the GATMetricListener. |
| cookie |
The returned value should be used to remove the GATMetricListener from this GATMonitorable. |
- Returns:
-
An error code.
Definition at line 679 of file GATFile.c.
References GATFileCPI_Instance::context, GATFile_S::data, GAT_CREATE_STATUS, GAT_INVALID_HANDLE, GAT_NO_INTERFACE, GAT_RETURN_STATUS, GAT_STATUS_APIENTRY, GATMetric, GATMetricListener, GATMonitorable_Impl_AddMetricListener(), GATResult, GATuint32, and GATFileCPI_Instance::monitorable. |
|
|
GATFile_RegisterPolling.
The function GATFile_RegisterPolling registers a continuous metric with the given GATFile instance. - Parameters:
-
| file |
The GATFile instance to register the metric with. |
| metric |
The GATMetric instance describing the GATMetricEvent to pass to the GATMetricListener. This metric instance must be of type GATMeasurementType_Continuous, otherwise an error is returned. |
| event |
The pointer to a variable, which should receive the resulting GATMetricEvent. The GATMetricEvent instance should be freed by the caller when it isn't used anymore. |
| cookie |
The returned value should be used to remove the GATMetricListener from this GATFile. |
- Returns:
-
An error code.
Definition at line 720 of file GATFile.c.
References GATFileCPI_Instance::context, GATFile_S::cpi, GATFile_S::data, GAT_CREATE_STATUS, GAT_CURRENT_STATUS, GAT_FAILED, GAT_INVALID_HANDLE, GAT_NO_INTERFACE, GAT_RETURN_STATUS, GAT_STATUS_APIENTRY, GATFileCPI_GetMetricEvent(), GATMetric, GATMonitorable_Impl_RegisterPolling(), GATMonitorable_Impl_RemoveRegisteredMetric(), GATuint32, and GATFileCPI_Instance::monitorable. |
|
|
GATFile_RemoveRegisteredMetric.
The function GATFile_RemoveRegisteredMetric removes a GATMetricListener, which was previously registered with GATFile_AddMetricListener. - Parameters:
-
| file |
The GATFile instance to remove the GATMetricListener from. |
| metric |
The GATMetric instance describing the GATMetricEvent to pass to the GATMetricListener. |
| cookie |
This value identifies the GATMetricListener to remove, it was returned from the corresponding GATMonitorable_AddMetricListener or GATMonitorable_MetricRegisterPolling functions. |
- Returns:
-
An error code.
Definition at line 768 of file GATFile.c.
References GATFileCPI_Instance::context, GATFile_S::data, GAT_CREATE_STATUS, GAT_INVALID_HANDLE, GAT_NO_INTERFACE, GAT_RETURN_STATUS, GAT_STATUS_APIENTRY, GATMetric, GATMonitorable_Impl_RemoveRegisteredMetric(), GATResult, GATuint32, and GATFileCPI_Instance::monitorable. |
|
|
GATFileCPI_SerialiseCallback.
The function GATFileCPI_SerialiseCallback is used as a callback function for the serialisation of a GATFile object. It should be provided to serialise the associated CPI provider data for the given object. - Parameters:
-
| object |
The object to serialise. This is the same as the object passed as the first parameter to the function GATXds_SerialiseObject. |
| stream |
The stream interface to use for the serialisation. |
| clear_dirty |
If the clear_dirty parameter is set to GATTrue, the internal dirty flag of this object is to be reset (no used here) |
- Returns:
-
An error code.
- Remarks:
-
This function is called from the GAT engine, there is no need to call it directly.
Definition at line 846 of file GATFile.c.
References GATFileCPI_Instance::context, GATFile_S::cpi, GATFile_S::data, GAT_CREATE_STATUS, GAT_CURRENT_STATUS, GAT_INVALID_HANDLE, GAT_RETURN_STATUS, GAT_SUCCEEDED, GAT_USES_STATUS, GATBool, GATFalse, GATFileCPI_Serialise(), GATTrue, and GATFileCPI_Instance::isdirty.
Referenced by GATFile_Serialise(). |
|
|
int GATFile_Serialise(GATFile file, GATObject stream, GATBool clear_dirty) Serialise a GATFile object
The function GATFile_Serialise serialises the given GATFIle object into the given stream. - Parameters:
-
| file |
The GATFile object to serialise. |
| stream |
The stream interface to use for the serialisation. |
| clear_dirty |
If the clear_dirty parameter is set to GATTrue, the internal dirty flag of this object is to be reset (no used here) |
- Returns:
-
An error code.
Definition at line 881 of file GATFile.c.
References GATFileCPI_Instance::context, GATFile_S::data, GAT_CREATE_STATUS, GAT_INVALID_HANDLE, GAT_MEMORYFAILURE, GAT_RETURN_STATUS, GAT_USES_STATUS, GATBool, GATFile_GetLocation(), GATFILE_VERSION1, GATFileCPI_SerialiseCallback(), GATLocation_ToString(), GATXds_SerialiseObject(), and name.
Referenced by verify_direct_serialisation(). |
|
|
GATFileCPI_VersionCallback.
The function GATFileCPI_VersionCallback is used as a callback function during the de-serialisation of a GATFile. It should be provided to test, whether the de-serialised version matches the expected version. - Parameters:
-
| version |
The version number, which was de-serialised from the stream. |
- Returns:
-
This function should return GATTrue, if the version matches the expected value (version is valid), GATFalse otherwise.
- Remarks:
-
This function is called from the GAT engine, there is no need to call it directly.
Definition at line 924 of file GATFile.c.
References GATBool, GATFalse, GATFILE_LASTVERSION, GATFILE_MINOR_MASK, GATTrue, and GATuint32.
Referenced by GATFile_DeSerialise(). |
|
|
GATFileCPI_DeSerialiseCallback.
The function GATFileCPI_DeSerialiseCallback is used as a callback function during the de-serialisation of a GATFile. It should be provided for the instantiation of the new GATFile object based on the already de-serialised data items and the de-serialisation of the associated CPI provider data for the given object. - Parameters:
-
| context |
The GAT context to be used for object construction. |
| stream |
The stream interface to use for the serialisation. |
| object |
The pointer to the variable, which should receive the newly constructed object. |
| version |
The version of the saved data read from the input stream. |
| args |
This parameter is the pointer to the va_list containing pointers to the already de-serialised data items accordingly to the format string, provided during the call to the GATFile_DeSerialise function. |
- Returns:
-
An error code.
- Remarks:
-
This function is called from the GAT engine, there is no need to call it directly.
Definition at line 958 of file GATFile.c.
References GAT_CREATE_STATUS, GAT_CURRENT_STATUS, GAT_INVALID_PARAMETER, GAT_RETURN_STATUS, GAT_SUCCEEDED, GAT_UNUSED_PARAMETER, GAT_USES_STATUS, GATFile_DeSerialise_Create(), GATFile_Destroy(), GATuint32, and name.
Referenced by GATFile_DeSerialise(). |
|
|
GATFile GATFile_DeSerialise(GATContext context, GATObject stream, GATBool clear_dirty) De-serialise a GATFile object.
The function GATFile_DeSerialise de-serialises a streamed GATFile object from the given stream It constructs a new instance of the de-serialised object. - Parameters:
-
| context |
The GAT context to be used for object construction. |
| stream |
The stream interface to use for the serialisation. |
| result |
The pointer to a variable, which receives the status code of the operation. |
- Returns:
-
The newly constructed GATFile object.
Definition at line 1005 of file GATFile.c.
References GAT_BAD_OBJECT_CONVERSION, GAT_CREATE_STATUS, GAT_CURRENT_STATUS, GAT_FAILED, GAT_STORE_STATUS, GAT_USES_STATUS, GATFileCPI_DeSerialiseCallback(), GATFileCPI_VersionCallback(), GATObject_Destroy(), GATResult, GATuint32, GATXds_DeSerialiseObject(), and name.
Referenced by verify_direct_serialisation(). |
Variable Documentation
const char* rcsid = "$Header: /export/cvs-gridlab/wp-1/Codes/GATEngine/C-reference/src/GATFile.c,v 1.61 2004/04/20 12:33:22 hartmutkaiser Exp $" [static]
|
|
GATFile_vtable GATFile__vtable [static]
|
|
GATFile_ISerialisable_vtable GATFile_ISerialisable__vtable [static]
|
|
GATFile_IMonitorable_vtable GATFile_IMonitorable__vtable [static]
|
|
|