Skip to content
Snippets Groups Projects
Commit f44f8604 authored by Rahul Sinha's avatar Rahul Sinha
Browse files

Getting the structure of C-Doxy right. TODO Next: Programming guide style comments

parent beb30723
No related branches found
No related tags found
No related merge requests found
/**
* @addtogroup CBindings libmtime C language bindings
* @{
*
* @file calendar.c
* @file calendar.h
*
* @brief Singleton Calendar connecting all supported calendar types.
*
......@@ -13,17 +14,19 @@
#ifndef CALENDAR_H
#define CALENDAR_H
///provides a CALENDAR string length for toStrin.
#define MAX_CALENDAR_STR_LEN 32
struct _datetime;
struct _julianday;
/**
* @enum calendarType
*
* @brief calendar selector
* @enum calendarType
*
* @brief enum calendarType lists the calendarTypes supported. The values are used as a calendar selector.
*/
typedef enum
{
CALENDAR_NOT_SET = 0, PROLEPTIC_GREGORIAN = 1, YEAR_OF_365_DAYS = 2, YEAR_OF_360_DAYS = 3
......@@ -45,4 +48,7 @@ getCalendarType(void);
void
calendarToString(char *calendar);
/**
* @}
*/
#endif
/*! \cond PRIVATE */
/**
* @addtogroup CBindings libmtime C language bindings
* @{
*
* @file calendar_360day.h
*
* @brief Convert julian dates to Calendar-with-360-days dates and vice-versa.
*
* @author Luis Kornblueh, Max Planck Institute for Meteorology.
* @author Rahul Sinha, Max Planck Institute for Meteorology.
*
* @date March 2013
*
* @note Calendar-with-360-days has 30 days in 'every' month and hence 360 days in every calendar year.
* Also, Julian Day (0,0) corresponds to Calendar-with-360-day's day 0-01-01T12:00:00.000Z.
*/
#ifndef _CALENDAR_360DAY_H
#define _CALENDAR_360DAY_H
......@@ -9,4 +27,7 @@ getDate360FromJulian(struct _julianday *jd, struct _datetime* gd);
struct _julianday *
getJulianFromDate360(struct _datetime* gd, struct _julianday *jd);
/**
* @}
*/
#endif
/*! \cond PRIVATE */
/**
* @addtogroup CBindings libmtime C language bindings
* @{
*
* @file calendar_365day.h
*
* @brief Convert julian dates to Calendar-with-365-days dates and vice-versa.
*
* @author Luis Kornblueh, Max Planck Institute for Meteorology.
* @author Rahul Sinha, Max Planck Institute for Meteorology.
*
* @date March 2013
*
* @note Calendar-with-365-days has a non-leap year characteristic and has 365 days in a calendar year.
* Number of days in the 12 months is given by: { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }.
* Julian Day (0,0) corresponds to Calendar-with-365-day's day 0-01-01T12:00:00.000Z.
*
*/
#ifndef _CALENDAR_365DAY_H
#define _CALENDAR_365DAY_H
......@@ -9,4 +29,7 @@ getDate365FromJulian(struct _julianday *jd, struct _datetime* gd);
struct _julianday *
getJulianFromDate365(struct _datetime* gd, struct _julianday *jd);
/**
* @}
*/
#endif
/*! \cond PRIVATE */
/**
* @addtogroup CBindings libmtime C language bindings
* @{
*
* @file calendar_gregorian.h
*
* @brief Convert julian dates to Gregorian-Calendar dates and vice-versa.
*
* @author Luis Kornblueh, Max Planck Institute for Meteorology.
* @author Rahul Sinha, Max Planck Institute for Meteorology.
*
* @date March 2013
*
* @note TODO-Ask LUIS
*/
#ifndef _CALENDAR_GREGORIAN_H
#define _CALENDAR_GREGORIAN_H
......@@ -9,4 +27,8 @@ getDateGregorianFromJulian(struct _julianday *jd, struct _datetime* gd);
struct _julianday *
getJulianFromDateGregorian(struct _datetime* gd, struct _julianday *jd);
/**
* @}
*/
#endif
/**
* @addtogroup CBindings libmtime C language bindings
* @{
*
* @file date.h
*
* @brief Date and some operations supported on Date.
*
* @author Luis Kornblueh, Max Planck Institute for Meteorology.
* @author Rahul Sinha, Max Planck Institute for Meteorology.
*
* @date March 2013
*
*/
#ifndef _DATE_H
#define _DATE_H
#include <stdbool.h>
///provides a DATE string length for toString.
#define MAX_DATE_STR_LEN 32
struct _date;
struct _timedelta;
/**
* @struct _date
*
* @brief struct _date containing usual date parameters.
*/
struct _date
{
int64_t year;
......@@ -42,9 +64,7 @@ replaceDate(struct _date*, struct _date*);
char*
dateToString(struct _date*, char*);
/*
struct _datetime*
getFirstTriggerInDate(struct _datetime* event_start_dt, struct _timedelta* event_timestep, struct _date* onthis_d,
struct _datetime* first_in_dt);
*/
/**
* @}
*/
#endif
/**
* @addtogroup CBindings libmtime C language bindings
* @{
*
* @file datetime.h
*
* @brief DateTime and some operations supported on DateTime.
*
* @author Luis Kornblueh, Max Planck Institute for Meteorology.
* @author Rahul Sinha, Max Planck Institute for Meteorology.
*
* @date March 2013
*
*/
#ifndef _DATETIME_H
#define _DATETIME_H
......@@ -6,8 +22,15 @@
#include "date.h"
#include "time.h"
///provides a DATETIME string length for toString.
#define MAX_DATETIME_STR_LEN 32
/**
* @struct _datetime
*
* @brief struct _datetime contains a struct _date and a struct _time element.
*/
struct _datetime
{
struct _date date;
......@@ -53,4 +76,8 @@ getDayOfYearFromDateTime(struct _datetime* currentdt);
struct _julianday*
getJulianDayFromDateTime(struct _datetime* dt, struct _julianday* jd);
/**
* @}
*/
#endif
/**
* @addtogroup CBindings libmtime C language bindings
* @{
*
* @file event_handling.h
*
* @brief Event-groups which contains a list of events.
*
* @author Luis Kornblueh, Max Planck Institute for Meteorology.
* @author Rahul Sinha, Max Planck Institute for Meteorology.
*
* @date March 2013
*/
#ifndef EVENT_HANDLING_H
#define EVENT_HANDLING_H
#include <stdint.h>
#include <stdbool.h>
///provides a Maximum string length for Group Names.
#define MAX_GROUPNAME_STR_LEN 132
///provides a Maximum string length for Event names.
#define MAX_EVENTNAME_STR_LEN 132
struct _datetime;
struct _timedelta;
struct _event;
/**
* @struct _eventGroup
*
* @brief struct _eventGroup defines an Event-group. Each event group has an associated list of events.
* Event group is a place holder to 'group' events based on some user defined charteristics.
*
*/
struct _eventGroup
{
int64_t eventGroupId;
......@@ -31,6 +56,13 @@ addNewEventToEventGroup(struct _event* e, struct _eventGroup* eg);
bool
removeEventFromEventGroup(char* eventName, struct _eventGroup* eg);
/**
* @struct _event
*
* @brief struct _event defines events. Events are set to be triggered at pre-specified intervals.
*
*/
struct _event
{
//Auto generated.
......@@ -100,4 +132,8 @@ getTriggerNextEventAtDateTime(struct _event* e, struct _datetime* dt_return);
struct _datetime*
getTriggeredPreviousEventAtDateTime(struct _event* e, struct _datetime* dt_return);
/**
* @}
*/
#endif
/*! \cond PRIVATE */
/**
* @addtogroup CBindings libmtime C language bindings
* @{
*
* @file event_list.h
*
* @brief _eventList data structure supports 'Event-groups'; Each group stores multiple events as a link list of nodes.
*
* @author Luis Kornblueh, Max Planck Institute for Meteorology.
* @author Rahul Sinha, Max Planck Institute for Meteorology.
*
* @date March 2013
*
* @note All functions in this file are internal.
*/
#ifndef EVENT_LIST_H
#define EVENT_LIST_H
......@@ -5,12 +22,22 @@
struct _event;
/**
* @struct _node
*
* @brief struct _node represents a single node in the link list struct _eventList. Each node is associated with one struct _event.
*/
struct _node
{
struct _event* event;
struct _node *next;
};
/**
* @struct _eventList
*
* @brief struct _eventList is a link-list each of whose node is of type struct _node. Each list is associated with one struct _eventGroup.
*/
struct _eventList
{
struct _node* root;
......@@ -34,4 +61,7 @@ addNewNodeToList(struct _event* eventObj, struct _eventList* listObj);
bool
removeNodeWithNameFromList(char* nodeName, struct _eventList* listObj);
/**
* @}
*/
#endif
/*! \cond PRIVATE */
/**
* @addtogroup CBindings libmtime C language bindings
* @{
*
* @file iso8601.h
*
* @brief Routines and Data-Structures for checking ISO860 compliannce.
*
* @author Luis Kornblueh, Max Planck Institute for Meteorology.
* @author Rahul Sinha, Max Planck Institute for Meteorology.
*
* @date March 2013
*
*/
#ifndef _ISO8601_H
#define _ISO8601_H
#include <stdint.h>
//Change STATUS to something more specific. ISO8601_status for eg.
typedef enum
{
FAILURE = 0, DATETIME_MATCH = 1, DURATION_MATCH = 2
} STATUS;
} ISO8601_STATUS;
struct iso8601_duration
{
......@@ -48,10 +64,13 @@ new_iso8601_duration(char _sign, int64_t _year, int _month, int _day, int _hour,
void
deallocate_iso8601_duration(struct iso8601_duration* iso8601_durationObj);
STATUS
ISO8601_STATUS
verify_string_datetime(const char* test_string, struct iso8601_datetime* dummy_isoDtObj);
STATUS
ISO8601_STATUS
verify_string_duration(const char* test_string, struct iso8601_duration* dummy_isoDObj);
/**
* @}
*/
#endif
/**
* @addtogroup CBindings libmtime C language bindings
* @{
*
* @file julian_day.h
*
* @brief Julian Day Calendar and some operations supported on julian dates.
*
* @author Luis Kornblueh, Max Planck Institute for Meteorology.
* @author Rahul Sinha, Max Planck Institute for Meteorology.
*
* @date March 2013
*/
#ifndef JULIAN_DAY_H
#define JULIAN_DAY_H
......@@ -6,6 +20,12 @@
#define MAX_JULIANDAY_STR_LEN 32
/**
* @struct _julianday
*
* @brief Struct _julianday containing julian day parameters.
*/
struct _julianday
{
int64_t day;
......@@ -45,4 +65,8 @@ substractJulianDay(struct _julianday* jd1, struct _julianday* jd2, struct _julia
char*
juliandayToString(struct _julianday* jd, char* toStr);
/**
* @}
*/
#endif
......@@ -11,7 +11,7 @@
* @arg calendar the base calendar, either proleptic Gregorian, 365 day years, or 360 day years;
* @arg date a calendars date;
* @arg time a time at a day;
* @arg datettime date and time combined;
* @arg datetime date and time combined;
* @arg timedelta a difference in datetime;
* @arg julianday the Julian day to define the base time axis
*
......@@ -64,7 +64,7 @@
* @section Dependency
*
* The library should work correctly without any dependency under any
* Posix-compliant operating system. If you experiment some issue
* Posix-compliant operating system. If you experience some issue
* please contact me. The AUTHORS file provided with the software
* distribution contain developers contacts.
*
......@@ -77,13 +77,13 @@
*/
/** @defgroup CBindings C language bindings
* @ingroup libtime
* @ingroup libmtime
*
* This module documents the C language bindings
*/
/** @defgroup FortranBindings Fortran language bindings
* @ingroup libtime
* @ingroup libmtime
*
* This module documents the Fortran language bindings
*/
......
/**
* @addtogroup CBindings libmtime C language bindings
* @{
*
* @file time.h
*
* @brief Time and some operations supported on Time.
*
* @author Luis Kornblueh, Max Planck Institute for Meteorology.
* @author Rahul Sinha, Max Planck Institute for Meteorology
*
* @date March 2013
*
*/
#ifndef _TIME_H
#define _TIME_H
#include <stdint.h>
///provides a string length for toString
#define MAX_TIME_STR_LEN 32
struct _time;
/**
* @struct _time
*
* @brief struct _time containing usual time parameters.
*/
struct _time
{
int hour;
......@@ -33,5 +53,8 @@ replaceTime(struct _time*, struct _time*);
char*
timeToString(struct _time*, char*);
/**
* @}
*/
#endif
/**
* @addtogroup CBindings libmtime C language bindings
* @{
*
* @file timedelta.h
*
* @brief TimeDelta and some operations supported on TimeDelta.
*
* @author Luis Kornblueh, Max Planck Institute for Meteorology.
* @author Rahul Sinha, Max Planck Institute for Meteorology.
*
* @date March 2013
*
*/
#ifndef _TIMEDELTA_H
#define _TIMEDELTA_H
......@@ -12,6 +27,11 @@ struct _date;
struct _julianday;
struct _juliandelta;
/**
* @struct _timedelta
*
* @brief Struct _timedelta containing timedelta and sign of year parameter.
*/
struct _timedelta
{
/* Time delta can be positive or negative. Denoted by '+' or '-'*/
......@@ -72,4 +92,7 @@ moduloTimeDeltaFromDateTime(struct _datetime* start_dt, struct _timedelta* times
bool
testYearIsLeapYear(int64_t year);
/**
* @}
*/
#endif
This diff is collapsed.
......@@ -40,7 +40,7 @@ struct internal_datetime
static
void
date_machine( char *str, STATUS* stat, struct internal_datetime* dtObj, struct iso8601_duration* duObj)
date_machine( char *str, ISO8601_STATUS* stat, struct internal_datetime* dtObj, struct iso8601_duration* duObj)
{
char *p = str, *pe = str + strlen( str );
char *ts, *te = 0;
......@@ -517,7 +517,7 @@ date_machine( char *str, STATUS* stat, struct internal_datetime* dtObj, struct i
/* Internal Function. */
static
STATUS
ISO8601_STATUS
get_date_time(const char* buffer, struct iso8601_datetime* datetimeObj, struct iso8601_duration* durationObj)
{
/* Create a local buffer. */
......@@ -526,7 +526,7 @@ get_date_time(const char* buffer, struct iso8601_datetime* datetimeObj, struct i
buf[MAX_BUFFER_LENGTH-1] = '\0';
/* Success or Failure flag. */
STATUS stat = FAILURE;
ISO8601_STATUS stat = FAILURE;
/* Placeholder for values of DateTime and Duration. */
struct internal_datetime dtObj = {0};
......@@ -612,10 +612,10 @@ get_date_time(const char* buffer, struct iso8601_datetime* datetimeObj, struct i
/*Check DateTime string compliance and get DateTime values. */
STATUS
ISO8601_STATUS
verify_string_datetime(const char* test_string,struct iso8601_datetime* dummy_isoDtObj)
{
STATUS stat = FAILURE;
ISO8601_STATUS stat = FAILURE;
struct iso8601_duration* dummy_isoDObj = new_iso8601_duration('+',0,0,0,0,0,0,0);
if (dummy_isoDObj == NULL)
return FAILURE;
......@@ -628,10 +628,10 @@ verify_string_datetime(const char* test_string,struct iso8601_datetime* dummy_is
}
/*Check TimeDelta string compliance and get duration values.*/
STATUS
ISO8601_STATUS
verify_string_duration(const char* test_string, struct iso8601_duration* dummy_isoDObj)
{
STATUS stat = FAILURE;
ISO8601_STATUS stat = FAILURE;
struct iso8601_datetime* dummy_isoDtObj = new_iso8601_datetime('+',0,0,0,0,0,0,0,'Z');
if ( dummy_isoDtObj == NULL)
return FAILURE;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment