ROOT_Application
2.0
C++ Core modules and GUIStock
|
All included in the namespace, must be called with Utils:: More...
Data Structures | |
struct | firstlast_dates |
general structure for dates in csv files More... | |
Functions | |
void | SetPathData (std::string new_path) |
forced to use this function now. More... | |
std::string | GetPathData () |
double | fromStreamToDouble (std::iostream &stream, char delim) |
Read the next character of a stream as a double. More... | |
void | splitline (const std::string &str, const std::string &delimiters, std::vector< std::string > &tokens) |
splitline More... | |
time_t | GetTime_tToday () |
Get the time_t of today. More... | |
time_t | StringToTime_t (const std::string &str) |
Return the time_t from a string . More... | |
time_t | StringToTime_t (const char *str) |
Return the time_t from a c-string . More... | |
std::string | Time_tToString (const time_t &time, const bool b_hour=false) |
Return a string representing the date All times are expressed in the localtime. More... | |
void | GetDateYMD (time_t time_unix, int &year, int &month, int &day) |
Set year, month and day given an input time. More... | |
time_t | StringToTime_t_old (std::string str_date) |
static SUPPRESS_NOT_USED_WARN firstlast_dates | get_fldate_default () |
need to be static for using default argument in a function More... | |
template<class T > | |
std::string | toString (const T &t) |
template<class T > | |
T | fromString (const std::string &s) |
Transform string to any type : float, double, int. More... | |
Variables | |
static std::string | PATH_DATA ="/home/michael/workspace_kepler/ROOT_application/data" |
to modify before compilation to set from a Config file More... | |
const std::string | PATH_DATA_TEST ="/home/michael/workspace_kepler/ROOT_application/data_test" |
Important variable to adjust before compilation, should be in a configuration. More... | |
const time_t | ERROR_StrToTime = -105 |
Error code returned by StringToTime_t if the string cannot be parsed correctly Must be a time_t, -1 is the original epoch date, so choose a random number. More... | |
All included in the namespace, must be called with Utils::
Declare PATH_DATA Functions for dealing with Date and Time
double Utils::fromStreamToDouble | ( | std::iostream & | stream, |
char | delim | ||
) |
Read the next character of a stream as a double.
stream | to read |
delim | character will be extracted from the initial position to the delimiter or the end of the stream |
Definition at line 45 of file Utils.cpp.
Referenced by SimpleData::helper_operator_read(), MultiData::helper_operator_read(), and DataCSV::helper_operator_read().
T Utils::fromString | ( | const std::string & | s | ) |
|
static |
need to be static for using default argument in a function
Definition at line 60 of file Utils.h.
References Utils::firstlast_dates::first, and Utils::firstlast_dates::last.
Referenced by ListDataStock< T, PolicyChronologic >::Clear(), Stock::SaveCSV(), Stock::UpdateCSV_Inst(), Stock::UpdateCSVFromFile(), Stock::UpdateCSVFromWeb(), Stock::Updated(), MainControllerIndicatorTHStock::Validation(), and wrapLastCSVUpdate().
void Utils::GetDateYMD | ( | time_t | time_unix, |
int & | year, | ||
int & | month, | ||
int & | day | ||
) |
Set year, month and day given an input time.
If time_unix is 0 the actual date is used
[in] | time_unix | input time |
[out] | year | |
[out] | month | |
[out] | day |
Definition at line 185 of file Utils.cpp.
Referenced by TransDateBox::ProcessMessage(), and TransDateBox::Valid().
std::string Utils::GetPathData | ( | ) |
Definition at line 42 of file Utils.cpp.
References PATH_DATA.
Referenced by GUIMainController::GUIMainController(), main(), Stock::Read_HeaderCSV_static(), Stock::UpdateCSV_Inst(), and MainControllerIndicatorTHStock::Validation().
time_t Utils::GetTime_tToday | ( | ) |
Get the time_t of today.
Definition at line 74 of file Utils.cpp.
Referenced by TransDateBox::ProcessMessage().
void Utils::SetPathData | ( | std::string | new_path | ) |
forced to use this function now.
dangerous to change during execution of a program, done for unit-test
Definition at line 37 of file Utils.cpp.
References PATH_DATA.
Referenced by wrap_SaveInst(), wrapLastCSVUpdate(), and wrapUpdateCSV().
void Utils::splitline | ( | const std::string & | str, |
const std::string & | delimiters, | ||
std::vector< std::string > & | tokens | ||
) |
splitline
Definition at line 56 of file Utils.cpp.
Referenced by CanvasStock::AddListDataStockToMap(), Indicator::GetIndicator(), FullName::GetIndicator(), ShortName::GetIndicator(), FullName::GetNameStock(), FrameName::GetNameStock(), FullName::GetParams(), FullName::GetTimeScale(), FrameName::GetTimeScale(), Stock::ReadCSV(), Stock::ReadLineHeader(), and StockManager::SendDatadCSV().
time_t Utils::StringToTime_t | ( | const std::string & | str | ) |
Return the time_t from a string
.
All times are expressed in the localtime
Format can be:
str | string representing the date |
Definition at line 93 of file Utils.cpp.
References ERROR_StrToTime.
Referenced by SimpleData::ExtractCSVLine(), MultiData::ExtractCSVLine(), DataCSV::ExtractCSVLine(), DataStock::helper_operator_read_base(), Stock::ReadCSV(), Stock::ReadLineHeader(), and StockManager::SendDatadCSV().
time_t Utils::StringToTime_t | ( | const char * | str | ) |
Return the time_t from a c-string
.
str | string representing the date |
Definition at line 125 of file Utils.cpp.
References ERROR_StrToTime.
std::string Utils::Time_tToString | ( | const time_t & | time, |
const bool | b_hour = false |
||
) |
Return a string representing the date
All times are expressed in the localtime.
time | input |
b_hour | optional includes the hour in the string |
Definition at line 157 of file Utils.cpp.
Referenced by ListDataStock< T, PolicyChronologic >::AddToList(), THStock::GetDateFromBin(), DataStock::GetDateString(), ObjectLine::GetValues(), Stock::LoadListData(), CandleStock::MakeStringForStatusBar(), BarStock::MakeStringForStatusBar(), PStockLine::MakeStringForStatusBar(), ObjectLineIndicator::MakeStringForStatusBar(), ObjectLineTendance::MakeStringForStatusBar(), ListDataStock< T, PolicyChronologic >::PrintData(), Stock::ReadCSV(), Stock::ReadLineHeader(), Stock::UpdateCSVFromFile(), Stock::UpdateCSVFromWeb(), TransDateBox::Valid(), and Stock::WriteLineHeader().
std::string Utils::toString | ( | const T & | t | ) |
Definition at line 69 of file Utils.h.
Referenced by Stock::ComputeTA(), MainIndicatorTHStockFrame::EventInfo(), FileReadError::FileReadError(), and ObjectLineTendance::MakeStringForStatusBar().
const time_t Utils::ERROR_StrToTime = -105 |
Error code returned by StringToTime_t if the string cannot be parsed correctly
Must be a time_t, -1 is the original epoch date, so choose a random number.
Definition at line 51 of file Utils.h.
Referenced by DataStock::helper_operator_read_base(), Stock::ReadLineHeader(), StockManager::SendDatadCSV(), and StringToTime_t().
|
static |
to modify before compilation to set from a Config file
Definition at line 30 of file Utils.cpp.
Referenced by GetPathData(), and SetPathData().
const std::string Utils::PATH_DATA_TEST ="/home/michael/workspace_kepler/ROOT_application/data_test" |
Important variable to adjust before compilation, should be in a configuration.
Definition at line 38 of file Utils.h.
Referenced by wrap_SaveInst(), wrapLastCSVUpdate(), and wrapUpdateCSV().