bpp-popgen  3.0.0
bpp::Date Class Reference

The Date class. More...

#include <Bpp/PopGen/DataSet/Date.h>

+ Inheritance diagram for bpp::Date:
+ Collaboration diagram for bpp::Date:

Public Member Functions

 Date (const int day=1, const int month=1, const int year=2000)
 Build a new Date from three values. More...
 
 Date (const Date &date)
 The Date copy constructor. More...
 
 ~Date ()
 Destroy the Date object. More...
 
Dateoperator= (const Date &date)
 The Date copy operator. More...
 
void setDate (const int day, const int month, const int year)
 Set the Date. More...
 
void setYear (const int year)
 Set the year. More...
 
void setMonth (const int month)
 Set the month. More...
 
void setDay (const int day)
 Set the day. More...
 
std::string getDateStr () const
 Get the Date as a string. More...
 
int getYear () const
 Get the Year as an int. More...
 
int getMonth () const
 Get the month as an int. More...
 
int getDay () const
 Get the day as an int. More...
 
bool operator== (const Date &date) const
 The == operator. More...
 
bool operator< (const Date &date) const
 The < operator. More...
 
bool operator!= (const Date &date) const
 The != operator. More...
 
bool operator> (const Date &date) const
 The > operator. More...
 
bool operator<= (const Date &date) const
 The <= operator. More...
 
bool operator>= (const Date &date) const
 The >= operator. More...
 
The Clonable interface
Dateclone () const
 

Private Attributes

int day_
 
int month_
 
int year_
 

Detailed Description

The Date class.

This is a little class to deal with dates.

Author
Sylvain Gaillard

Definition at line 56 of file Date.h.

Constructor & Destructor Documentation

◆ Date() [1/2]

Date::Date ( const int  day = 1,
const int  month = 1,
const int  year = 2000 
)

Build a new Date from three values.

Build a new Date from three integers. The default Date is set to 01-01-2000.

Parameters
dayThe day between 1 and 31.
monthThe month between 1 and 12.
yearThe year as a signed int.

Definition at line 50 of file Date.cpp.

Referenced by clone().

◆ Date() [2/2]

Date::Date ( const Date date)

The Date copy constructor.

Definition at line 60 of file Date.cpp.

◆ ~Date()

Date::~Date ( )

Destroy the Date object.

Definition at line 66 of file Date.cpp.

Member Function Documentation

◆ clone()

Date* bpp::Date::clone ( ) const
inlinevirtual

Implements bpp::Clonable.

Definition at line 191 of file Date.h.

References Date().

◆ getDateStr()

std::string Date::getDateStr ( ) const

Get the Date as a string.

Returns
The date as a string DDMMYYYY (i.e. January 1 2000 : 01012000).

Definition at line 112 of file Date.cpp.

References day_, month_, bpp::TextTools::toString(), and year_.

Referenced by bpp::PopgenlibIO::write().

◆ getDay()

int bpp::Date::getDay ( ) const
inline

Get the day as an int.

Definition at line 146 of file Date.h.

References day_.

Referenced by operator<(), operator=(), and operator==().

◆ getMonth()

int bpp::Date::getMonth ( ) const
inline

Get the month as an int.

Definition at line 141 of file Date.h.

References month_.

Referenced by operator<(), operator=(), and operator==().

◆ getYear()

int bpp::Date::getYear ( ) const
inline

Get the Year as an int.

Definition at line 136 of file Date.h.

References year_.

Referenced by operator<(), operator=(), and operator==().

◆ operator!=()

bool bpp::Date::operator!= ( const Date date) const
inline

The != operator.

Definition at line 165 of file Date.h.

◆ operator<()

bool Date::operator< ( const Date date) const

The < operator.

Return true if the left Date is minor than the right Date.

Definition at line 131 of file Date.cpp.

References day_, getDay(), getMonth(), getYear(), month_, and year_.

◆ operator<=()

bool bpp::Date::operator<= ( const Date date) const
inline

The <= operator.

Definition at line 175 of file Date.h.

◆ operator=()

Date & Date::operator= ( const Date date)

The Date copy operator.

Returns
A ref toward the assigned Date.

Definition at line 70 of file Date.cpp.

References day_, getDay(), getMonth(), getYear(), month_, and year_.

◆ operator==()

bool Date::operator== ( const Date date) const

The == operator.

Test the numerical equality between to dates.

Definition at line 123 of file Date.cpp.

References day_, getDay(), getMonth(), getYear(), month_, and year_.

◆ operator>()

bool bpp::Date::operator> ( const Date date) const
inline

The > operator.

Definition at line 170 of file Date.h.

◆ operator>=()

bool bpp::Date::operator>= ( const Date date) const
inline

The >= operator.

Definition at line 180 of file Date.h.

◆ setDate()

void Date::setDate ( const int  day,
const int  month,
const int  year 
)

Set the Date.

Parameters
dayThe day as an integer between 1 and 31.
monthThe month as an integer between 1 and 12.
yearThe year as an integer.

Definition at line 78 of file Date.cpp.

References day_, month_, and year_.

◆ setDay()

void Date::setDay ( const int  day)

Set the day.

Parameters
dayThe day as an integer between 1 and 31.

Definition at line 104 of file Date.cpp.

References day_.

◆ setMonth()

void Date::setMonth ( const int  month)

Set the month.

Parameters
monthThe month as an integer between 1 and 12.

Definition at line 96 of file Date.cpp.

References month_.

◆ setYear()

void Date::setYear ( const int  year)

Set the year.

Parameters
yearThe year as an integer.

Definition at line 91 of file Date.cpp.

References year_.

Member Data Documentation

◆ day_

int bpp::Date::day_
private

Definition at line 59 of file Date.h.

Referenced by getDateStr(), getDay(), operator<(), operator=(), operator==(), setDate(), and setDay().

◆ month_

int bpp::Date::month_
private

Definition at line 60 of file Date.h.

Referenced by getDateStr(), getMonth(), operator<(), operator=(), operator==(), setDate(), and setMonth().

◆ year_

int bpp::Date::year_
private

Definition at line 61 of file Date.h.

Referenced by getDateStr(), getYear(), operator<(), operator=(), operator==(), setDate(), and setYear().


The documentation for this class was generated from the following files: