FACT++  1.0
template<class T , class S >
int RunShell ( Configuration conf)

Definition at line 473 of file dclient5.cc.

References Configuration::Get(), Configuration::GetName(), Configuration::Has(), kRed, WindowLog::OpenLogFile(), StateMachineAsio< T >::Stop(), and t.

474 {
475  static T shell(conf.GetName().c_str(), conf.Get<int>("console")!=1);
476 
477  WindowLog &win = shell.GetStreamIn();
478  WindowLog &wout = shell.GetStreamOut();
479 
480  if (conf.Has("log"))
481  if (!wout.OpenLogFile(conf.Get<string>("log")))
482  win << kRed << "ERROR - Couldn't open log-file " << conf.Get<string>("log") << ": " << strerror(errno) << endl;
483 
484  StateMachineFAD<S> io_service("DATA_LOGGER", wout);
485  shell.SetReceiver(io_service);
486 
487  boost::thread t(boost::bind(&StateMachineFAD<S>::Run, &io_service));
488 
489  //io_service.SetReady();
490 
491  shell.Run(); // Run the shell
492  io_service.Stop(); // Signal Loop-thread to stop
493  // io_service.Close(); // Obsolete, done by the destructor
494  // wout << "join: " << t.timed_join(boost::posix_time::milliseconds(0)) << endl;
495 
496  // Wait until the StateMachine has finished its thread
497  // before returning and destroying the dim objects which might
498  // still be in use.
499  t.join();
500 
501  return 0;
502 }
A C++ ostream to an ncurses window supporting attributes and colors.
Definition: WindowLog.h:50
T Get(const std::string &var)
Set color Red.
Definition: WindowLog.h:17
bool Has(const std::string &var)
TT t
Definition: test_client.c:26
bool OpenLogFile(const std::string &filename, bool append=false)
Open a log-file.
Definition: WindowLog.cc:111
const std::string & GetName() const

+ Here is the call graph for this function: