Main Page Alphabetical List Compound List File List Compound Members File Members
GATResource.c File ReferenceSource file for the GATResource class.
More...
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include "GAT.h"
#include "GATInternal.h"
#include "GATRegistry.h"
#include "GATResourceCPI.h"
#include "GATXdsWrapper.h"
#include "GATMetricEvent.h"
Include dependency graph for GATResource.c:
Go to the source code of this file.
|
Defines |
| #define | GATRESOURCE_IMPLEMENTATION(type) |
Functions |
| | GATOBJECT_DEFINE_VTABLE (GATResource) |
| | GATSERIALISABLE_DEFINE_VTABLE (GATResource) |
| | GATMONITORABLE_DEFINE_VTABLE (GATResource) |
| | GATRESOURCE_DEFINE_VTABLE (GATResource) |
| | GATOBJECT_DEFINE_CONVERTERS (GATResource)#define GATRESOURCE_IMPLEMENTATION(type) struct GATResource_S |
| GATResult | GATResource_DeSerialise_Create (GATContext context, GATObject stream, GATuint32 type, GATResource *new_object) |
| | GATResource_DeSerialise_Create.
|
| GATResource | GATResource_Impl_Create (GATType type, GATContext context, GATPreferences_const preferences, void *instance_data) |
| | GATResource_Impl_Create Create a new GATResource object.
|
| GATResult | GATResource_Impl_GetResourceDescription (GATResource_const object, GATResourceDescription_const *description) |
| | int GATResource_Impl_GetResourceDescription(GATResource_const object, GATResourceDescription_const *description)
|
| GATResult | GATResource_Impl_GetReservation (GATResource_const object, GATReservation_const *reservation) |
| | int GATResource_Impl_GetReservation(GATResource_const object, GATReservation_const *reservation)
|
| GATResult | GATResource_Impl_AddMetricListener (GATResource object, GATMetricListener listener, void *listener_data, GATMetric metric, GATuint32 *cookie) |
| | GATResource_Impl_AddMetricListener.
|
| GATResult | GATResource_Impl_RegisterPolling (GATResource object, GATMetric metric, GATMetricEvent *event, GATuint32 *cookie) |
| | GATResource_Impl_RegisterPolling.
|
| GATResult | GATResource_Impl_RemoveRegisteredMetric (GATResource object, GATMetric metric, GATuint32 cookie) |
| | GATResource_Impl_RemoveRegisteredMetric.
|
| GATResult | GATResource_Impl_GetMetrics (GATResource_const object, GATList_GATMetric *metrics) |
| | GATResource_Impl_GetMetrics.
|
| GATResult | GATResource_GetCPIInstanceData (GATResource object, void **data) |
| | GATRESOURCE_IMPLEMENTATION (GATSoftwareResource) |
| GATResult | GATResource_Register_GATSerialisable (void) |
| | GATResource_Impl_Register_GATSerialisable The GATResource_Impl_Register_GATSerialisable function registers the serialization vtable with the GAT engine to allow generic object creation.
|
| void | GATResource_Destroy (GATResource *object) |
| | void GATResource_Destroy(GATResource *resource)
|
| GATResult | GATResource_Equals (GATResource_const lhs, GATResource_const rhs, GATBool *isequal) |
| | GATResource_Equals Compare two GATResource objects.
|
| GATResult | GATResource_Clone (GATResource_const handle, GATResource *new_handle) |
| | GATResource_Clone Clone the given GATResource.
|
| GATType | GATResource_GetType (GATResource_const object) |
| | GATType GATResource_GetType(GATResource_const resource) Return the type of the GATResource.
|
| GATResult | GATResource_GetInterface (GATResource_const object, GATInterface iftype, void const **ifp) |
| | int GATResource_GetInterface(GATResource_const file, GATInterface iftype, void const **ifp) Get an interface supported by a GATObject
|
| GATResult | GATResourceCPI_SerialiseCallback (GATObject handle, GATObject stream, GATBool clear_dirty) |
| | GATResourceCPI_SerialiseCallback.
|
| GATResult | GATResource_Serialise (GATResource object, GATObject stream, GATBool clear_dirty) |
| | int GATResource_Serialise(GATResource object, GATObject stream, GATBool clear_dirty) Serialise a GATResource object
|
| GATBool | GATResource_Impl_VersionCallback (GATuint32 version) |
| | GATResource_Impl_VersionCallback.
|
| GATResult | GATResource_DeSerialiseCallback (GATContext context, GATObject stream, GATObject *new_object, GATuint32 version, va_list args) |
| | GATResource_DeSerialiseCallback.
|
| GATResource | GATResource_DeSerialise (GATContext context, GATObject stream, GATResult *result) |
| | GATResource GATResource_DeSerialise(GATContext context, GATObject stream, GATBool clear_dirty) De-serialise a GATResource object.
|
| GATResult | GATResource_GetIsDirty (GATResource_const object, GATBool *isdirty) |
| | GATResource_GetIsDirty.
|
Variables |
| const char * | rcsid = "$Header: /export/cvs-gridlab/wp-1/Codes/GATEngine/C-reference/src/GATResource.c,v 1.19 2004/05/10 15:17:32 hartmutkaiser Exp $" |
| GATResource_vtable | GATResource__vtable |
| GATResource_ISerialisable_vtable | GATResource_ISerialisable__vtable |
| GATResource_IMonitorable_vtable | GATResource_IMonitorable__vtable |
| GATResource_IResource_vtable | GATResource_IResource__vtable |
Detailed Description
Source file for the GATResource class.
- Date:
-
Thu Oct 23 2003
- Version:
-
- Header:
-
/export/cvs-gridlab/wp-1/Codes/GATEngine/C-reference/src/GATResource.c,v 1.19 2004/05/10 15:17:32 hartmutkaiser Exp
Copyright (C) Hartmut Kaiser This file is part of the GAT Engine. Contributed by Hartmut Kaiser <hartmutkaiser [at] t-online [dot] de>.
Use, modification and distribution is subject to the Gridlab Software License. (See accompanying file GLlicense.txt or copy at http://www.gridlab.org/GLlicense.txt)
Definition in file GATResource.c.
Define Documentation
| #define GATRESOURCE_IMPLEMENTATION |
( |
type |
|
) |
|
|
Function Documentation
|
|
GATResource_DeSerialise_Create.
The function GATResource_DeSerialise_Create creates a new GATResource object. Further it tries 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 GATResource object. |
| stream |
The object from which the adaptor should read the streamed instance data. |
| type |
The actual type of the object to create. |
| new_object |
The pointer to the variable, which should receive the newly constructed GATResource object. |
- Returns:
-
An error code.
Definition at line 1134 of file GATResource.c.
References GAT_INVALID_PARAMETER, GAT_MEMORYFAILURE, GAT_NO_MATCHING_CPI, GAT_NO_REGISTERED_CPI, GAT_NOTIMPL, GAT_SUCCEEDED, GAT_SUCCESS, GATBool, GATContext_GetPreferences(), GATContext_internal_GetRegistry(), GATFalse, GATMonitorable_Impl_Create(), GATOrigin_Current, GATOrigin_Set, GATPreferences_const, GATRegistry_const, GATResource__vtable, GATResource_Destroy(), GATResource_IMonitorable__vtable, GATResource_IResource__vtable, GATResource_ISerialisable__vtable, GATResourceCPI_DeSerialise(), GATResourceCPI_GetMetrics(), GATResult, GATStreamable_Seek(), GATTrue, and GATuint32.
Referenced by GATResource_DeSerialiseCallback(). |
|
|
GATResource_Impl_Create Create a new GATResource object.
The function GATResource_Impl_Create creates a new GATResource object. This function is used from an adaptor only and not by any GATEngine client code. - Parameters:
-
| type |
The concrete GATType of the implemented object. |
| context |
The GAT context to use while the initialisation of the new object. |
| preferences |
The preferences to use wile selecting the adaptor for the corresponding CPI. |
- Returns:
-
Returns a handle to the newly created GATResource object. Returns 0 (zero) if an error occurs.
- Remarks:
-
The concrete function name to use is determined by the type to be stored inside the list. For instance, a list containing
int's would be destroyed with the function GATList_int_Destroy.
Definition at line 283 of file GATResource.c.
References GAT_FAILED, GAT_MEMORYFAILURE, GAT_NO_MATCHING_CPI, GAT_NOTIMPL, GAT_SUCCEEDED, GAT_SUCCESS, GATBool, GATContext_GetPreferences(), GATContext_internal_GetRegistry(), GATFalse, GATMonitorable_Impl_Create(), GATPreferences_const, GATRegistry_const, GATResource__vtable, GATResource_Destroy(), GATResource_IMonitorable__vtable, GATResource_IResource__vtable, GATResource_ISerialisable__vtable, GATResourceCPI_CreateInstance(), GATResourceCPI_GetMetrics(), GATResult, GATTrue, and GATType. |
|
|
GATResource_Impl_AddMetricListener.
The function GATResource_Impl_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:
-
| object |
The GATResource instance to add the GATMetricListener to. |
| listener |
The GATMetricListener 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.
- Remarks:
-
The concrete function name to use is determined by the type to be stored inside the list. For instance, a list containing
int's would be destroyed with the function GATList_int_Destroy.
Definition at line 712 of file GATResource.c.
References GAT_INVALID_HANDLE, GAT_NO_INTERFACE, GATMetric, GATMetricListener, GATMonitorable_Impl_AddMetricListener(), GATResult, and GATuint32. |
|
|
GATResource_Impl_RegisterPolling.
The function GATResource_Impl_RegisterPolling registers a continuous metric with the given GATResource instance. - Parameters:
-
| object |
The GATResource 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 GATResource. |
- Returns:
-
An error code.
- Remarks:
-
The concrete function name to use is determined by the type to be stored inside the list. For instance, a list containing
int's would be destroyed with the function GATList_int_Destroy.
Definition at line 755 of file GATResource.c.
References GAT_INVALID_HANDLE, GAT_NO_INTERFACE, GAT_SUCCESS, GATMetric, GATMonitorable_Impl_RegisterPolling(), GATMonitorable_Impl_RemoveRegisteredMetric(), GATResourceCPI_GetMetricEvent(), GATResult, and GATuint32. |
|
|
GATResource_Impl_RemoveRegisteredMetric.
The function GATResource_Impl_RemoveRegisteredMetric removes a GATMetricListener, which was previously registered with GATResource_Impl_AddMetricListener. - Parameters:
-
| object |
The GATResource instance to remove the GATMetricListener from. |
| listener |
The GTAMetricListener to call, when the corresponding GATMetricEvent is fired. |
| 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.
- Remarks:
-
The concrete function name to use is determined by the type to be stored inside the list. For instance, a list containing
int's would be destroyed with the function GATList_int_Destroy.
Definition at line 808 of file GATResource.c.
References GAT_INVALID_HANDLE, GAT_NO_INTERFACE, GATMetric, GATMonitorable_Impl_RemoveRegisteredMetric(), GATResult, and GATuint32. |
|
|
GATResource_Impl_GetMetrics.
The function GATResource_Impl_GetMetrics returns a list of metrics supported by this GATResource. - Parameters:
-
| object |
The GATResource instance, for which the supported metrics should be returned. |
| metrics |
The pointer to the variable, which receives the resulting list of metrics. |
- Returns:
-
An error code.
- Remarks:
-
The concrete function name to use is determined by the type to be stored inside the list. For instance, a list containing
int's would be destroyed with the function GATList_int_Destroy.
Definition at line 845 of file GATResource.c.
References GAT_INVALID_HANDLE, GAT_NO_INTERFACE, GATMonitorable_Impl_GetMetrics(), GATResource_const, and GATResult. |
| GATResult GATResource_Register_GATSerialisable |
( |
void |
|
) |
|
|
|
|
void GATResource_Destroy(GATResource *resource)
The function GATResource_Destroy is the destructor used to free all the memory allocated by an GATResource instance. - Parameters:
-
| description |
The pointer to the GATResource to destroy |
- Remarks:
-
The concrete function name to use is determined by the type to be stored inside the list. For instance, a list containing
int's would be destroyed with the function GATList_int_Destroy.
Definition at line 390 of file GATResource.c.
References GATMonitorable_Impl_Destroy(), and GATResourceCPI_DestroyInstance().
Referenced by GATJobCPIInstance_Data_Destroy(), GATJobDescription_Destroy(), GATResource_Clone(), GATResource_DeSerialise_Create(), GATResource_DeSerialiseCallback(), GATResource_Impl_Create(), resourcebroker_adaptor_GATSelfCPI_GetJob(), verify_direct_serialisation(), and verify_generic_serialisation(). |
|
|
GATResource_Equals Compare two GATResource objects.
The function GATResource_Equals compares two objects of the GATResource type. - Parameters:
-
| lhs |
The first list to compare |
| rhs |
The second list to compare |
| isequal |
The pointer to the GATBool variable, which should receive the result if the comparision |
- Returns:
-
An error code.
- Remarks:
-
The concrete function name to use is determined by the type to be stored inside the list. For instance, a list containing
int's would be destroyed with the function GATList_int_Destroy.
Definition at line 426 of file GATResource.c.
References GAT_INVALID_HANDLE, GAT_INVALID_PARAMETER, GATBool, GATResource_const, GATResourceCPI_EqualsInstance(), and GATResult.
Referenced by GATJobCPIInstance_Data_Equals(), GATJobDescription_Equals(), verify_direct_serialisation(), and verify_generic_serialisation(). |
|
|
GATResource_Clone Clone the given GATResource.
The function GATResource_Clone generates a (deep) copy of the given GATResource. - Parameters:
-
| description |
The object to clone |
| new_object |
The pointer, through which the result is to be returned. |
- Returns:
-
An error type.
- Remarks:
-
The concrete function name to use is determined by the type to be stored inside the list. For instance, a list containing
int's would be destroyed with the function GATList_int_Destroy.
Definition at line 463 of file GATResource.c.
References assert, GAT_FAILED, GAT_INVALID_HANDLE, GAT_INVALID_PARAMETER, GAT_MEMORYFAILURE, GAT_SUCCEEDED, GAT_SUCCESS, GATFalse, GATMonitorable_Impl_Clone(), GATResource__vtable, GATResource_const, GATResource_Destroy(), GATResource_IMonitorable__vtable, GATResource_IResource__vtable, GATResource_ISerialisable__vtable, GATResourceCPI_CloneInstance(), GATResult, and handle.
Referenced by GATJobCPIInstance_Data_Clone(), GATJobCPIInstance_Data_Create(), GATJobDescription_Clone(), GATJobDescription_Create(), and GATJobDescription_DeSerialise_Create(). |
|
|
GATType GATResource_GetType(GATResource_const resource) Return the type of the GATResource.
The function GATResource_GetType always returns #GATType_GATResource. - Parameters:
-
| object |
The object to inspect |
- Returns:
-
Returns always
#GATType_GATResource.
- Remarks:
-
The concrete function name to use is determined by the type to be stored inside the list. For instance, a list containing
int's would be destroyed with the function GATList_int_Destroy.
Definition at line 576 of file GATResource.c.
References GATResource_const, GATType, and GATType_NoType. |
|
|
int GATResource_GetInterface(GATResource_const file, GATInterface iftype, void const **ifp) Get an interface supported by a GATObject
The function GATResource_GetInterface allows to get a pointer to an additional interface supported by this GATResource. - 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.
- Remarks:
-
The concrete function name to use is determined by the type to be stored inside the list. For instance, a list containing
int's would be destroyed with the function GATList_int_Destroy.
Definition at line 603 of file GATResource.c.
References GAT_INVALID_PARAMETER, GAT_NO_INTERFACE, GAT_SUCCESS, GATInterface, GATInterface_IAdvertisable, GATInterface_IMonitorable, GATInterface_IResource, GATInterface_ISerialisable, GATResource_const, and GATResult. |
|
|
GATResourceCPI_SerialiseCallback.
The function GATResourceCPI_SerialiseCallback is used as a callback function for the serialisation of a GATResource 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.
- Remarks:
-
The concrete function name to use is determined by the type to be stored inside the list. For instance, a list containing
int's would be destroyed with the function GATList_int_Destroy.
Definition at line 890 of file GATResource.c.
References GAT_INVALID_PARAMETER, GAT_SUCCEEDED, GATBool, GATFalse, GATObject_GetType(), GATResourceCPI_Serialise(), GATResult, GATTrue, GATType, GATType_GATHardwareResource, GATType_GATSoftwareResource, and handle.
Referenced by GATResource_Serialise(). |
|
|
int GATResource_Serialise(GATResource object, GATObject stream, GATBool clear_dirty) Serialise a GATResource object
The function GATResource_Serialise serialises the given GATFIle object into the given stream. - Parameters:
-
| object |
The GATResource 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.
- Remarks:
-
The concrete function name to use is determined by the type to be stored inside the list. For instance, a list containing
int's would be destroyed with the function GATList_int_Destroy.
Definition at line 937 of file GATResource.c.
References GAT_INVALID_HANDLE, GAT_SUCCEEDED, GATBool, GATFalse, GATRESOURCE_VERSION1, GATResourceCPI_SerialiseCallback(), GATResult, GATuint32, and GATXds_SerialiseObject().
Referenced by GATJobCPIInstance_Data_Serialize(), and verify_direct_serialisation(). |
|
|
GATResource_Impl_VersionCallback.
The function GATResource_Impl_VersionCallback is used as a callback function during the de-serialisation of a GATResource. 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.
- Remarks:
-
The concrete function name to use is determined by the type to be stored inside the list. For instance, a list containing
int's would be destroyed with the function GATList_int_Destroy.
Definition at line 974 of file GATResource.c.
References GATBool, GATFalse, GATRESOURCE_LASTVERSION, GATRESOURCE_MINOR_MASK, GATTrue, and GATuint32.
Referenced by GATResource_DeSerialise(). |
|
|
GATResource_DeSerialiseCallback.
The function GATResource_DeSerialiseCallback is used as a callback function during the de-serialisation of a GATResource. It should be provided for the instantiation of the new GATResource 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 GATResource_DeSerialise function. |
- Returns:
-
An error code.
- Remarks:
-
This function is called from the GAT engine, there is no need to call it directly.
- Remarks:
-
The concrete function name to use is determined by the type to be stored inside the list. For instance, a list containing
int's would be destroyed with the function GATList_int_Destroy.
Definition at line 1012 of file GATResource.c.
References GAT_INVALID_PARAMETER, GAT_SUCCESS, GAT_UNUSED_PARAMETER, GATResource_DeSerialise_Create(), GATResource_Destroy(), GATResult, and GATuint32.
Referenced by GATResource_DeSerialise(). |
|
|
GATResource GATResource_DeSerialise(GATContext context, GATObject stream, GATBool clear_dirty) De-serialise a GATResource object.
The function GATResource_DeSerialise de-serialises a streamed GATResource 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 GATResource object.
- Remarks:
-
The concrete function name to use is determined by the type to be stored inside the list. For instance, a list containing
int's would be destroyed with the function GATList_int_Destroy.
Definition at line 1059 of file GATResource.c.
References GATResource_DeSerialiseCallback(), GATResource_Impl_VersionCallback(), GATResult, GATType_NoType, GATuint32, and GATXds_DeSerialiseObject().
Referenced by verify_direct_serialisation(). |
|
|
GATResource_GetIsDirty.
The function GATResource_GetIsDirty retrieves the status of the dirty flag of this GATResource object. - Parameters:
-
| file |
The GATResource object to inspect for its dirty status. |
| isdirty |
The pointer to a variable, which receives the dirty status. |
- Returns:
-
An error code.
- Remarks:
-
The concrete function name to use is determined by the type to be stored inside the list. For instance, a list containing
int's would be destroyed with the function GATList_int_Destroy.
Definition at line 1097 of file GATResource.c.
References GAT_INVALID_HANDLE, GAT_INVALID_PARAMETER, GAT_SUCCESS, GATBool, GATResource_const, and GATResult. |
Variable Documentation
const char* rcsid = "$Header: /export/cvs-gridlab/wp-1/Codes/GATEngine/C-reference/src/GATResource.c,v 1.19 2004/05/10 15:17:32 hartmutkaiser Exp $" [static]
|
|
| GATResource_vtable GATResource__vtable
|
|
GATResource_ISerialisable_vtable GATResource_ISerialisable__vtable [static]
|
|
GATResource_IMonitorable_vtable GATResource_IMonitorable__vtable [static]
|
|
GATResource_IResource_vtable GATResource_IResource__vtable [static]
|
|
|