362c1f4c3b5ce9e3fce11167a51fbe4cdb2174de
Stefan Schuermans implement frame rate limiter

Stefan Schuermans authored 10 years ago

src/noarch/RateLimiter.cpp   1) /* Blinker
Stefan Schuermans update copyright header

Stefan Schuermans authored 5 years ago

src/common/RateLimiter.cpp   2)    Copyright 2011-2019 Stefan Schuermans <stefan@blinkenarea.org>
Stefan Schuermans implement frame rate limiter

Stefan Schuermans authored 10 years ago

src/noarch/RateLimiter.cpp   3)    Copyleft GNU public license - http://www.gnu.org/copyleft/gpl.html
src/noarch/RateLimiter.cpp   4)    a blinkenarea.org project */
src/noarch/RateLimiter.cpp   5) 
src/noarch/RateLimiter.cpp   6) #include <stdlib.h>
src/noarch/RateLimiter.cpp   7) #include <string>
src/noarch/RateLimiter.cpp   8) 
src/noarch/RateLimiter.cpp   9) #include <BlinkenLib/BlinkenFrame.h>
src/noarch/RateLimiter.cpp  10) 
src/noarch/RateLimiter.cpp  11) #include "Directory.h"
src/noarch/RateLimiter.cpp  12) #include "File.h"
src/noarch/RateLimiter.cpp  13) #include "InStreamFile.h"
src/noarch/RateLimiter.cpp  14) #include "Mgrs.h"
src/noarch/RateLimiter.cpp  15) #include "Module.h"
src/noarch/RateLimiter.cpp  16) #include "OutStreamFile.h"
src/noarch/RateLimiter.cpp  17) #include "RateFile.h"
src/noarch/RateLimiter.cpp  18) #include "RateLimiter.h"
src/noarch/RateLimiter.cpp  19) #include "StreamRecv.h"
src/noarch/RateLimiter.cpp  20) #include "Time.h"
src/noarch/RateLimiter.cpp  21) 
src/noarch/RateLimiter.cpp  22) namespace Blinker {
src/noarch/RateLimiter.cpp  23) 
src/noarch/RateLimiter.cpp  24) /**
src/noarch/RateLimiter.cpp  25)  * @brief constructor
src/noarch/RateLimiter.cpp  26)  * @param[in] name module name
src/noarch/RateLimiter.cpp  27)  * @param[in] mgrs managers
src/noarch/RateLimiter.cpp  28)  * @param[in] dirBase base directory
src/noarch/RateLimiter.cpp  29)  */
src/noarch/RateLimiter.cpp  30) RateLimiter::RateLimiter(const std::string &name, Mgrs &mgrs,
src/noarch/RateLimiter.cpp  31)                          const Directory &dirBase):
src/noarch/RateLimiter.cpp  32)   Module(name, mgrs, dirBase),
src/noarch/RateLimiter.cpp  33)   m_fileInStream(dirBase.getFile("instream"), mgrs.m_streamMgr),
src/noarch/RateLimiter.cpp  34)   m_fileMaxRate(dirBase.getFile("maxrate")),
src/noarch/RateLimiter.cpp  35)   m_fileOutStream(dirBase.getFile("outstream"), mgrs.m_streamMgr),
src/noarch/RateLimiter.cpp  36)   m_last(Time::now() - Time(1))
src/noarch/RateLimiter.cpp  37) {
src/noarch/RateLimiter.cpp  38)   // set up
src/noarch/RateLimiter.cpp  39)   getMaxRate();
src/noarch/RateLimiter.cpp  40)   m_fileInStream.setStreamRecv(this);
src/noarch/RateLimiter.cpp  41) }
src/noarch/RateLimiter.cpp  42) 
src/noarch/RateLimiter.cpp  43) /// virtual destructor
src/noarch/RateLimiter.cpp  44) RateLimiter::~RateLimiter()
src/noarch/RateLimiter.cpp  45) {
src/noarch/RateLimiter.cpp  46)   // clean up
src/noarch/RateLimiter.cpp  47)   m_fileInStream.setStreamRecv(NULL);
src/noarch/RateLimiter.cpp  48) }
src/noarch/RateLimiter.cpp  49) 
src/noarch/RateLimiter.cpp  50) /// check for update of configuration
src/noarch/RateLimiter.cpp  51) void RateLimiter::updateConfig()
src/noarch/RateLimiter.cpp  52) {
Stefan Schuermans whitespace and comment fixes

Stefan Schuermans authored 10 years ago

src/common/RateLimiter.cpp  53)   // stream name or frame rate file was modified -> re-get stream or frame rate