ROOT_Application  2.0
C++ Core modules and GUIStock
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Attributes | Friends
SimpleData Class Reference

Derive class which contains only one value of type type_value_data (float or double). More...

#include <DataStock.h>

Inheritance diagram for SimpleData:
Inheritance graph
[legend]
Collaboration diagram for SimpleData:
Collaboration graph
[legend]

Public Member Functions

 SimpleData ()
 Default constructor, set value to 0. More...
 
 SimpleData (type_value_data ivalue)
 Initialize the value, date at 0. More...
 
 SimpleData (time_t d, type_value_data ivalue)
 Initialize date and value. More...
 
 SimpleData (unsigned int)
 Constructor with integer, no effect here but need for MultiData and ListDatStock template. More...
 
 SimpleData (const SimpleData &rhs)
 Copy constructor. More...
 
 SimpleData (SimpleData &&rhs)
 Move copy constructor. More...
 
virtual ~SimpleData ()
 Destructor. More...
 
Assignment operators
SimpleDataoperator= (const SimpleData &rhs)
 Normal assignment. More...
 
SimpleDataoperator= (SimpleData &&rhs)
 Move assignment. More...
 
Implementation of pure virtual functions for SimpleData
virtual void SetData (const time_t d, const std::vector< type_value_data > &vec)
 Set a full Data : date + value(s) in a vector. More...
 
virtual std::vector
< type_value_data
GetValues () const
 Return the value(s) in a vector. More...
 
virtual void SetValues (std::vector< type_value_data > &vec)
 Set only values, do not modify the date. More...
 
virtual type_value_data GetMaximum () const
 Get the maximum value, only one value in this class. More...
 
virtual type_value_data GetMinimum () const
 Get the minimum value, only one value in this class. More...
 
virtual bool HasChanged (const DataStock &data_to_check) const
 Check if data are different. More...
 
virtual void ExtractCSVLine (std::vector< std::string > &linecsv)
 Extract the data from a splitted string. More...
 
void PrintData (const unsigned int verbose=0) const
 User friendly output on screen. More...
 
Specific functions of SimpleData
type_value_data GetValue () const
 Get the unique value. More...
 
void SetValue (const type_value_data ivalue)
 Set the unique value. More...
 
void SetData (const time_t d, const type_value_data ivalue)
 Set the date and value. More...
 
- Public Member Functions inherited from DataStock
 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...
 
DataStockoperator= (const DataStock &rhs)
 Normal assignment. More...
 
DataStockoperator= (DataStock &&rhs)
 Move assignment. More...
 
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...
 

Protected Member Functions

Specific to input/output of SimpleData
virtual void helper_operator_write (std::ostream &os) const
 
virtual void helper_operator_read (std::iostream &ios)
 
- Protected Member Functions inherited from DataStock
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...
 

Private Attributes

type_value_data value
 

Friends

bool operator== (const SimpleData &lhs, const SimpleData &rhs)
 Compare date and value. More...
 

Additional Inherited Members

- Protected Attributes inherited from DataStock
time_t date
 All data have a date associated. More...
 

Detailed Description

Derive class which contains only one value of type type_value_data (float or double).

Used For Instantaneous value, Volume, SMA, EMA...

Definition at line 335 of file DataStock.h.

Constructor & Destructor Documentation

SimpleData::SimpleData ( )

Default constructor, set value to 0.

Definition at line 225 of file DataStock.cpp.

SimpleData::SimpleData ( type_value_data  ivalue)

Initialize the value, date at 0.

Definition at line 231 of file DataStock.cpp.

SimpleData::SimpleData ( time_t  d,
type_value_data  ivalue 
)

Initialize date and value.

Definition at line 237 of file DataStock.cpp.

SimpleData::SimpleData ( unsigned  int)

Constructor with integer, no effect here but need for MultiData and ListDatStock template.

Definition at line 243 of file DataStock.cpp.

SimpleData::SimpleData ( const SimpleData rhs)

Copy constructor.

Definition at line 247 of file DataStock.cpp.

References value.

SimpleData::SimpleData ( SimpleData &&  rhs)

Move copy constructor.

Definition at line 259 of file DataStock.cpp.

References value.

