ROOT_Application
2.0
C++ Core modules and GUIStock
|
Implementation file of DataStock classes. More...
#include "DataStock.h"
#include <iomanip>
#include <sstream>
#include <cassert>
#include <cstring>
#include <limits>
Go to the source code of this file.
Namespaces | |
FDS | |
For Format of the DataStock output. | |
Functions | |
size_t | reconstruct_stream_operator (std::iostream &is, char *buf_to_ret) |
Reconstruct a stream in skipping the values already consumed This is used by friend operator>> ( iostream ) This version use only C-string array, no string or streamstring intermediate. More... | |
bool | operator== (const SimpleData &lhs, const SimpleData &rhs) |
bool | operator== (const MultiData &lhs, const MultiData &rhs) |
bool | operator== (const DataCSV &lhs, const DataCSV &rhs) |
std::ostream & | operator<< (std::ostream &os, const DataStock &obj) |
std::iostream & | operator>> (std::iostream &ios, DataStock &obj) |
std::string & | operator<< (std::string &line_csv, const DataStock &obj) |
std::string & | operator>> (std::string &line_csv, DataStock &obj) |
Variables | |
const int | FDS::WCOL = 10 |
Witdh of the values with setw. More... | |
const int | FDS::PRECISION = 2 |
Precison of floating numbers. More... | |
Implementation file of DataStock classes.
Last modified :
Definition in file DataStock.cpp.
std::ostream& operator<< | ( | std::ostream & | os, |
const DataStock & | obj | ||
) |
Single DataStock can be used:
And multiple DataStock can be combined:
os | a ostream with text data |
Definition at line 936 of file DataStock.cpp.
References DataStock::helper_operator_write(), and DataStock::helper_operator_write_base().
std::string& operator<< | ( | std::string & | line_csv, |
const DataStock & | obj | ||
) |
Call the standard friend operator>>
Single and multiple DataStock can be used:
line_csv | string containing the text data to read |
Definition at line 990 of file DataStock.cpp.
bool operator== | ( | const SimpleData & | lhs, |
const SimpleData & | rhs | ||
) |
Definition at line 910 of file DataStock.cpp.
References DataStock::date, and SimpleData::value.
Definition at line 916 of file DataStock.cpp.
References DataStock::date, and MultiData::values.
Definition at line 922 of file DataStock.cpp.
References DataCSV::close, DataStock::date, DataCSV::high, DataCSV::low, and DataCSV::open.
std::iostream& operator>> | ( | std::iostream & | ios, |
DataStock & | obj | ||
) |
Single DataStock can be used:
And multiple DataStock can be combined:
Normal state of the stream after reading:
Test:
Test than the input was read correctly:
ios | a iostream with the data |
obj | the DataStock object to set |
Definition at line 948 of file DataStock.cpp.
References BDS::BUFFER_STREAM, DataStock::helper_operator_read(), DataStock::helper_operator_read_base(), and reconstruct_stream_operator().
std::string& operator>> | ( | std::string & | line_csv, |
DataStock & | obj | ||
) |
If the processing is correct the input string should be empty after the execution
line_csv | string to fill with text data |
obj | DataStock object to set |
Definition at line 999 of file DataStock.cpp.
size_t reconstruct_stream_operator | ( | std::iostream & | is, |
char * | buf_to_ret | ||
) |
Reconstruct a stream in skipping the values already consumed
This is used by friend operator>> ( iostream )
This version use only C-string array, no string or streamstring intermediate.
More efficient.
To call when the istream has already read all the values.
The function will read the resting values, then the date(at the beginning) and
cat all in buf_to_ret (all size defined in namespace FDS
Definition at line 39 of file DataStock.cpp.
References BDS::BUFFER_DATE, and BDS::BUFFER_STREAM.
Referenced by operator>>().