21 #include "../utils/Utils.h"
61 template <
typename ECSV>
63 return static_cast<unsigned int>(value); }
153 virtual void SetData(
const time_t d,
const std::vector<type_value_data> & vec ) =0;
156 virtual std::vector<type_value_data>
GetValues()
const =0;
159 virtual void SetValues( std::vector<type_value_data> & ) =0;
194 virtual void PrintData(
const unsigned int verbose = 0 )
const =0;
366 virtual void SetData(
const time_t d,
const std::vector<type_value_data> & vec) {
date=d;
value=vec[0];}
368 virtual std::vector<type_value_data>
GetValues()
const;
373 virtual void SetValues( std::vector<type_value_data> & vec);
384 void PrintData(
const unsigned int verbose = 0)
const;
448 MultiData(time_t d, std::vector<type_value_data> ivalues);
468 virtual std::vector<type_value_data>
GetValues()
const;
469 void SetValues( std::vector<type_value_data> & vec);
474 void PrintData(
const unsigned int verbose = 0 )
const;
536 virtual void SetData(
const time_t d,
const std::vector<type_value_data> & vec);
538 virtual std::vector<type_value_data>
GetValues()
const;
540 virtual void SetValues ( std::vector<type_value_data> & vec );
545 void PrintData(
const unsigned int verbose = 0 )
const;
Generalisation of SimpleData, contains a vector of type_value_data values.
SimpleData()
Default constructor, set value to 0.
virtual void SetData(const time_t d, const std::vector< type_value_data > &vec)
Set a full Data : date + value(s) in a vector.
void helper_operator_write_base(std::ostream &os) const
Helper function for operator>> for writing date to output.
virtual void ExtractCSVLine(std::vector< std::string > &linecsv)
Extract date and data from a split string.
type_value_data GetValue() const
Get the unique value.
virtual type_value_data GetMinimum() const
Get the minimum value, only one value in this class.
type_value_data GetClose() const
virtual type_value_data GetMaximum() const
Get the maximum value.
virtual void ExtractCSVLine(std::vector< std::string > &vec)=0
Extract date and data from a split string.
ECSV
Convenient enumeration for DataCSV, convertible to unsigned int for a general use in algorithms...
virtual type_value_data GetMaximum() const
Get the maximum value, only one value in this class.
DataStock()
Default constructor set date to 0.
void SetDate(const time_t d)
Modify the date.
virtual ~DataStock()
Destructor.
const int BUFFER_DATE
Contains the date, exactly 19 characters + terminal (terminal not really crucial) ...
virtual void ExtractCSVLine(std::vector< std::string > &linecsv)
Extract date and data from a split string.
const unsigned int nb_data
Number of data stored in the vector.
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.
const int BUFFER_STREAM
Maximum size buffer intermediate for stream.
virtual bool HasChanged(const DataStock &data_to_check) const
Check if data are different.
void SetData(const time_t d, const std::vector< type_value_data > &vec)
Set a full Data : date + value(s) in a vector.
unsigned int as_uint(const ECSV value)
function to provide a cast of ECSV to unsigned int
double type_value_data
Type of the floating values to be stored, can be set to float or double before compilation.
DataCSV()
Default constructor, set date and all values to 0.
void SetHigh(type_value_data ihigh)
friend std::ostream & operator<<(std::ostream &os, const DataStock &obj)
Fill ostream ( ostringstream ) with text data .
void SetValue(const type_value_data ivalue)
Set the unique value.
void PrintData(const unsigned int verbose=0) const
User friendly output on screen.
void PrintData(const unsigned int verbose=0) const
User friendly output on screen.
void SetValues(std::vector< type_value_data > &vec)
Set only values, do not modify the date.
virtual void helper_operator_read(std::iostream &ios)
void PrintData(const unsigned int verbose=0) const
User friendly output on screen.
DataStock & operator=(const DataStock &rhs)
Normal assignment.
virtual bool HasChanged(const DataStock &data_to_check) const =0
Check if data are different.
virtual type_value_data GetMaximum() const =0
Get the maximum value.
DataCSV & operator=(const DataCSV &rhs)
Normal assignment.
void Reset()
Set high and low values respectively to the minimum and maximum possible values for the type...
virtual void helper_operator_write(std::ostream &os) const
Data type to describe Japanese candlesticks : open, high, low and close values.
virtual ~DataCSV()
Destructor.
virtual void SetValues(std::vector< type_value_data > &)=0
Set only values, do not modify the date.
virtual std::vector< type_value_data > GetValues() const
Return the values in a vector, always 4 values: open, high, low, close.
virtual void helper_operator_write(std::ostream &os) const
virtual std::vector< type_value_data > GetValues() const
Return the value(s) in a vector.
virtual type_value_data GetMinimum() const =0
Get the minimum value.
virtual std::vector< type_value_data > GetValues() const =0
Return the value(s) in a vector.
virtual void AdditionData(const DataCSV &new_data)
With an other candlestick.
int helper_operator_read_base(std::iostream &ios)
Helper function for operator<< for reading date from input streams.
virtual void SetValues(std::vector< type_value_data > &vec)
Set the values with the same order.
friend bool operator==(const MultiData &lhs, const MultiData &rhs)
std::vector< type_value_data > values
Vector for storing values.
virtual void helper_operator_read(std::iostream &ios)
void SetOpen(type_value_data iopen)
virtual void SetData(const time_t d, const std::vector< type_value_data > &vec)
Set a full Data : date + value(s) in a vector.
virtual void helper_operator_read(std::iostream &ios)=0
void SetData(const time_t d, const type_value_data ivalue)
Set the date and value.
void SetLow(type_value_data ilow)
friend std::iostream & operator>>(std::iostream &ios, DataStock &obj)
Set a DataStock(s) with data from a iostream( e.g.,stringstream ) .
virtual void helper_operator_write(std::ostream &os) const =0
virtual std::vector< type_value_data > GetValues() const
Return the value(s) in a vector.
type_value_data GetOpen() const
virtual void PrintData(const unsigned int verbose=0) const =0
User friendly output on screen.
void SetClose(type_value_data iclose)
struct tm GetDateTm() const
Get a tm structure of the date.
Derive class which contains only one value of type type_value_data (float or double).
virtual bool HasChanged(const DataStock &data_to_check) const
Check if data are different.
virtual void helper_operator_write(std::ostream &os) const
MultiData()
Default constructor, set number of data to 1 and a default value of 0.
virtual bool HasChanged(const DataStock &data_to_check) const
Check if data are different.
virtual ~SimpleData()
Destructor.
SimpleData & operator=(const SimpleData &rhs)
Normal assignment.
type_value_data GetLow() const
time_t GetDate() const
Get the date data member.
type_value_data GetHigh() const
MultiData & operator=(const MultiData &rhs)
Normal assignment.
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) ...
virtual void helper_operator_read(std::iostream &ios)
virtual void ExtractCSVLine(std::vector< std::string > &linecsv)
Extract the data from a splitted string.
virtual type_value_data GetMinimum() const
Get the minimum value.
friend bool operator==(const DataCSV &lhs, const DataCSV &rhs)
Compare all fields, date and values.
time_t date
All data have a date associated.
virtual type_value_data GetMinimum() const
Get the minimum value.
virtual type_value_data GetMaximum() const
Get the maximum value.
friend bool operator==(const SimpleData &lhs, const SimpleData &rhs)
Compare date and value.
virtual void SetValues(std::vector< type_value_data > &vec)
Set only values, do not modify the date.
Abstract base class for all Data to be stored in ListDataStock.