GridLab
Grid Application Toolkit

A simple API for Grid Applications
GAT

Menu



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

GATTimePeriod.c File Reference

Main file for the GATTimePeriod class. More...

#include <string.h>
#include <stdlib.h>
#include "GATErrors.h"
#include "GATInternal.h"
#include "GATTime.h"
#include "GATTimePeriod.h"
#include "GATXdsWrapper.h"

Include dependency graph for GATTimePeriod.c:

Include dependency graph

Go to the source code of this file.

Compounds

struct  GATTimePeriod_S

Functions

 GATOBJECT_DEFINE_VTABLE (GATTimePeriod)
 GATSERIALISABLE_DEFINE_VTABLE (GATTimePeriod)
 GATOBJECT_DEFINE_CONVERTERS (GATTimePeriod)
GATResult GATTimePeriod_DeSerialise_Create (GATContext context, GATObject stream, GATdouble64 duration, GATTimePeriod *new_object)
 GATTimePeriod_DeSerialise_Create.

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

GATTimePeriod GATTimePeriod_Create (GATdouble64 duration)
 GATTimePeriod_Create Create a new GATTimePeriod object.

GATTimePeriod GATTimePeriod_Create_Difference (GATTime start, GATTime end)
 GATTimePeriod_Create_Difference Create a new GATTimePeriod object.

void GATTimePeriod_Destroy (GATTimePeriod *object)
 void GATTimePeriod_Destroy(GATTimePeriod *resource)

GATResult GATTimePeriod_Equals (GATTimePeriod_const lhs, GATTimePeriod_const that, GATBool *isequal)
 GATTimePeriod_Equals Compare two GATTimePeriod objects.

GATType GATTimePeriod_GetType (GATTimePeriod_const this)
 GATType GATTimePeriod_GetType(GATTimePeriod_const resource) Return the type of the GATTimePeriod.

GATResult GATTimePeriod_Clone (GATTimePeriod_const object, GATTimePeriod *thisClone)
 GATTimePeriod_Clone Clone the given GATTimePeriod.

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

GATResult GATTimePeriod_Serialise (GATTimePeriod object, GATObject stream, GATBool clear_dirty)
 GATResult GATTimePeriod_Serialise(GATTimePeriod file, GATObject stream, GATBool clear_dirty) Serialise a GATTimePeriod object.

GATBool GATTimePeriod_VersionCallback (GATuint32 version)
 GATTimePeriod_VersionCallback.

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

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

GATResult GATTimePeriod_GetIsDirty (GATTimePeriod_const object, GATBool *isdirty)
 GATTimePeriod_GetIsDirty.

GATdouble64 GATTimePeriod_GetDuration (GATTimePeriod_const object)
 This operation returns the number of seconds this time period lasts.


Variables

const char * rcsid = "$Header: /export/cvs-gridlab/wp-1/Codes/GATEngine/C-reference/src/GATTimePeriod.c,v 1.19 2004/04/02 12:31:58 hartmutkaiser Exp $"
GATTimePeriod_vtable GATTimePeriod__vtable
GATTimePeriod_ISerialisable_vtable GATTimePeriod_ISerialisable__vtable


Detailed Description

Main file for the GATTimePeriod class.

An instance of this class represents a time duration, a length of time with uncertain start point.

Date:
Date:
2004/04/02 12:31:58

Version:
Header:
/export/cvs-gridlab/wp-1/Codes/GATEngine/C-reference/src/GATTimePeriod.c,v 1.19 2004/04/02 12:31:58 hartmutkaiser Exp

Copyright (C) Kelly Davis This file is part of the GAT Engine. Contributed by Kelly Davis <kdavis@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 GATTimePeriod.c.


Function Documentation

GATOBJECT_DEFINE_VTABLE GATTimePeriod   
 

GATSERIALISABLE_DEFINE_VTABLE GATTimePeriod   
 

GATOBJECT_DEFINE_CONVERTERS GATTimePeriod   
 

Definition at line 41 of file GATAdvertService.c.

References cpi, data, and GATAdvertService.

GATResult GATTimePeriod_DeSerialise_Create GATContext    context,
GATObject    stream,
GATdouble64    duration,
GATTimePeriod   object
[static]
 

GATTimePeriod_DeSerialise_Create.

The function GATTimePeriod_DeSerialise_Create creates a new GATTimePeriod object.

Parameters:
context  The GAT context to use for creation of the GATTimePeriod object.
stream  The object from which the adaptor should read the streamed instance data.
duration  The time duration to be used for the construction of the new GATTimePeriod object
new_object  The pointer to the variable, which should receive the newly constructed GATTimePeriod object.
Returns:
An error code.

Definition at line 494 of file GATTimePeriod.c.

