ROOT_Application  2.0
C++ Core modules and GUIStock
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ControllerIndicatorTHStock.h
Go to the documentation of this file.
1 
17 #ifndef _CONTROLLERINDICATORTHSTOCK_H_
18 #define _CONTROLLERINDICATORTHSTOCK_H_
19 
20 #include <iostream>
21 
22 #include "Controller.h"
23 #include "../../utils/Indicator.h"
24 
25 // FullName more general
26 #include "../../utils/TimeScale.h"
27 //#include "../../utils/FullName.h"
28 
29 class IndicatorFrame;
30 class THStockFrame;
31 // new added
32 class TGCompositeFrame;
33 
34 // only needed for GetStockManager ??
36 
49 {
50  private :
52  typedef std::list<std::string>::iterator it_list;
53  typedef std::list<std::string>::const_iterator it_clist;
54  typedef std::vector< std::list<std::string> >::iterator it_vec;
55  typedef std::vector< std::list<std::string> >::const_iterator it_cvec;
56 
63 
65  // really needed
67 
72  std::vector< std::list<std::string> > vec_name_data;
73 
74  // internal function to access/set this new vec_name_data
75  //it_vec GetItVector( unsigned int nb_pad );
76 
78  bool IsPresent( std::string fullname, unsigned int i ) const;
80  std::list<std::string> * GetList( unsigned int nb_pad );
81 
82  // take out nb_pad and Indicator needed only if CAC & DJ
85  bool NeedToUpdate( std::string stockname, ETime tmscl ) const;
86 
91  int AddDataToVecNameData( std::string fullname, unsigned int nb_pad = 0 );
92 
93  unsigned int GetPadNumber( std::string fullname ) const;
94 
95  public :
96  // specify exactly the type of the parent controller, use generic frame (in practive fVframe)
97  ControllerIndicatorTHStock( MainControllerIndicatorTHStock *parent, TGCompositeFrame *mother_frame_indic,
98  TGCompositeFrame *mother_frame_thstock, std::string frame_name );
99  virtual ~ControllerIndicatorTHStock(); // {std::cout << "Destructor ControllerIndicatorTHStock" << std::endl;}
100 
102  void SetIndicatorFrame ( IndicatorFrame *findic ) {findic_frame = findic;}
104  void SetTHStockFrame ( THStockFrame *fthstock ) {fthstock_frame = fthstock;}
105 
106  //StockManager * GetStockManager() const { return GetParentController->GetStockManager(); }
107 
109  void AddData( std::string fullname );
110 
111  // compile but signal never comes ? cannot use slot if not ROOT and Dictionnary ? Boost signal to use instead ?
112  // keep for later test, try with pointer in THStockFrame
113  //void GetSignalSelected( TVirtualPad*,TObject*,Int_t );
114  // simpler call by the frame
115  void GetSelected( int pad_number );
116 
117  // function called by frames to controller, use pointer but boost::signal maybe an option ??
118  //void UpdateIndicator( std::string mode, std::string fullname, unsigned int nb_pad);
119  // try to delete nb_pad input ?? now want to use npad because stored here
120  void UpdateIndicator( std::string mode, std::string fullname );
121 
122  //void ModifyColorIndic( std::string fullname, unsigned int nb_pad, unsigned long color );
123  void ModifyColorIndic( std::string fullname, unsigned long color );
124 
125  // just for information for debugging
126  void PrintVector();
127 
129 
130  void UpdateFrames();
131 
133 
134  virtual void Updated( std::vector<std::string> & message );
135 };
136 
137 #endif /* _CONTROLLERINDICATORTHSTOCK_H_ */
IndicatorFrame * findic_frame
pointer to the frame and indicator.
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).
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.
std::list< std::string >::iterator it_list
define iterator and const iterator for loop
Final controller class, does not derive from ListController.
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.
std::vector< std::list< std::string > >::iterator it_vec
void SetTHStockFrame(THStockFrame *fthstock)
void SetIndicatorFrame(IndicatorFrame *findic)
Contains an EmbeddedCanvas and a CanvasStock.
Definition: THStockFrame.h:46
ETime
Enumeration for the different time representation, from instantaneous (INST) to year(YEAR) ...
Definition: TimeScale.h:48
std::vector< std::list< std::string > > vec_name_data
add a list of loaded data, use only name ( 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...
Show all data loaded in memory, allow to deal with Button.
Base class for controllers of the graphical application.
unsigned int GetPadNumber(std::string fullname) const
want the index of the vector containing the corresponding fullname, i.e.
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 ?
std::vector< std::list< std::string > >::const_iterator it_cvec
virtual void Updated(std::vector< std::string > &message)
receive an update from observer pattern, from StockManager
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
Definition: Controller.h:209
void PrintVector()
Print the Content of the vector vec_name_data, for debugging.
THStockFrame * GetTHStockFrame() const
IndicatorFrame * GetIndicatorFrame() const
THStockFrame * fthstock_frame
pointer to the frame