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.h

Go to the documentation of this file.
00001 /** @file GATTimePeriod.h
00002  * Header file for the GATTimePeriod class.
00003  * 
00004  * An instance of this class represents a time duration, a length
00005  * of time with uncertain start point.
00006  * 
00007  * @date $Date: 2004/03/24 19:30:58 $
00008  * 
00009  * @version $Header: /export/cvs-gridlab/wp-1/Codes/GATEngine/C-reference/src/GATTimePeriod.h,v 1.14 2004/03/24 19:30:58 hartmutkaiser Exp $
00010  *
00011  *  Copyright (C) Kelly Davis
00012  *  This file is part of the GAT Engine.
00013  *  Contributed by Kelly Davis <kdavis@aei.mpg.de>.
00014  *
00015  *  Use, modification and distribution is subject to the Gridlab Software
00016  *  License. (See accompanying file GLlicense.txt or copy at
00017  *  http://www.gridlab.org/GLlicense.txt)
00018  */
00019 
00020 #ifndef _GATTIMEPERIOD_H_
00021 #define _GATTIMEPERIOD_H_ 1
00022 
00023 #include "GATType.h"
00024 #include "GATInternal.h"
00025 
00026 #ifdef __cplusplus
00027 extern "C" 
00028 {
00029 #endif
00030 
00031 /* Declare the converters to/from GATObject */
00032 GATOBJECT_DECLARE_CONVERTERS(GATTimePeriod);
00033 
00034 /** GATTimePeriod_Create
00035  *  @brief Create a new GATTimePeriod object
00036  *
00037  *  The function @c GATTimePeriod_Create constructs a GATTimePeriod instance
00038  *  corresponding to the passed duration.
00039  *
00040  *  @param duration Number of seconds this period of time lasts.
00041  *
00042  *  @return Returns a handle to the newly created GATTimePeriod object.
00043  *        Returns 0 (zero) if an error occurs.
00044  */
00045 GATTimePeriod GATTimePeriod_Create(GATdouble64 duration);
00046 
00047 /** GATTimePeriod_Create_Difference
00048  *  @brief Create a new GATTimePeriod object
00049  *
00050  *  The function @c GATTimePeriod_Create_Difference constructs a GATTimePeriod
00051  *  instance corresponding to the passed start end ending times.
00052  *
00053  *  @param start The start time to calculate the time period.
00054  *  @param end The end time to calculate the time period.
00055  *
00056  *  @return Returns a handle to the newly created GATTimePeriod object.
00057  *        Returns 0 (zero) if an error occurs.
00058  */
00059 GATTimePeriod GATTimePeriod_Create_Difference(GATTime start, GATTime end);
00060 
00061 /** GATType GATTimePeriod_GetType(GATTimePeriod_const resource)
00062  *  @brief Return the type of the GATTimePeriod
00063  *
00064  *  The function @c GATTimePeriod_GetType always returns 
00065  *  @c #GATType_GATTimePeriod. 
00066  *
00067  *  @param object The object to inspect
00068  *
00069  *  @return Returns always @c #GATType_GATTimePeriod. 
00070  */
00071 GATType GATTimePeriod_GetType(GATTimePeriod_const period);
00072 
00073 /** GATTimePeriod_Clone
00074  *  @brief Clone the given GATTimePeriod
00075  *
00076  *  The function @c GATTimePeriod_Clone generates a (deep) copy of 
00077  *  the given GATTimePeriod. 
00078  *
00079  *  @param description The object to clone
00080  *  @param new_object The pointer, through which the result is to be 
00081  *        returned.
00082  *
00083  *  @return An error type.
00084  */
00085 GATResult 
00086   GATTimePeriod_Clone(GATTimePeriod_const period, GATTimePeriod *thisClone);
00087 
00088 /** GATTimePeriod_Equals
00089  *  @brief Compare two GATTimePeriod objects
00090  *
00091  *  The function @c GATTimePeriod_Equals compares two objects of the
00092  *  @c GATTimePeriod type.
00093  *
00094  *  @param lhs The first list to compare
00095  *  @param rhs The second list to compare
00096  *  @param isequal The pointer to the location, where the outcome of the 
00097  *        function has to be stored.
00098  *
00099  *  @return An error code.
00100  */
00101 GATResult 
00102   GATTimePeriod_Equals(GATTimePeriod_const period, GATTimePeriod_const that,
00103   GATBool *isequal);
00104   
00105 /** void GATTimePeriod_Destroy(GATTimePeriod *resource)
00106  *
00107  *  The function GATTimePeriod_Destroy is the destructor used to
00108  *  free all the memory allocated by an GATTimePeriod instance.
00109  *
00110  *  @param object The pointer to the GATTimePeriod to destroy
00111  */
00112 void 
00113   GATTimePeriod_Destroy(GATTimePeriod *period);
00114 
00115 /** GATResult GATTimePeriod_GetInterface(GATTimePeriod_const file, GATInterface iftype, void const **ifp)
00116  *  @brief Get an interface supported by a GATObject
00117  *
00118  *  The function GATTimePeriod_GetInterface allows to get a pointer to an 
00119  *  additional interface supported by this GATTimePeriod.
00120  *
00121  *  @param object The object to be asked for the new interface.
00122  *  @param iftype The interface the object is to be asked for.
00123  *  @param ifp The pointer, through which the result is to be returned.
00124  *
00125  *  @return An error type.
00126  */
00127 GATResult  
00128   GATTimePeriod_GetInterface(GATTimePeriod_const object, 
00129     GATInterface iftype, void const **ifp);
00130 
00131 
00132 /* GATAdvertiseable API */
00133 #define GATTIMEPERIOD_VERSION1    0x0100
00134 #define GATTIMEPERIOD_LASTVERSION GATTIMEPERIOD_VERSION1
00135 #define GATTIMEPERIOD_MINOR_MASK  0x00ff
00136 
00137 /** GATResult  GATTimePeriod_Serialise(GATTimePeriod file, GATObject stream, GATBool clear_dirty)
00138  *  @brief Serialise a GATTimePeriod object
00139  *
00140  *  The function GATTimePeriod_Serialise serialises the given GATTimePeriod object into the
00141  *  given stream. 
00142  *
00143  *  @param object The GATTimePeriod object to serialise.
00144  *  @param stream The stream interface to use for the serialisation.
00145  *  @param clear_dirty If the clear_dirty parameter is set to GATTrue, the 
00146  *        internal dirty flag of this object is to be reset (no used here)
00147  *
00148  *  @return An error code.
00149  */
00150 GATResult  
00151   GATTimePeriod_Serialise(GATTimePeriod object, GATObject stream, 
00152     GATBool clear_dirty);
00153 
00154 /** GATTimePeriod GATTimePeriod_DeSerialise(GATContext context, GATObject stream, GATBool clear_dirty)
00155  *  @brief De-serialise a GATTimePeriod object
00156  *
00157  *  The function GATTimePeriod_DeSerialise de-serialises a streamed GATTimePeriod object  
00158  *  from the given stream  It constructs a new instance of the de-serialised 
00159  *  object.
00160  *
00161  *  @param context The GAT context to be used for object construction.
00162  *  @param stream The stream interface to use for the serialisation.
00163  *  @param result The pointer to a variable, which receives the status code of
00164  *        the operation.
00165  *
00166  *  @return The newly constructed GATTimePeriod object.
00167  */
00168 GATTimePeriod 
00169   GATTimePeriod_DeSerialise(GATContext context, GATObject stream, 
00170     GATResult *result);
00171 
00172 /** GATTimePeriod_GetIsDirty
00173  *  
00174  *  The function GATTimePeriod_GetIsDirty retrieves the status of the dirty flag of 
00175  *  this GATTimePeriod object.
00176  *
00177  *  @param object The GATTimePeriod object to inspect for its dirty status.
00178  *  @param isdirty The pointer to a variable, which receives the dirty status.
00179  *
00180  *  @return An error code.
00181  */
00182 GATResult  
00183   GATTimePeriod_GetIsDirty(GATTimePeriod_const object, GATBool *isdirty);
00184 
00185 
00186 /* GATTimePeriod API functions */
00187 
00188 /**
00189  * This operation returns the number of seconds this time
00190  * period lasts.
00191  *
00192  * @param this The GATTimePeriod to query
00193  * @return Number of seconds this time period lasts
00194  */
00195 GATdouble64 GATTimePeriod_GetDuration(GATTimePeriod_const period);
00196 
00197 #ifdef __cplusplus
00198 }
00199 #endif
00200 
00201 #endif /* _GATTIMEPERIOD_H_ */