GridLab
Grid Application Toolkit

A simple API for Grid Applications
GAT

Menu



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

GATLocation.c File Reference

Main file for the GATLocation class. More...

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "GATLocation.h"
#include "GATInternal.h"
#include "GATErrors.h"
#include "GATXdsWrapper.h"
#include "GATUtil.h"

Include dependency graph for GATLocation.c:

Include dependency graph

Go to the source code of this file.

Compounds

struct  GATLocation_S

Functions

 GATOBJECT_DEFINE_VTABLE (GATLocation)
 GATSERIALISABLE_DEFINE_VTABLE (GATLocation)
 GATOBJECT_DEFINE_CONVERTERS (GATLocation)
char * GetSubString (const char *string, int start, int end)
 GetSubString Copy a portion of a string.

int GATLocation_DeSerialise_Create (GATContext context, GATObject stream, char const *uri, GATLocation *new_object)
 GATLocation_DeSerialise_Create.

GATResult GATLocation_Register_GATSerialisable (void)
 GATLocation_Register_GATSerialisable The GATLocation_Register_GATSerialisable function registers the serialization vtable with the GAT engine to allow generic object creation.

GATLocation GATLocation_Create (const char *uri)
 Constructs a GATLocation instance by parsing the given String as a URI.

void GATLocation_Destroy (GATLocation *this)
 Destroys this GATLocation object.

char * GATLocation_ToString (GATLocation_const this)
 Returns the content of this GATLocation as a String.

GATType GATLocation_GetType (GATLocation_const location)
 Returns the type of the GATLocation.

int GATLocation_Clone (GATLocation_const this, GATLocation *new_location)
 Returns a deep clone of this GATLocation.

int GATLocation_Equals (GATLocation_const this, GATLocation_const that, GATBool *isequal)
 Tests this GATLocation for equality with the passed GATLocations.

GATResult GATLocation_GetInterface (GATLocation_const object, GATInterface iftype, void const **ifp)
 GATResult GATLocation_GetInterface(GATLocation_const file, GATInterface iftype, void const **ifp) Get an interface supported by a GATObject.

GATResult GATLocation_Serialise (GATLocation object, GATObject stream, GATBool clear_dirty)
 GATResult GATLocation_Serialise(GATLocation file, GATObject stream, GATBool clear_dirty) Serialise a GATLocation object.

GATBool GATLocation_VersionCallback (GATuint32 version)
 GATLocation_VersionCallback.

GATResult GATLocation_DeSerialiseCallback (GATContext context, GATObject stream, GATObject *new_object, GATuint32 version, va_list args)
 GATLocation_DeSerialiseCallback.

GATLocation GATLocation_DeSerialise (GATContext context, GATObject stream, GATResult *result)
 GATLocation GATLocation_DeSerialise(GATContext context, GATObject stream, GATBool clear_dirty) De-serialise a GATLocation object.

GATResult GATLocation_GetIsDirty (GATLocation_const object, GATBool *isdirty)
 GATLocation_GetIsDirty.


Variables

const char * rcsid = "$Header: /export/cvs-gridlab/wp-1/Codes/GATEngine/C-reference/src/GATLocation.c,v 1.17 2004/04/02 12:31:58 hartmutkaiser Exp $"
GATLocation_vtable GATLocation__vtable
GATLocation_ISerialisable_vtable GATLocation_ISerialisable__vtable


Detailed Description

Main file for the GATLocation class.

A GATLocation represents the location of an abstract or physical resource. The location is represented as a URI - see RFC 2396 and RFC 2732.

Date:
Wed Sep 24 2003
Version:
Header:
/export/cvs-gridlab/wp-1/Codes/GATEngine/C-reference/src/GATLocation.c,v 1.17 2004/04/02 12:31:58 hartmutkaiser Exp

Copyright (C) Tom Goodale This file is part of the GAT Engine. Contributed by Tom Goodale <goodale@aei.mpg.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 GATLocation.c.


Function Documentation