References GAT_CREATE_STATUS, GAT_CURRENT_STATUS, GAT_INVALID_PARAMETER, GAT_MEMORYFAILURE, GAT_RETURN_STATUS, GAT_SUCCEEDED, GAT_UNUSED_PARAMETER, GAT_USES_STATUS, GATdouble64, GATTimePeriod_S::GATObject__vtable, GATTimePeriod_S::GATSerialisable__vtable, GATTimePeriod__vtable, GATTimePeriod_Destroy(), GATTimePeriod_ISerialisable__vtable, and GATTimePeriod_S::internalDuration.

Referenced by GATTimePeriod_DeSerialiseCallback().

GATResult GATTimePeriod_Register_GATSerialisable void   
 

GATTimePeriod_Register_GATSerialisable The GATTimePeriod_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 83 of file GATTimePeriod.c.

References GATObject_Register_GATSerialisable(), GATResult, GATTimePeriod_ISerialisable__vtable, and GATType_GATTimePeriod.

Referenced by GATObject_Register_GATSerialisables().

GATTimePeriod GATTimePeriod_Create GATdouble64    duration
 

GATTimePeriod_Create Create a new GATTimePeriod object.

Parameters:
duration  Number of seconds this period of time lasts.
Returns:
A GATTimePeriod instance

Definition at line 98 of file GATTimePeriod.c.

References GATdouble64, GATTimePeriod_S::GATObject__vtable, GATTimePeriod_S::GATSerialisable__vtable, GATTimePeriod__vtable, GATTimePeriod_ISerialisable__vtable, and GATTimePeriod_S::internalDuration.

Referenced by main().

GATTimePeriod GATTimePeriod_Create_Difference GATTime    start,
GATTime    end
 

GATTimePeriod_Create_Difference Create a new GATTimePeriod object.

The function GATTimePeriod_Create constructs a GATTimePeriod instance corresponding to the passed duration.

Parameters:
start  The start time to calculate the time period.
end  The end time to calculate the time period.
Returns:
Returns a handle to the newly created GATTimePeriod object. Returns 0 (zero) if an error occurs.

Definition at line 124 of file GATTimePeriod.c.

References GATTimePeriod_S::GATObject__vtable, GATTimePeriod_S::GATSerialisable__vtable, GATTime_GetTime(), GATTimePeriod__vtable, GATTimePeriod_ISerialisable__vtable, and GATTimePeriod_S::internalDuration.

void GATTimePeriod_Destroy GATTimePeriod   object
 

void GATTimePeriod_Destroy(GATTimePeriod *resource)

Parameters:
this  The GATTimePeriod to destroy

Definition at line 148 of file GATTimePeriod.c.

Referenced by GATTimePeriod_Clone(), GATTimePeriod_DeSerialise_Create(), GATTimePeriod_DeSerialiseCallback(), main(), verify_direct_serialisation(), and verify_generic_serialisation().

GATResult GATTimePeriod_Equals GATTimePeriod_const    lhs,
GATTimePeriod_const    that,
GATBool   isequal
 

GATTimePeriod_Equals Compare two GATTimePeriod objects.

Parameters:
this  The first GATTimePeriod to query
that  The second GATTimePeriod to query
Returns:
1 on equality 0 otherwise

Definition at line 167 of file GATTimePeriod.c.

References GAT_INVALID_HANDLE, GAT_INVALID_PARAMETER, GAT_SUCCESS, GATBool, GATFalse, GATResult, GATTimePeriod_const, and GATTrue.

Referenced by verify_direct_serialisation(), and verify_generic_serialisation().

GATType GATTimePeriod_GetType GATTimePeriod_const    this
 

GATType GATTimePeriod_GetType(GATTimePeriod_const resource) Return the type of the GATTimePeriod.

This function will always return GATType_GATTimePeriod.

Parameters:
this  The GATTimePeriod_const to query
Returns:
The GATType of the passed this

Definition at line 194 of file GATTimePeriod.c.

References GAT_UNUSED_PARAMETER, GATTimePeriod_const, GATType, and GATType_GATTimePeriod.

GATResult GATTimePeriod_Clone GATTimePeriod_const    object,
GATTimePeriod   thisClone
 

GATTimePeriod_Clone Clone the given GATTimePeriod.

This "deep clone" is returned in the variable thisClone. Furthermore, this function returns its completion status, through its return value.

Parameters:
this  The GATTimePeriod_const to clone
thisClone  The cloned GATTimePeriod_const
Returns:
The completion status of this function

Definition at line 210 of file GATTimePeriod.c.

References GAT_INVALID_HANDLE, GAT_INVALID_PARAMETER, GAT_MEMORYFAILURE, GAT_SUCCESS, GATTimePeriod_S::GATObject__vtable, GATResult, GATTimePeriod_S::GATSerialisable__vtable, GATTimePeriod_const, GATTimePeriod_Destroy(), GATTimePeriod_ISerialisable__vtable, and GATTimePeriod_S::internalDuration.

