rubidium@9825: /* $Id$ */ rubidium@9825: rubidium@9825: /** @file ai_date.hpp declaration of class for AIDate class */ rubidium@9825: rubidium@9825: #ifndef AI_DATE_HPP rubidium@9825: #define AI_DATE_HPP rubidium@9825: rubidium@9825: #include "ai_object.hpp" rubidium@9825: rubidium@9825: /** rubidium@9825: * Class that handles all date related (calculation) functions. rubidium@9825: * rubidium@9825: * @note Months and days of month are 1-based; the first month of the rubidium@9825: * year is 1 and the first day of the month is also 1. rubidium@9825: * @note Years are zero based; they start with the year 0. rubidium@9825: * @note Dates can be used to determine the number of days between rubidium@9825: * two different moments in time because they count the number rubidium@9825: * of days since the year 0. rubidium@9825: */ rubidium@9825: class AIDate : public AIObject { rubidium@9825: public: rubidium@9825: /** rubidium@9825: * The name of the class, needed by several sub-processes. rubidium@9825: */ rubidium@9825: static const char *GetClassName() { return "AIDate"; } rubidium@9825: rubidium@9825: /** rubidium@9825: * Get the current date. rubidium@9825: * This is the number of days since epoch under the assumption that rubidium@9825: * there is a leap year every 4 years, except when dividable by rubidium@9825: * 100 but not by 400. rubidium@9825: * @return a date. rubidium@9825: */ rubidium@9825: static int32 GetCurrentDate(); rubidium@9825: rubidium@9825: /** rubidium@9825: * Get the year of the given date. rubidium@9825: * @param date the date to get the year of. rubidium@9825: * @return the year. rubidium@9825: */ rubidium@9825: static int32 GetYear(int32 date); rubidium@9825: rubidium@9825: /** rubidium@9825: * Get the month of the given date. rubidium@9825: * @param date the date to get the month of. rubidium@9825: * @return the month. rubidium@9825: */ rubidium@9825: static int32 GetMonth(int32 date); rubidium@9825: rubidium@9825: /** rubidium@9825: * Get the day (of the month) of the given date. rubidium@9825: * @param date the date to get the day of. rubidium@9825: * @return the day. rubidium@9825: */ rubidium@9825: static int32 GetDayOfMonth(int32 date); rubidium@9825: rubidium@9825: /** rubidium@9825: * Get the date given a year, month and day of month. rubidium@9825: * @param year the year of the to-be determined date. rubidium@9825: * @param month the month of the to-be determined date. rubidium@9825: * @param day_of_month the day of month of the to-be determined date. rubidium@9825: * @return the date. rubidium@9825: */ rubidium@9825: static int32 GetDate(int32 year, int32 month, int32 day_of_month); rubidium@9825: }; rubidium@9825: rubidium@9825: #endif /* AI_DATE_HPP */