10 #include "../View/IndicatorFrame.h" 
   11 #include "../View/THStockFrame.h" 
   13 #include "../../src_cpp/StockManager.h" 
   24 #include "../View/MainIndicatorTHStockFrame.h" 
   30                 TGCompositeFrame *mother_frame_indic, TGCompositeFrame *mother_frame_thstock, std::string frame_name ) :
 
   42                 std::cout << 
"\n\tError in creation of IndicatorFrame" << std::endl;
 
   44     mother_frame_indic->AddFrame(
findic_frame, 
new TGLayoutHints( kLHintsExpandX, 2,2,2,2 ));
 
   52                 std::cout << 
"Error in creation of THStockFrame" << std::endl;
 
   54     mother_frame_thstock->AddFrame( 
fthstock_frame, 
new TGLayoutHints( kLHintsExpandX | kLHintsExpandY, 2,2,2,2 ) );
 
   59                 parent->
GetFrame(), 
"EventInfo(Int_t,Int_t,Int_t,TObject*)");
 
   61 #ifdef DEBUG_CONT_FRAME 
   62         std::cout << 
"\n\tConstructor ControllerIndicatorTHStock with name " << 
GetName() << std::endl;
 
   63         std::cout << 
"this " << 
this << std::endl;
 
   71 #ifdef DEBUG_CONT_FRAME 
   72         std::cout << 
"Destructor ControllerIndicatorTHStock" << std::endl;
 
   90                 if ( (*it) == fullname )
 
   98 #ifdef DEBUG_CONT_FRAME 
   99         std::cout << 
"Entry ControllerIndicatorTHStock::GetList nb_pad " << nb_pad << std::endl;
 
  101         std::list<std::string> new_list;
 
  105 #ifdef DEBUG_CONT_FRAME 
  106                 std::cout << 
" Add a new list " << nb_pad << std::endl;
 
  107                 std::cout << 
" size of the vector " << 
vec_name_data.size() << std::endl;
 
  108                 std::cout << 
"create a new list " << std::endl;
 
  115                         std::cout <<  
"Error in creation of the new list " << std::endl;
 
  126 #ifdef DEBUG_CONT_FRAME 
  128    std::cout << 
"ControllerIndicatorTHStock::NeedToUpdate " << std::endl;
 
  130    std::cout << 
"name controller " << GetName() << std::endl;
 
  131    std::cout << 
"name THStockFrame " << GetTHStockFrame()->GetName() << std::endl;
 
  137         std::string namestock_list;
 
  140 #ifdef DEBUG_CONT_FRAME 
  141    std::cout << 
