23 #ifndef ZEROMQAPPLICATIONBASE20110418H 24 #define ZEROMQAPPLICATIONBASE20110418H 26 #include "application_base.h" 27 #include "zeromq_service.h" 29 #include "goby/common/logger.h" 30 #include "goby/common/time.h" 48 boost::posix_time::second_clock::universal_time() + boost::posix_time::seconds(1);
53 virtual void loop() = 0;
76 boost::posix_time::time_duration
loop_period() {
return loop_period_; }
78 long loop_freq() {
return 1000 / loop_period_.total_milliseconds(); }
80 boost::posix_time::ptime
t_start() {
return t_start_; }
92 glog.is(goby::common::logger::DEBUG3) &&
glog <<
"timeout set to: " << timeout
93 <<
" microseconds." << std::endl;
94 bool had_events = zeromq_service_.poll(timeout);
99 t_next_loop_ += loop_period_;
107 boost::posix_time::time_duration loop_period_;
110 boost::posix_time::ptime t_start_;
112 boost::posix_time::ptime t_next_loop_;
void set_loop_period(long milliseconds)
set the interval in milliseconds between calls to loop. Alternative to set_loop_freq().
long loop_freq()
frequency of calls to loop() in Hertz
void set_loop_freq(double hertz)
set the frequency with which loop() is called. Alternative to set_loop_period().
ReturnType goby_time()
Returns current UTC time as a boost::posix_time::ptime.
void set_loop_period(boost::posix_time::time_duration p)
set the interval (with a boost::posix_time::time_duration) between calls to loop. Alternative to set_...
boost::posix_time::time_duration loop_period()
interval between calls to loop()
common::FlexOstream glog
Access the Goby logger through this object.
The global namespace for the Goby project.
boost::posix_time::ptime t_start()