src/ai/api/ai_date.hpp
author rubidium
Thu, 27 Mar 2008 05:15:06 +0000
branchnoai
changeset 9825 cc77111ebd85
child 9829 80fbe02a4184
permissions -rw-r--r--
(svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
9825
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
     1
/* $Id$ */
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
     2
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
     3
/** @file ai_date.hpp declaration of class for AIDate class */
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
     4
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
     5
#ifndef AI_DATE_HPP
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
     6
#define AI_DATE_HPP
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
     7
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
     8
#include "ai_object.hpp"
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
     9
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    10
/**
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    11
 * Class that handles all date related (calculation) functions.
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    12
 *
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    13
 * @note Months and days of month are 1-based; the first month of the
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    14
 *       year is 1 and the first day of the month is also 1.
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    15
 * @note Years are zero based; they start with the year 0.
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    16
 * @note Dates can be used to determine the number of days between
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    17
 *       two different moments in time because they count the number
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    18
 *       of days since the year 0.
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    19
 */
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    20
class AIDate : public AIObject {
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    21
public:
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    22
	/**
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    23
	 * The name of the class, needed by several sub-processes.
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    24
	 */
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    25
	static const char *GetClassName() { return "AIDate"; }
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    26
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    27
	/**
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    28
	 * Get the current date.
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    29
	 * This is the number of days since epoch under the assumption that
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    30
	 * there is a leap year every 4 years, except when dividable by
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    31
	 * 100 but not by 400.
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    32
	 * @return a date.
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    33
	 */
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    34
	static int32 GetCurrentDate();
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    35
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    36
	/**
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    37
	 * Get the year of the given date.
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    38
	 * @param date the date to get the year of.
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    39
	 * @return the year.
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    40
	 */
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    41
	static int32 GetYear(int32 date);
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    42
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    43
	/**
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    44
	 * Get the month of the given date.
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    45
	 * @param date the date to get the month of.
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    46
	 * @return the month.
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    47
	 */
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    48
	static int32 GetMonth(int32 date);
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    49
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    50
	/**
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    51
	 * Get the day (of the month) of the given date.
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    52
	 * @param date the date to get the day of.
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    53
	 * @return the day.
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    54
	 */
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    55
	static int32 GetDayOfMonth(int32 date);
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    56
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    57
	/**
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    58
	 * Get the date given a year, month and day of month.
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    59
	 * @param year the year of the to-be determined date.
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    60
	 * @param month the month of the to-be determined date.
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    61
	 * @param day_of_month the day of month of the to-be determined date.
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    62
	 * @return the date.
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    63
	 */
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    64
	static int32 GetDate(int32 year, int32 month, int32 day_of_month);
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    65
};
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    66
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    67
#endif /* AI_DATE_HPP */