ROOT_Application
2.0
C++ Core modules and GUIStock
|
Abstract base class for all Data to be stored in ListDataStock. More...
#include <DataStock.h>
Public Member Functions | |
Constructors and destructor | |
DataStock () | |
Default constructor set date to 0. More... | |
DataStock (time_t d) | |
Set the date, used in initialization of derived classes. More... | |
DataStock (const DataStock &rhs) | |
Copy constructor. More... | |
DataStock (DataStock &&rhs) | |
Move copy constructor. More... | |
virtual | ~DataStock () |
Destructor. More... | |
Assignment operators | |
DataStock & | operator= (const DataStock &rhs) |
Normal assignment. More... | |
DataStock & | operator= (DataStock &&rhs) |
Move assignment. More... | |
Not virtual functions, act only on dates | |
time_t | GetDate () const |
Get the date data member. More... | |
void | SetDate (const time_t d) |
Modify the date. More... | |
std::string | GetDateString (const bool bhours=true) const |
Return the date in a string format: "YEAR-MOnth-DAy HH:MM:SS" (2014-11-10 13::25::00) More... | |
struct tm | GetDateTm () const |
Get a tm structure of the date. More... | |
Pure virtual functions | |
virtual void | SetData (const time_t d, const std::vector< type_value_data > &vec)=0 |
Set a full Data : date + value(s) in a vector. More... | |
virtual std::vector < type_value_data > | GetValues () const =0 |
Return the value(s) in a vector. More... | |
virtual void | SetValues (std::vector< type_value_data > &)=0 |
Set only values, do not modify the date. More... | |
virtual type_value_data | GetMaximum () const =0 |
Get the maximum value. More... | |
virtual type_value_data | GetMinimum () const =0 |
Get the minimum value. More... | |
virtual bool | HasChanged (const DataStock &data_to_check) const =0 |
Check if data are different. More... | |
virtual void | ExtractCSVLine (std::vector< std::string > &vec)=0 |
Extract date and data from a split string. More... | |
virtual void | PrintData (const unsigned int verbose=0) const =0 |
User friendly output on screen. More... | |
Pure virtual helper functions for operator << and >> | |
virtual void | helper_operator_write (std::ostream &os) const =0 |
virtual void | helper_operator_read (std::iostream &ios)=0 |
Protected Member Functions | |
int | helper_operator_read_base (std::iostream &ios) |
Helper function for operator<< for reading date from input streams. More... | |
void | helper_operator_write_base (std::ostream &os) const |
Helper function for operator>> for writing date to output. More... | |
Protected Attributes | |
time_t | date |
All data have a date associated. More... | |
Friends | |
Friend operators for input/output. | |
The functions allow to combine DataStocks and use pointer or reference to the base class. More description of their usage in this link | |
std::ostream & | operator<< (std::ostream &os, const DataStock &obj) |
Fill ostream ( ostringstream ) with text data . More... | |
std::iostream & | operator>> (std::iostream &ios, DataStock &obj) |
Set a DataStock(s) with data from a iostream( e.g.,stringstream ) . More... | |
std::string & | operator<< (std::string &line_csv, const DataStock &obj) |
Similar operator, but for use with string as output. More... | |
std::string & | operator>> (std::string &line_csv, DataStock &obj) |
Similar operator, but can use string as input. More... | |
Abstract base class for all Data to be stored in ListDataStock.
Define a common time_t
date (and associated methods) for all subclasses and pure virtual function to override
Definition at line 90 of file DataStock.h.
DataStock::DataStock | ( | ) |
Default constructor set date to 0.
Definition at line 84 of file DataStock.cpp.
DataStock::DataStock | ( | time_t | d | ) |
Set the date, used in initialization of derived classes.
Definition at line 90 of file DataStock.cpp.
DataStock::DataStock | ( | const DataStock & | rhs | ) |
DataStock::DataStock | ( | DataStock && | rhs | ) |
|
inlinevirtual |
Destructor.
Definition at line 111 of file DataStock.h.
|
pure virtual |
Extract date and data from a split string.
vec | vector of string containing the date and the value(s) |
Implemented in DataCSV, MultiData, and SimpleData.
|
inline |
Get the date data member.
Definition at line 126 of file DataStock.h.
References date.
Referenced by ListDataStock< T, PolicyChronologic >::AddToList(), SimpleData::HasChanged(), DataCSV::HasChanged(), ListDataStock< T, PolicyChronologic >::PutCArray(), Stock::ReadCSV(), ListObjectStock< T >::SetObjectStock(), PStockLine::SetObjectStock(), CollectionObjectStock::SetObjectStock(), and ListDataStock_Utils::TransformTimeScale().
std::string DataStock::GetDateString | ( | const bool | bhours = true | ) | const |
Return the date in a string format: "YEAR-MOnth-DAy HH:MM:SS" (2014-11-10 13::25::00)
by default only "YEAR-MOnth-DAy"
bhours | optional boolean, true will include "HH:MM:SS" |
Definition at line 164 of file DataStock.cpp.
References date, and Utils::Time_tToString().
Referenced by SimpleData::HasChanged(), DataCSV::HasChanged(), and helper_operator_write_base().
struct tm DataStock::GetDateTm | ( | ) | const |
Get a tm structure of the date.
It allows specifaclly to access week number
Definition at line 151 of file DataStock.cpp.
Referenced by THistPainterStock::SetLabelXAxis(), and ListDataStock_Utils::TransformTimeScale().
|
pure virtual |
Get the maximum value.
Implemented in DataCSV, MultiData, and SimpleData.
|
pure virtual |
Get the minimum value.
Implemented in DataCSV, MultiData, and SimpleData.
|
pure virtual |
Return the value(s) in a vector.
Implemented in DataCSV, MultiData, and SimpleData.
Referenced by MultiData::HasChanged(), ListObjectStock< T >::SetObjectStock(), PStockLine::SetObjectStock(), and CollectionObjectStock::SetObjectStock().
|
pure virtual |
Check if data are different.
To compare all fields use operator==
Exact implementation is different for each derived class:
Implemented in DataCSV, MultiData, and SimpleData.
Normal assignment.
Definition at line 118 of file DataStock.cpp.
References date.
Referenced by SimpleData::operator=(), MultiData::operator=(), and DataCSV::operator=().
|
pure virtual |
User friendly output on screen.
verbose level:
1 : add a header before the line
verbose | level of output |
Implemented in DataCSV, MultiData, and SimpleData.
|
pure virtual |
Set a full Data : date + value(s) in a vector.
Implemented in DataCSV, MultiData, and SimpleData.
|
inline |
Modify the date.
d | new_date |
Definition at line 130 of file DataStock.h.
References date.
Referenced by SimpleData::ExtractCSVLine(), and helper_operator_read_base().
|
pure virtual |
Set only values, do not modify the date.
Implemented in DataCSV, MultiData, and SimpleData.
|
protected |
All data have a date associated.
Unix timestamp is used for all.
Localtime is always used ( epoch: 0 <=> 1 hour in Europe )
Definition at line 97 of file DataStock.h.
Referenced by DataStock(), GetDate(), GetDateString(), operator=(), operator==(), SimpleData::SetData(), MultiData::SetData(), DataCSV::SetData(), and SetDate().