Rcpp Version 0.12.12
Rcpp::Date Class Reference

#include <Date.h>

Public Member Functions

 Date ()
 
 Date (SEXP s)
 
 Date (const int &dt)
 
 Date (const double &dt)
 
 Date (const std::string &s, const std::string &fmt="%Y-%m-%d")
 
 Date (const unsigned int &mon, const unsigned int &day, const unsigned int &year)
 
 ~Date ()
 
double getDate (void) const
 
int getDay () const
 
int getMonth () const
 
int getYear () const
 
int getWeekday () const
 
int getYearday () const
 
int is_na () const
 
 operator double () const
 
std::string format (const char *fmt="%Y-%m-%d") const
 

Static Public Member Functions

static unsigned int baseYear ()
 

Private Member Functions

void update_tm ()
 

Private Attributes

double m_d
 
struct tm m_tm
 

Friends

Date operator+ (const Date &date, int offset)
 
double operator- (const Date &date1, const Date &date2)
 
bool operator< (const Date &date1, const Date &date2)
 
bool operator> (const Date &date1, const Date &date2)
 
bool operator== (const Date &date1, const Date &date2)
 
bool operator>= (const Date &date1, const Date &date2)
 
bool operator<= (const Date &date1, const Date &date2)
 
bool operator!= (const Date &date1, const Date &date2)
 
std::ostream & operator<< (std::ostream &os, const Date d)
 

Detailed Description

Definition at line 31 of file Date.h.

Constructor & Destructor Documentation

Rcpp::Date::Date ( )
inline

Definition at line 33 of file Date.h.

References m_d, and update_tm().

Referenced by Date().

Here is the call graph for this function:

Rcpp::Date::Date ( SEXP  s)
inline

Definition at line 25 of file Date.h.

References m_d, and update_tm().

Here is the call graph for this function:

Rcpp::Date::Date ( const int &  dt)
inline

Definition at line 40 of file Date.h.

References R::dt(), m_d, and update_tm().

Here is the call graph for this function:

Rcpp::Date::Date ( const double &  dt)
inline

Definition at line 46 of file Date.h.

References Date(), R::dt(), m_d, and update_tm().

Here is the call graph for this function:

Rcpp::Date::Date ( const std::string &  s,
const std::string &  fmt = "%Y-%m-%d" 
)
inline

Definition at line 30 of file Date.h.

References m_d, and update_tm().

Here is the call graph for this function:

Rcpp::Date::Date ( const unsigned int &  mon,
const unsigned int &  day,
const unsigned int &  year 
)
inline

Definition at line 52 of file Date.h.

References baseYear(), m_d, m_tm, and Rcpp::mktime00().

Here is the call graph for this function:

Rcpp::Date::~Date ( )
inline

Definition at line 70 of file Date.h.

Member Function Documentation

static unsigned int Rcpp::Date::baseYear ( )
inlinestatic

Definition at line 87 of file Date.h.

References operator!=, operator+, operator-, operator<, operator<=, operator==, operator>, and operator>=.

Referenced by Date(), and format().

std::string Rcpp::Date::format ( const char *  fmt = "%Y-%m-%d") const
inline

Definition at line 109 of file Date.h.

References baseYear(), m_tm, operator<<, and Rcpp::tm.

Referenced by Rcpp::operator<<().

Here is the call graph for this function:

double Rcpp::Date::getDate ( void  ) const
inline

Definition at line 72 of file Date.h.

References m_d.

Referenced by Rcpp::wrap().

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

Definition at line 80 of file Date.h.

References m_tm.

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

Definition at line 81 of file Date.h.

References m_tm.

int Rcpp::Date::getWeekday ( ) const
inline

Definition at line 83 of file Date.h.

References m_tm.

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

Definition at line 82 of file Date.h.

References m_tm.

int Rcpp::Date::getYearday ( ) const
inline

Definition at line 84 of file Date.h.

References m_tm.

int Rcpp::Date::is_na ( ) const
inline

Definition at line 101 of file Date.h.

References Rcpp::traits::is_na< REALSXP >(), and m_d.

Here is the call graph for this function:

Rcpp::Date::operator double ( ) const
inline

Definition at line 105 of file Date.h.

References m_d.

void Rcpp::Date::update_tm ( )
inlineprivate

Definition at line 128 of file Date.h.

References Rcpp::gmtime_(), m_d, and m_tm.

Referenced by Date().

Here is the call graph for this function:

Friends And Related Function Documentation

bool operator!= ( const Date date1,
const Date date2 
)
friend

Definition at line 172 of file Date.h.

Referenced by baseYear().

Date operator+ ( const Date date,
int  offset 
)
friend

Definition at line 158 of file Date.h.

Referenced by baseYear().

double operator- ( const Date date1,
const Date date2 
)
friend

Definition at line 166 of file Date.h.

Referenced by baseYear().

bool operator< ( const Date date1,
const Date date2 
)
friend

Definition at line 167 of file Date.h.

Referenced by baseYear().

std::ostream& operator<< ( std::ostream &  os,
const Date  d 
)
friend

Definition at line 174 of file Date.h.

Referenced by format().

bool operator<= ( const Date date1,
const Date date2 
)
friend

Definition at line 171 of file Date.h.

Referenced by baseYear().

bool operator== ( const Date date1,
const Date date2 
)
friend

Definition at line 169 of file Date.h.

Referenced by baseYear().

bool operator> ( const Date date1,
const Date date2 
)
friend

Definition at line 168 of file Date.h.

Referenced by baseYear().

bool operator>= ( const Date date1,
const Date date2 
)
friend

Definition at line 170 of file Date.h.

Referenced by baseYear().

Member Data Documentation

struct tm Rcpp::Date::m_tm
private

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