GATOBJECT_DEFINE_VTABLE GATLocation   
 

GATSERIALISABLE_DEFINE_VTABLE GATLocation   
 

GATOBJECT_DEFINE_CONVERTERS GATLocation   
 

Definition at line 34 of file GATMemoryStream.c.

char * GetSubString const char *    string,
int    start,
int    end
[static]
 

GetSubString Copy a portion of a string.

Creates a new string which is a substring of the old one.

Parameters:
string  The original string
start  Starting location of substring.
end  End location of substring.
Returns:
A new string holding the substring.

Definition at line 512 of file GATLocation.c.

Referenced by GATLocation_Create(), and GATLocation_ToString().

GATResult GATLocation_DeSerialise_Create GATContext    context,
GATObject    stream,
char const *    uri,
GATLocation   object
[static]
 

GATLocation_DeSerialise_Create.

The function GATLocation_DeSerialise_Create creates a new GATLocation object.

Parameters:
context  The GAT context to use for creation of the GATLocation object.
stream  The object from which the adaptor should read the streamed instance data.
TODO: Add the description of your additional parameters here
Parameters:
new_object  The pointer to the variable, which should receive the newly constructed GATLocation object.
Returns:
An error code.

Definition at line 463 of file GATLocation.c.

References GAT_CREATE_STATUS, GAT_CREATE_STATUS_IF, GAT_CURRENT_STATUS, GAT_INVALID_PARAMETER, GAT_MEMORYFAILURE, GAT_RETURN_STATUS, GAT_SUCCEEDED, GAT_UNUSED_PARAMETER, GAT_USES_STATUS, GATLocation__vtable, GATLocation_Destroy(), GATLocation_ISerialisable__vtable, GATLocation_S::GATObject__vtable, GATLocation_S::GATSerialisable__vtable, GATUtil_strdup(), and GATLocation_S::uri.

Referenced by GATLocation_DeSerialiseCallback().

GATResult GATLocation_Register_GATSerialisable void   
 

GATLocation_Register_GATSerialisable The GATLocation_Register_GATSerialisable function registers the serialization vtable with the GAT engine to allow generic object creation.

This function is called by the GAT engine, there is no need to use it directly.

Definition at line 89 of file GATLocation.c.

References GATLocation_ISerialisable__vtable, GATObject_Register_GATSerialisable(), GATResult, and GATType_GATLocation.

Referenced by GATObject_Register_GATSerialisables().

GATLocation GATLocation_Create const char *    uri
 

Constructs a GATLocation instance by parsing the given String as a URI.

This is the constructor for GATLocation objects.

Returns:
A new GATLocation

Definition at line 101 of file GATLocation.c.

References GATLocation__vtable, GATLocation_ISerialisable__vtable, and GetSubString().

Referenced by create_gatfile(), create_software_description(), GATFile_Create_Name(), GATFile_DeSerialise_Create(), GATLocation_Clone(), GATLogicalFileCPI_DeSerialiseCallback(), get_sw_description_direct(), logical_filestore_getfiles(), logical_filestore_replicate(), main(), and resourcebroker_adaptor_FillCommandLine().

void GATLocation_Destroy GATLocation   this
 

Destroys this GATLocation object.

This is the destructor for GATLocation objects.

Parameters:
this  An old GATLocation

Definition at line 129 of file GATLocation.c.

Referenced by create_gatfile(), create_software_description(), GATFile_Create_Name(), GATFile_Destroy(), GATFileStream_Destroy(), GATLocation_Clone(), GATLocation_DeSerialise_Create(), GATLocation_DeSerialiseCallback(), GATLogicalFile_Destroy(), GATLogicalFileCPI_DeSerialiseCallback(), GATSecurityContext_Destroy(), GATSecurityContext_PartialDestroy(), get_sw_description_direct(), logical_filestore_getfiles(), logical_filestore_replicate(), main(), and resourcebroker_adaptor_FillCommandLine().

char* GATLocation_ToString GATLocation_const    this
 

Returns the content of this GATLocation as a String.

Return the content of the GATLocation as a string. This is effectively the string given in the constructor.

Parameters:
this  The GATLocation
Returns:
A string containing the URI.

Definition at line 151 of file GATLocation.c.

References GATLocation_const, and GetSubString().

Referenced by fileops_adaptor_FileCPI_Copy(), fileops_adaptor_FileCPI_Delete(), fileops_adaptor_FileCPI_GetLength(), fileops_adaptor_FileCPI_IsReadable(), fileops_adaptor_FileCPI_IsWritable(), fileops_adaptor_FileCPI_LastWriteTime(), fileops_adaptor_FileCPI_Move(), fileops_adaptor_get_file_size(), filestream_adaptor_FileStreamCPI_CreateInstance(), GATFile_Serialise(), GATLocation_Equals(), GATLogicalFile_Serialise(), logical_filestore_addfile(), logical_filestore_removefile(), logicalfile_adaptor_LogicalFileCPI_AddFile(), logicalfile_adaptor_LogicalFileCPI_GetFiles(), logicalfile_adaptor_LogicalFileCPI_Remove(), logicalfile_adaptor_LogicalFileCPI_RemoveFile(), logicalfile_adaptor_LogicalFileCPI_Replicate(), main(), test_std_file_attriutes(), and test_sw_attributes().

GATType GATLocation_GetType GATLocation_const    location
 

Returns the type of the GATLocation.

The function GATLocation_GetType always returns GATType_GATLocation.

Parameters:
object  The object to inspect
Returns:
returns always #GATType_GATLocation.

Definition at line 170 of file GATLocation.c.

References GAT_UNUSED_PARAMETER, GATLocation_const, GATType, and GATType_GATLocation.

int GATLocation_Clone GATLocation_const    this,
GATLocation   new_location
 

Returns a deep clone of this GATLocation.

Return a new GATLocation which is equivalent to this one.

Parameters:
this  The GATLocation
Returns:
A string containing the URI.

Definition at line 184 of file GATLocation.c.

References GAT_INVALID_PARAMETER, GAT_MEMORYFAILURE, GAT_SUCCESS, GATLocation_const, GATLocation_Create(), and GATLocation_Destroy().

Referenced by GATFile_Clone(), GATFile_Create(), GATFileStream_Clone(), GATFileStream_Create(), GATLogicalFile_Clone(), GATLogicalFile_Create(), GATLogicalFile_DeSerialise_Create(), GATSecurityContext_Clone(), GATSecurityContext_GetRemoteAuthenticate(), and GATSecurityContext_SetRemoteAuthenticate().

int GATLocation_Equals GATLocation_const    this,
GATLocation_const    that,
GATBool   isequal
 

Tests this GATLocation for equality with the passed GATLocations.

Parameters:
this  The GATLocation
that  The GATLocation to compare with
Returns:
1 upon equality 0 otherwise

Definition at line 217 of file GATLocation.c.

References GAT_INVALID_PARAMETER, GAT_SUCCESS, GATBool, GATFalse, GATLocation_const, GATLocation_ToString(), and GATTrue.

Referenced by GATFile_Equals(), GATFileStream_Equals(), GATLogicalFile_Equals(), and GATSecurityContext_Equals().

GATResult GATLocation_GetInterface GATLocation_const    object,
GATInterface    iftype,
void const **    ifp
 

GATResult GATLocation_GetInterface(GATLocation_const file, GATInterface iftype, void const **ifp) Get an interface supported by a GATObject.

The function GATLocation_GetInterface allows to get a pointer to an additional interface supported by this GATLocation.

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 248 of file GATLocation.c.

References GAT_INVALID_PARAMETER, GAT_NO_INTERFACE, GAT_SUCCESS, GATInterface, GATInterface_ISerialisable, GATLocation_const, and GATResult.

GATResult GATLocation_Serialise GATLocation    object,
GATObject    stream,
GATBool    clear_dirty
 

