ROOT_Application  2.0
C++ Core modules and GUIStock
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ROOTStock.cxx
Go to the documentation of this file.
1 
9 #include "../src_cpp/StockManager.h"
10 // will include boost
11 #include "../src_cpp/TCPServer.h"
12 #include "GUIMainController.h"
13 
14 //#include "Garbage.h"
15 
16 #include <TRint.h>
17 #include <TROOT.h>
18 #include <TGClient.h>
19 
20 int main(int argc, char **argv)
21 {
22  //TApplication theApp("App",&argc,argv);
23  //TRint lets the interpreter usable ! good
24  //TROOT troot("troot","troot"); // console as well if commented !
25 
26  //if not a pointer, avoid an error with valgrind
27  TRint* theApp = new TRint("app",&argc,argv,0,0,kTRUE);
28  //std::cout << "theApp " << theApp << std::endl;
29 
30  // here could load all Singleton and TALib initialisation
31  //or in a MainController
32  //TAlibAPI::Init();
33  //std::cout << TAlibAPI::GetStatus() << std::endl;
34 
36  //std::cout << "GetStatus StockManager " << fstockmanager->GetStatus() << std::endl;
37  //std::cout << "GetStatus StockManager::Server " << fstockmanager->GetStatusServer() << std::endl;
38 
39  boost::asio::io_service io_service;
40  //fstockmanager->ActivateServer();
41  TCPServer *serv = new TCPServer( fstockmanager, 9998, io_service );
42  fstockmanager->SetServer( serv );
43  // crash boost error, begin test without Server
44  //fstockmanager->GetServer()->RunThreadServer();
45  //fstockmanager->GetServer()->RunServer();
46 
47 #ifdef DEBUG
48  std::cout << "GetStatus StockManager " << fstockmanager->GetStatus() << std::endl;
49  std::cout << "GetStatus StockManager::GetStatusServer " << fstockmanager->GetStatusServer() << std::endl;
50 #endif
51 
52  // not working, even with pointer, crash, to retest
53  // do not crash anymore ??
54  delete theApp;
55  theApp = 0;
56 
57  // delete StockMAnager ? Garbage ? they are static
58  return 0;
59 }
Singleton class, stores all loaded stocks.
Definition: StockManager.h:42
bool GetStatus() const
Indicates if the singleton has been initialized or is still valide.
Definition: StockManager.h:101
void SetServer(TCPServer *tcp)
Definition: StockManager.h:117
static StockManager * getInstance(std::string new_path=".")
Get a singleton instance.
int main(int argc, char **argv)
Definition: ROOTStock.cxx:20
Use with RealTime to receive messages from python ServerPortfolio.
Definition: TCPServer.h:122
std::string GetPathData()
Definition: Utils.cpp:42