GATResult GATTimePeriod_GetInterface GATTimePeriod_const    object,
GATInterface    iftype,
void const **    ifp
 

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

The function GATTimePeriod_GetInterface allows to get a pointer to an additional interface supported by this GATTimePeriod.

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 257 of file GATTimePeriod.c.

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

GATResult GATTimePeriod_Serialise GATTimePeriod    object,
GATObject    stream,
GATBool    clear_dirty
 

GATResult GATTimePeriod_Serialise(GATTimePeriod file, GATObject stream, GATBool clear_dirty) Serialise a GATTimePeriod object.

The function GATTimePeriod_Serialise serialises the given GATTimePeriod object into the given stream.

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

References GAT_INVALID_HANDLE, GATBool, GATResult, GATTIMEPERIOD_VERSION1, GATXds_SerialiseObject(), and GATTimePeriod_S::internalDuration.

Referenced by verify_direct_serialisation().

GATBool GATTimePeriod_VersionCallback GATuint32    version [static]
 

GATTimePeriod_VersionCallback.

The function GATTimePeriod_VersionCallback is used as a callback function during the de-serialisation of a GATTimePeriod. 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 323 of file GATTimePeriod.c.

References GATBool, GATFalse, GATTIMEPERIOD_LASTVERSION, GATTIMEPERIOD_MINOR_MASK, GATTrue, and GATuint32.

Referenced by GATTimePeriod_DeSerialise().

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

GATTimePeriod_DeSerialiseCallback.

The function GATTimePeriod_DeSerialiseCallback is used as a callback function during the de-serialisation of a GATTimePeriod. It should be provided for the instantiation of the new GATTimePeriod 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 GATTimePeriod_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 357 of file GATTimePeriod.c.

References GAT_INVALID_PARAMETER, GAT_SUCCESS, GAT_UNUSED_PARAMETER, GATdouble64, GATResult, GATTimePeriod_DeSerialise_Create(), GATTimePeriod_Destroy(), and GATuint32.

Referenced by GATTimePeriod_DeSerialise().

GATTimePeriod GATTimePeriod_DeSerialise GATContext    context,
GATObject    stream,
GATResult   result
 

GATTimePeriod GATTimePeriod_DeSerialise(GATContext context, GATObject stream, GATBool clear_dirty) De-serialise a GATTimePeriod object.

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

Definition at line 400 of file GATTimePeriod.c.

References GAT_CREATE_STATUS, GAT_CURRENT_STATUS, GAT_STORE_STATUS, GAT_USES_STATUS, GATdouble64, GATResult, GATTimePeriod_DeSerialiseCallback(), GATTimePeriod_VersionCallback(), GATuint32, and GATXds_DeSerialiseObject().

Referenced by verify_direct_serialisation().

GATResult GATTimePeriod_GetIsDirty GATTimePeriod_const    object,
GATBool   isdirty
 

GATTimePeriod_GetIsDirty.

The function GATTimePeriod_GetIsDirty retrieves the status of the dirty flag of this GATTimePeriod object.

Parameters:
file  The GATTimePeriod 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 437 of file GATTimePeriod.c.

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

GATdouble64 GATTimePeriod_GetDuration GATTimePeriod_const    object
 

This operation returns the number of seconds this time period lasts.

Parameters:
this  The GATTimePeriod to query
Returns:
Number of seconds this time period lasts

Definition at line 466 of file GATTimePeriod.c.

References GATdouble64, and GATTimePeriod_const.


Variable Documentation

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

Definition at line 20 of file GATTimePeriod.c.

GATTimePeriod_vtable GATTimePeriod__vtable [static]
 

Initial value:

 {
  GATTimePeriod_GetType,
  GATTimePeriod_Destroy,
  GATTimePeriod_Equals,
  GATTimePeriod_Clone,
  GATTimePeriod_GetInterface,
  NULL
}

Definition at line 58 of file GATTimePeriod.c.

Referenced by GATTimePeriod_Create(), GATTimePeriod_Create_Difference(), and GATTimePeriod_DeSerialise_Create().

GATTimePeriod_ISerialisable_vtable GATTimePeriod_ISerialisable__vtable [static]
 

Initial value:

 
{
  GATTimePeriod_Serialise,
  GATTimePeriod_DeSerialise,
  GATTimePeriod_GetIsDirty,
}

Definition at line 68 of file GATTimePeriod.c.

Referenced by GATTimePeriod_Clone(), GATTimePeriod_Create(), GATTimePeriod_Create_Difference(), GATTimePeriod_DeSerialise_Create(), and GATTimePeriod_Register_GATSerialisable().