22#ifndef Rcpp__newDatetimeVector_h
23#define Rcpp__newDatetimeVector_h
35 template <
int RTYPE,
bool NA,
typename VEC>
52 size_t n = this->
size();
53 std::vector<Datetime> v(n);
54 for (
size_t i=0; i<n; i++)
62 this->
attr(
"tzone") = rhs.
attr(
"tzone");
74 SET_STRING_ELT(datetimeclass, 0, Rf_mkChar(
"POSIXct"));
75 SET_STRING_ELT(datetimeclass, 1, Rf_mkChar(
"POSIXt"));
76 Rf_setAttrib(*
this, R_ClassSymbol, datetimeclass);
78 if (strcmp(tz,
"") != 0) {
80 Rf_setAttrib(*
this, Rf_install(
"tzone"), tzsexp);
87 for (
size_t i=0; i<n; i++) {
89 if ((i+1) % 4 == 0) os <<
"\n";
AttributeProxy attr(const std::string &name)
std::string format(const char *fmt="%Y-%m-%d %H:%M:%S") const
Vector & operator=(const Vector &rhs)
newDatetimeVector(SEXP vec, const char *tz="")
newDatetimeVector(int n, const char *tz="")
newDatetimeVector(const char *tz="")
newDatetimeVector(const VectorBase< RTYPE, NA, VEC > &other, const char *tz="")
newDatetimeVector & operator=(const newDatetimeVector &rhs)
std::vector< Datetime > getDatetimes() const
friend std::ostream & operator<<(std::ostream &s, const newDatetimeVector d)
void setClass(const char *tz)
Vector< REALSXP > NumericVector
std::ostream & operator<<(std::ostream &os, const Date d)