virtual SimpleData::~SimpleData ( )
inlinevirtual

Destructor.

Definition at line 354 of file DataStock.h.

Member Function Documentation

void SimpleData::ExtractCSVLine ( std::vector< std::string > &  linecsv)
virtual

Extract the data from a splitted string.

Format expected : "Date","float"

Parameters
linecsvline already split in a vector

Implements DataStock.

Definition at line 320 of file DataStock.cpp.

References DataStock::SetDate(), SetValue(), and Utils::StringToTime_t().

Here is the call graph for this function:

virtual type_value_data SimpleData::GetMaximum ( ) const
inlinevirtual

Get the maximum value, only one value in this class.

Implements DataStock.

Definition at line 375 of file DataStock.h.

References value.

virtual type_value_data SimpleData::GetMinimum ( ) const
inlinevirtual

Get the minimum value, only one value in this class.

Implements DataStock.

Definition at line 377 of file DataStock.h.

References value.

type_value_data SimpleData::GetValue ( ) const
inline

Get the unique value.

Definition at line 391 of file DataStock.h.

References value.

Referenced by DataCSV::AdditionData(), HasChanged(), helper_operator_write(), and ListDataStock_Utils::TransformTimeScale().

Here is the caller graph for this function:

std::vector< type_value_data > SimpleData::GetValues ( ) const
virtual

Return the value(s) in a vector.

Implements DataStock.

Definition at line 306 of file DataStock.cpp.

References value.

bool SimpleData::HasChanged ( const DataStock data_to_check) const
virtual

Check if data are different.

To compare all fields use operator==
Exact implementation is different for each derived class:

Todo:
check why DataCSV compares dates also, not the others why not use == now
case of double dispatching for DataCSV when compared with SimpleData, makes more general ?
Returns
true if values are considered different

Implements DataStock.

Definition at line 327 of file DataStock.cpp.

References DataStock::GetDate(), DataStock::GetDateString(), and GetValue().

Here is the call graph for this function:

SimpleData & SimpleData::operator= ( const SimpleData rhs)

Normal assignment.

Definition at line 271 of file DataStock.cpp.

References DataStock::operator=(), and value.

Here is the call graph for this function:

SimpleData & SimpleData::operator= ( SimpleData &&  rhs)

Move assignment.

Definition at line 288 of file DataStock.cpp.

References DataStock::operator=(), and value.

Here is the call graph for this function:

void SimpleData::PrintData ( const unsigned int  verbose = 0) const
virtual

User friendly output on screen.

verbose level:

  • 0 : default, print all data in one line, format with comma
  • 1 : add a header before the line

    Parameters
    verboselevel of output

Implements DataStock.

Definition at line 363 of file DataStock.cpp.

References FDS::WCOL.

Referenced by StockManager::SendDatadCSV().

Here is the caller graph for this function:

virtual void SimpleData::SetData ( const time_t  d,
const std::vector< type_value_data > &  vec 
)
inlinevirtual

Set a full Data : date + value(s) in a vector.

Implements DataStock.

Definition at line 366 of file DataStock.h.

References DataStock::date, and value.

Referenced by GetListDataFromPyList(), Stock::ReadCSV(), StockManager::SendDatadCSV(), wrap_SaveInst(), and wrap_UpdateCSV().

Here is the caller graph for this function:

void SimpleData::SetData ( const time_t  d,
const type_value_data  ivalue 
)
inline

Set the date and value.

Definition at line 395 of file DataStock.h.

References DataStock::date, and value.

void SimpleData::SetValue ( const type_value_data  ivalue)
inline

Set the unique value.

Definition at line 393 of file DataStock.h.

References value.

Referenced by ExtractCSVLine(), and helper_operator_read().

Here is the caller graph for this function:

void SimpleData::SetValues ( std::vector< type_value_data > &  )
virtual

Set only values, do not modify the date.

Implements DataStock.

Definition at line 313 of file DataStock.cpp.

References value.

Friends And Related Function Documentation

bool operator== ( const SimpleData lhs,
const SimpleData rhs 
)
friend

Compare date and value.

Definition at line 910 of file DataStock.cpp.

Field Documentation

type_value_data SimpleData::value
private

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