1 #ifndef CPPGRAM_POLLING_HPP 2 #define CPPGRAM_POLLING_HPP 4 #include "concurrentqueue/blockingconcurrentqueue.h" 5 #include "cppgram/basic_bot.hpp" 25 uint_fast8_t threads_number,
26 uint_fast32_t limit = 100,
27 uint_fast32_t timeout = 60 );
37 Polling( std::vector<T>
bots, uint_fast32_t limit = 100, uint_fast32_t timeout = 60 );
55 void runMultithread();
61 void runSinglethread();
67 void setThreadAffinity( std::vector<std::thread> &threads );
76 void loopBot( T bot );
108 uint_fast32_t timeout;
112 #include "polling_impl.hpp" std::shared_ptr< spdlog::logger > console_stdout
Logger that will print messages to the console.
Definition: polling.hpp:94
moodycamel::BlockingConcurrentQueue< types::Update > updates_queue
Queue of the updates to process.
Definition: polling.hpp:88
void init()
Init logger for each bot.
Definition: polling_impl.hpp:161
uint_fast32_t firstUpdateID(T &poller)
Get the offset of the first update to process.
Definition: polling_impl.hpp:151
std::vector< T > bots
Vector of bots.
Definition: polling.hpp:85
Polling(T bot, uint_fast8_t threads_number, uint_fast32_t limit=100, uint_fast32_t timeout=60)
Create a polling object by passing a single bot, and the number of threads.
Definition: polling_impl.hpp:6
main namespace for Cppgram
std::shared_ptr< spdlog::logger > console_stderr
Logger that will print error messages to the console.
Definition: polling.hpp:91
void run()
Start the polling.
Definition: polling_impl.hpp:30
Handle long (or short) polling for a bot.
Definition: polling.hpp:12