"namestock_list " << namestock_list << std::endl;
 
  152         if ( stockname == namestock_list ) {
 
  153             std::cout << 
" namestock identical return true " << std::endl;
 
  183     std::cout << 
" return false " << std::endl;
 
  190 #ifdef DEBUG_CONT_FRAME 
  191         std::cout << 
"Entry AddDataToVecNameData fullname " << fullname << 
" nb_pad " << nb_pad << std::endl;
 
  192         std::cout << 
" size vector " << 
vec_name_data.size() << std::endl;
 
  198         std::list<std::string>  * list;
 
  206         list->push_back( fullname );
 
  215 #ifdef DEBUG_CONT_FRAME 
  216         std::cout << 
"Entry ControllerIndicatorTHStock::GetPadNumber " << std::endl;
 
  217         std::cout << 
"parameter fullname: " << fullname << std::endl;
 
  232 #ifdef DEBUG_CONT_FRAME 
  233         std::cout << 
"\n\t Entry ControllerIndicatorTHStock::AddData fullname " << fullname << std::endl;
 
  234         std::cout << 
" this->GetName() " << 
GetName() << std::endl;
 
  248         std::cout << 
"get fstock " << fstock << std::endl;
 
  256                 std::cout << 
"Got Exception e.what: " << e.
what() << std::endl;
 
  258 #ifdef DEBUG_CONT_FRAME 
  259         std::cout << 
"After GetListData " << ldata << std::endl;
 
  260         std::cout << 
"After GetListData GetName() " << ldata->
GetName() << std::endl;
 
  261         std::cout << 
"GetSize " << ldata->
GetSize() << std::endl;
 
  272         std::vector<std::string> descp;
 
  275         if ( descp[0][0] == 
'P' ) {
 
  276                 std::cout << 
"Get description indicator PStokline" << std::endl;
 
  277                 std::cout << 
"descp[0][2]" << descp[0][2] << std::endl;
 
  283 #ifdef DEBUG_CONT_FRAME 
  284         std::cout << 
"return AddListDataStockToMap nb_pad_printed " << nb_pad_printed << std::endl;
 
  292 #ifdef DEBUG_CONT_FRAME 
  299 #ifdef DEBUG_CONT_FRAME 
  300         std::cout << 
"End ControllerIndicatorTHStock::AddData fullname " << fullname << std::endl;
 
  309 #ifdef DEBUG_CONT_FRAME 
  310     std::cout << 
"\n\tEntry ControllerIndicatorTHStock::GetSelected pad_number " << pad_number << std::endl;
 
  311     std::cout << 
"this " << 
this << std::endl;
 
  363     bool update_cs = 
true;
 
  367 #ifdef DEBUG_CONT_FRAME 
  368     std::cout << 
"ControllerIndicatorTHStock::UpdateIndicator " << std::endl;
 
  370     std::cout << 
" mode " << mode << 
" fullname " << fullname << std::endl;
 
  371     std::cout << 
"CanvasStock name " << cs->GetName() << std::endl;
 
  372     std::cout << 
"frame_name " << frame_name << std::endl; 
 
  373     std::cout << 
"GetPadNumber from controller " << nb_pad << std::endl;
 
  379     if ( mode == 
"HIDE" ) {
 
  380 #ifdef DEBUG_CONT_FRAME 
  381         std::cout << 
"mode HIDE " << std::endl;
 
  387     else if (mode == 
"DELETE" ) {
 
  401     else if ( ( mode == 
"DELETE_ALL" ) || ( mode == 
"HIDE_ALL" ) ) {
 
  402         std::cout << 
"In Update mode DELETE_ALL or HIDE_ALL frame_name " << frame_name << std::endl;
 
  411     else if ( mode == 
"SHOW" ) {
 
  412 #ifdef DEBUG_CONT_FRAME 
  413           std::cout << 
"\t\nIn Update mode SHOW " <<  std::endl;
 
  419     else if ( mode == 
"SHOW_ALL" ) {
 
  420 #ifdef DEBUG_CONT_FRAME 
  421           std::cout << 
"\t\nIn Update mode SHOW_ALL " <<  std::endl;
 
  428 #ifdef DEBUG_CONT_FRAME 
  429         std::cout << 
"Will update cs " << std::endl;
 
  438 #ifdef DEBUG_CONT_FRAME 
  440     std::cout << 
"Entry ControllerIndicatorTHStock::ModifyColorIndic fullname " << fullname << std::endl;
 
  457         std::cout << 
"\n\t ControllerIndicatorTHStock::Entry PrintVector " << std::endl;
 
  459                 std::cout << 
"element " << i << std::endl;
 
  461                         std::cout << (*it) << 
" ";
 
  463                 std::cout << 
" " << std::endl;
 
  465         std::cout << 
" " << std::endl;
 
  470 #ifdef DEBUG_CONT_FRAME 
  471         std::cout << 
"Entry ControllerIndicatorTHStock::Updated " << std::endl;
 
  472         std::cout << 
"message[0] " << message[0] << std::endl;
 
  473         std::cout << 
"message[1] " << message[1] << std::endl;
 
  476         std::string namestock;
 
  484         if ( message[0] == 
"update_dcsv" ) {
 
  487                 namestock = message[1];
 
  491                 std::cout << 
"need to check if present in the list " << std::endl;
 
  504 #ifdef DEBUG_CONT_FRAME 
  506                         std::cout << 
"did not find anything to update in this Controller, name Controller " << 
GetName() << std::endl;
 
  510                 std::cout << 
"Message not known message[0]" << message[0] << std::endl;
 
  518 #ifdef DEBUG_CONT_FRAME 
  519     std::cout << 
"\n\t ControllerIndicatorTHStock::UpdateFrames " << std::endl;
 
virtual ~ControllerIndicatorTHStock()
 
Singleton class, stores all loaded stocks. 
 
void SetColor(UInt_t npad, std::string fullname, unsigned long color)
new version with fname, really Needed ?? GetPad ( nb_pad ) from Controller not so good...
 
Owns a vector of THStock. 
 
IndicatorFrame * findic_frame
pointer to the frame and indicator. 
 
void GetSelected(int pad_number)
 
std::vector< std::string > parse_description() const 
Utility function to parse the description. 
 
void ModifyColorIndic(std::string fullname, unsigned long color)
 
void UpdateIndicator(std::string mode, std::string fullname)
UpdateIndicator, call by IndicatorFrame. 
 
Controller for a dual frame containing Indicator+THStock(s). 
 
"Clever" enumeration of the ListDataStock type : StockCSV, Volume, EMA, BOLL,... 
 
virtual const char * what() const noexcept
 
bool NeedToUpdate(std::string stockname, ETime tmscl) const 
check if the size of ldata and object match, or if need an update. 
 
std::list< std::string > * GetList(unsigned int nb_pad)
return the list of name of the pad number nb_pad. 
 
virtual void PrintData(const unsigned int verbose=0) const =0
Nice formatting output on console. 
 
std::list< std::string >::iterator it_list
define iterator and const iterator for loop 
 
ControllerIndicatorTHStock(MainControllerIndicatorTHStock *parent, TGCompositeFrame *mother_frame_indic, TGCompositeFrame *mother_frame_thstock, std::string frame_name)
 
int AddDataToVecNameData(std::string fullname, unsigned int nb_pad=0)
add the name of the new data in the pad nb_pad. 
 
Base Exception for Stock and StockManager, all src_cpp code. 
 
static StockManager * getInstance(std::string new_path=".")
Get a singleton instance. 
 
std::string GetNameStock(const std::string &fname)
Extract the name of the stock. 
 
ListDataStockBase * GetListData(const std::string &fullname) const 
Retrieve an instance of a ListDataStock. 
 
CanvasStock * GetECanvas()
General function, for tests but may be kept later. 
 
MainIndicatorTHStockFrame * GetFrame() const 
 
Sub-controller : assure drawing and coupling of 1 IndicatorFrame and 1 THStock. 
 
static Indicator GetIndicator(const std::string &str_name)
Constructor with a string label. 
 
StockManager * GetStockManager() const 
 
static EColor MakeColor(const char str_color)
translate name to integer color in root 
 
int MakeColor(const char str_color)
 
Int_t AddListDataStockToMap(ListDataStockBase *, Int_t npad=0)
Add a ListDataStock, decide if new pad is created Add a pointeur to the new ListDataStock now decides...
 
Contains an EmbeddedCanvas and a CanvasStock. 
 
ETime
Enumeration for the different time representation, from instantaneous (INST) to year(YEAR) ...
 
std::string GetName() const 
 
std::vector< std::list< std::string > > vec_name_data
add a list of loaded data, use only name ( fullname ). 
 
std::string GetFrameName(const std::string &fname)
Extract NameStock_Timescale (FrameName) from a fullname. 
 
MainControllerIndicatorTHStock * myparent_controller
before base was working, test if explicit, seems necessary depending on the function called ...
 
void AddData(std::string fullname)
Used when a new ListData is added, need SM access here, or in parent... 
 
ControllerBase * GetParentController()
 
Show all data loaded in memory, allow to deal with Button. 
 
void SetController(ControllerIndicatorTHStock *controller)
 
void UpdateIndicator(ControllerIndicatorTHStock *child_controller, std::string mode)
called by controller child for some tasks child cannot do. 
 
void SetController(ControllerIndicatorTHStock *controller)
 
virtual unsigned int GetSize() const =0
Return the size of the vector. 
 
std::string GetName() const 
 
unsigned int GetPadNumber(std::string fullname) const 
want the index of the vector containing the corresponding fullname, i.e. 
 
Abstract base class for the ListDataStock, for storing base pointers in vectors. 
 
std::list< std::string >::const_iterator it_clist
 
bool IsPresent(std::string fullname, unsigned int i) const 
check if fullname is present in the pad number i 
 
void UpdateFrames()
keep only for updating THStockFrame for the moment, how done by Indicator ? 
 
virtual void Updated(std::vector< std::string > &message)
receive an update from observer pattern, from StockManager 
 
void HideListData(std::string fullname, Int_t npad, bool toDelete=false)
Used for showing listdatastock indicator. 
 
see remark below, much easier if composition than derivation in the case of ListController, same for parent_controller as member <U> easily extends to View as well ( ListView possible ), but strong coupling again 
 
void PrintVector()
Print the Content of the vector vec_name_data, for debugging. 
 
THStockFrame * GetTHStockFrame() const 
 
void DeleteListData(const std::string &fname)
Delete a specific ListDataStcok, just wrappers to Stock. 
 
void AddIndicator(std::string, int color)
Add an indicator , call MakeLineLabel now should be called by ControllerIndicatorTHStockFrame. 
 
void UpdateTHStock()
to redefine 
 
THStockFrame * fthstock_frame
pointer to the frame 
 
void ShowListData(std::string fullname, Int_t npad)
Used for Hide and Delete, with option.