GATResult GATLocation_Serialise(GATLocation file, GATObject stream, GATBool clear_dirty) Serialise a GATLocation object.

The function GATLocation_Serialise serialises the given GATLocation object into the given stream.

Parameters:
object  The GATLocation 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 285 of file GATLocation.c.

References GAT_INVALID_HANDLE, GATBool, GATLOCATION_VERSION1, GATResult, GATXds_SerialiseObject(), and GATLocation_S::uri.

GATBool GATLocation_VersionCallback GATuint32    version [static]
 

GATLocation_VersionCallback.

The function GATLocation_VersionCallback is used as a callback function during the de-serialisation of a GATLocation. 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 311 of file GATLocation.c.

References GATBool, GATFalse, GATLOCATION_LASTVERSION, GATLOCATION_MINOR_MASK, GATTrue, and GATuint32.

Referenced by GATLocation_DeSerialise().

GATResult GATLocation_DeSerialiseCallback GATContext    context,
GATObject    stream,
GATObject   new_object,
GATuint32    version,
va_list    args
[static]
 

GATLocation_DeSerialiseCallback.

The function GATLocation_DeSerialiseCallback is used as a callback function during the de-serialisation of a GATLocation. It should be provided for the instantiation of the new GATLocation 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 GATLocation_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 345 of file GATLocation.c.

References GAT_INVALID_PARAMETER, GAT_SUCCESS, GAT_UNUSED_PARAMETER, GATLocation_DeSerialise_Create(), GATLocation_Destroy(), GATResult, and GATuint32.

Referenced by GATLocation_DeSerialise().

GATLocation GATLocation_DeSerialise GATContext    context,
GATObject    stream,
GATResult   result
 

GATLocation GATLocation_DeSerialise(GATContext context, GATObject stream, GATBool clear_dirty) De-serialise a GATLocation object.

The function GATLocation_DeSerialise de-serialises a streamed GATLocation 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 GATLocation object.

Definition at line 387 of file GATLocation.c.

References GAT_CREATE_STATUS, GAT_CURRENT_STATUS, GAT_INVALID_PARAMETER, GAT_STORE_STATUS, GAT_USES_STATUS, GATLocation_DeSerialiseCallback(), GATLocation_VersionCallback(), GATResult, GATuint32, and GATXds_DeSerialiseObject().

GATResult GATLocation_GetIsDirty GATLocation_const    object,
GATBool   isdirty
 

GATLocation_GetIsDirty.

The function GATLocation_GetIsDirty retrieves the status of the dirty flag of this GATLocation object.

Parameters:
file  The GATLocation object to inspect for its dirty status.
isdirty  The pointer to a variable, which receives the dirty status.
Returns:
An error code.

Definition at line 426 of file GATLocation.c.

References GAT_INVALID_HANDLE, GAT_INVALID_PARAMETER, GAT_SUCCESS, GATBool, GATFalse, GATLocation_const, and GATResult.


Variable Documentation

const char* rcsid = "$Header: /export/cvs-gridlab/wp-1/Codes/GATEngine/C-reference/src/GATLocation.c,v 1.17 2004/04/02 12:31:58 hartmutkaiser Exp $" [static]
 

Definition at line 20 of file GATLocation.c.

GATLocation_vtable GATLocation__vtable [static]
 

Initial value:

 {
  GATLocation_GetType,
  GATLocation_Destroy,
  GATLocation_Equals,
  GATLocation_Clone,
  GATLocation_GetInterface,
  NULL
}

Definition at line 64 of file GATLocation.c.

Referenced by GATLocation_Create(), and GATLocation_DeSerialise_Create().

GATLocation_ISerialisable_vtable GATLocation_ISerialisable__vtable [static]
 

Initial value:

 
{
  GATLocation_Serialise,
  GATLocation_DeSerialise,
  GATLocation_GetIsDirty,
}

Definition at line 74 of file GATLocation.c.

Referenced by GATLocation_Create(), GATLocation_DeSerialise_Create(), and GATLocation_Register_GATSerialisable().