ANNA Suite  2020b
Multipurpose development suite for Telco applications
Public Member Functions | List of all members
anna::dbms::TimeStamp Class Reference

#include <TimeStamp.hpp>

Inheritance diagram for anna::dbms::TimeStamp:
Inheritance graph
[legend]
Collaboration diagram for anna::dbms::TimeStamp:
Collaboration graph
[legend]

Public Member Functions

 TimeStamp (const bool isNulleable=false, const char *format=NULL)
 
int getFractionalSecond () const
 
void setFractionalSecond (const int fsec)
 
virtual const char * getCStringValue () const
 
TimeStampoperator= (const TimeStamp &timeStamp) noexcept(false)
 
TimeStampoperator= (const Date &date) noexcept(false)
 
- Public Member Functions inherited from anna::dbms::Date
 Date (const bool isNulleable=false, const char *format=NULL)
 
 Date (const Date &other)
 
virtual ~Date ()
 
const tm & getValue () const
 
tm & getValue ()
 
Second getSecondValue () const
 
const char * getFormat () const
 
int getYear () const
 
int getMonth () const
 
int getDay () const
 
int getHour () const
 
int getMinute () const
 
int getSecond () const
 
void setYear (const int year) noexcept(false)
 
void setMonth (const int month) noexcept(false)
 
void setDay (const int day) noexcept(false)
 
void setHour (const int hour) noexcept(false)
 
void setMinute (const int minute) noexcept(false)
 
void setSecond (const int second) noexcept(false)
 
void setValue (const char *str) noexcept(false)
 
void setValue (const std::string &str) noexcept(false)
 
void setValue (const Second &second) noexcept(false)
 
Dateoperator= (const Date &date) noexcept(false)
 
virtual std::string asString () const
 
- Public Member Functions inherited from anna::dbms::Data
int getMaxSize () const
 
Type::_v getType () const
 
void * getBuffer ()
 
bool isNull () const
 
bool isNulleable () const
 
void setNull (const bool isNull)
 
void clear ()
 

Additional Inherited Members

- Static Public Attributes inherited from anna::dbms::Date
static const int MaxDateSize = 48
 
- Protected Member Functions inherited from anna::dbms::Date
 Date (const Type::_v type, const bool isNulleable, const char *format)
 
- Protected Member Functions inherited from anna::dbms::Data
 Data (const Type::_v type, const int maxSize, const bool isNulleable)
 
 Data (const Data &other)
 
void setBuffer (void *buffer)
 
- Protected Attributes inherited from anna::dbms::Date
char * a_format
 
tm a_value
 
char a_buffer [MaxDateSize+1]
 

Detailed Description

Tipo de datos que permite trabajar con el tipo de dato 'TimeStamp' de un gestor de base de datos generico.

El tipo de dato TimeStamp contiene la información suficiente para representar una fecha incluyendo la hora del día.

Constructor & Destructor Documentation

◆ TimeStamp()

anna::dbms::TimeStamp::TimeStamp ( const bool  isNulleable = false,
const char *  format = NULL 
)
inlineexplicit

Constructor.

Parameters
isNulleableIndica si el dato puede tomar valores nulos.
formatFormato usado para interpretar los datos de esta fecha, en los metodos Date::getCStringValue y Date::setValue (const char*) y Date::setValue (const std::string&). Sigue la especificacion:
%a Replaced by the localeâs abbreviated weekday name. [ tm_wday]
%A Replaced by the localeâs full weekday name. [ tm_wday]
%b Replaced by the localeâs abbreviated month name. [ tm_mon]
%B Replaced by the localeâs full month name. [ tm_mon]
%c Replaced by the locale's appropriate date and time representation. (See the Base Definitions volume of
IEEE Std 1003.1-2001, <time.h>.)
%C Replaced by the year divided by 100 and truncated to an integer, as a decimal number [00,99]. [ tm_year]
%d Replaced by the day of the month as a decimal number [01,31]. [ tm_mday]
%D Equivalent to %m / %d / %y . [ tm_mon, tm_mday, tm_year]
%e Replaced by the day of the month as a decimal number [1,31]; a single digit is preceded by a space. [
tm_mday]
%F Equivalent to %Y - %m - %d (the ISO 8601:2000 standard date format). [ tm_year, tm_mon, tm_mday]
%g Replaced by the last 2 digits of the week-based year (see below) as a decimal number [00,99]. [ tm_year,
tm_wday, tm_yday]
%G Replaced by the week-based year (see below) as a decimal number (for example, 1977). [ tm_year, tm_wday,
tm_yday]
%h Equivalent to %b . [ tm_mon]
%H Replaced by the hour (24-hour clock) as a decimal number [00,23]. [ tm_hour]
%I Replaced by the hour (12-hour clock) as a decimal number [01,12]. [ tm_hour]
%j Replaced by the day of the year as a decimal number [001,366]. [ tm_yday]
%m Replaced by the month as a decimal number [01,12]. [ tm_mon]
%M Replaced by the minute as a decimal number [00,59]. [ tm_min]
%n Replaced by a <newline>.
%p Replaced by the locale's equivalent of either a.m. or p.m. [ tm_hour]
%r Replaced by the time in a.m. and p.m. notation; in the POSIX locale this shall be equivalent to %I : %M
: %S %p . [ tm_hour, tm_min, tm_sec]
%R Replaced by the time in 24-hour notation ( %H : %M ). [ tm_hour, tm_min]
%S Replaced by the second as a decimal number [00,60]. [ tm_sec]
%t Replaced by a <tab>.
%T Replaced by the time ( %H : %M : %S ). [ tm_hour, tm_min, tm_sec]
%u Replaced by the weekday as a decimal number [1,7], with 1 representing Monday. [ tm_wday]
%U Replaced by the week number of the year as a decimal number [00,53]. The first Sunday of January is the
first day of week 1; days in the new year before this are in week 0. [ tm_year, tm_wday, tm_yday]
%V Replaced by the week number of the year (Monday as the first day of the week) as a decimal number [01,53].
If the week containing 1 January has four or more days in the new year, then it is considered week 1. Oth-
erwise, it is the last week of the previous year, and the next week is week 1. Both January 4th and the
first Thursday of January are always in week 1. [ tm_year, tm_wday, tm_yday]
%w Replaced by the weekday as a decimal number [0,6], with 0 representing Sunday. [ tm_wday]
%W Replaced by the week number of the year as a decimal number [00,53]. The first Monday of January is the
first day of week 1; days in the new year before this are in week 0. [ tm_year, tm_wday, tm_yday]
%x Replaced by the locale's appropriate date representation. (See the Base Definitions volume of
IEEE Std 1003.1-2001, <time.h>.)
%X Replaced by the locale's appropriate time representation. (See the Base Definitions volume of
IEEE Std 1003.1-2001, <time.h>.)
%y Replaced by the last two digits of the year as a decimal number [00,99]. [ tm_year]
%Y Replaced by the year as a decimal number (for example, 1997). [ tm_year]
%z Replaced by the offset from UTC in the ISO 8601:2000 standard format ( +hhmm or -hhmm ), or by no charac-
ters if no timezone is determinable. For example, "-0430" means 4 hours 30 minutes behind UTC (west of
Greenwich). If tm_isdst is zero, the standard time offset is used. If tm_isdst is greater than zero, the
daylight savings time offset is used. If tm_isdst is negative, no characters are returned. [ tm_isdst]
%Z Replaced by the timezone name or abbreviation, or by no bytes if no timezone information exists. [
tm_isdst]
%% Replaced by % .

Para obtener más informacion sobre la espeficacion de formato man strftime (p.e.).

Para poder obtener la parte fraccionaria en la salida del metodo getCStringValue hay que indicar el literal %d. Por ejemplo:

TimeStamp oneTime (false, "%T.%%d")
133  :
135  a_fractionalSecond(0)
136  {;}
Definition: Data.hpp:37
Date(const bool isNulleable=false, const char *format=NULL)
bool isNulleable() const
Definition: Data.hpp:68

Member Function Documentation

◆ getCStringValue()

virtual const char* anna::dbms::TimeStamp::getCStringValue ( ) const
virtual

Interpreta el contenido de la fecha y lo transfiere al buffer.

Returns
El buffer que contiene esta fecha interpretada con el formato indicado en el contructor.
Warning
El resultado sera NULL en caso de no poder interpretar correctamente la fecha.

Reimplemented from anna::dbms::Date.

◆ getFractionalSecond()

int anna::dbms::TimeStamp::getFractionalSecond ( ) const
inline

Devuelve la parte fraccionaria de los segundos asociados a este objeto.

Returns
La parte fraccionaria de los segundos asociados a este objeto.
142 { return a_fractionalSecond; }

◆ operator=() [1/2]

TimeStamp& anna::dbms::TimeStamp::operator= ( const TimeStamp timeStamp)
inlinenoexcept

Operador de copia.

Parameters
timeStampFecha de la que copiar.
Returns
La instancia de esta fecha.
Warning
Solo copia el contenido de la fecha recibida, no cambia el formato de interpretacion de la fecha origen.
163  {
164  Date::operator= (timeStamp);
165  a_fractionalSecond = timeStamp.a_fractionalSecond;
166  return *this;
167  }
Date & operator=(const Date &date) noexcept(false)
Here is the call graph for this function:

◆ operator=() [2/2]

TimeStamp& anna::dbms::TimeStamp::operator= ( const Date date)
inlinenoexcept

Operador de copia.

Parameters
dateFecha de la que copiar.
Returns
La instancia de esta fecha.
Warning
Solo copia el contenido de la fecha recibida, no cambia el formato de interpretacion de la fecha origen.
175 { Date::operator= (date); a_fractionalSecond = 0; return *this; }
Date & operator=(const Date &date) noexcept(false)
Here is the call graph for this function:

◆ setFractionalSecond()

void anna::dbms::TimeStamp::setFractionalSecond ( const int  fsec)
inline

Establece la parte fraccionaria de los segundos de este objeto.

Parameters
fsecParte fraccionaria de los segundos.
148 { a_fractionalSecond = fsec; }
Here is the call graph for this function:

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