Public Member Functions | |
bool | publishBatchedData () override |
bool | shutdown () override |
bool | start () override |
TestBatcher (size_t max_allowable_batch_size=DataBatcher::kDefaultMaxBatchSize, size_t publish_trigger_size=DataBatcher::kDefaultTriggerSize) | |
Public Member Functions inherited from DataBatcher< int > | |
virtual bool | batchData (const int &data_to_batch) |
DataBatcher (size_t max_allowable_batch_size=DataBatcher::kDefaultMaxBatchSize, size_t trigger_size=DataBatcher::kDefaultTriggerSize, std::chrono::microseconds try_enqueue_duration=std::chrono::duration_cast< std::chrono::microseconds >(std::chrono::seconds(2))) | |
size_t | getCurrentBatchSize () |
size_t | getMaxAllowableBatchSize () |
size_t | getTriggerBatchSize () |
std::chrono::microseconds | getTryEnqueueDuration () |
void | resetBatchedData () |
void | resetTriggerBatchSize () |
void | setMaxAllowableBatchSize (int new_value) |
void | setTriggerBatchSize (size_t new_value) |
void | setTryEnqueueDuration (std::chrono::microseconds duration) |
bool | shutdown () override |
~DataBatcher () override=default | |
Public Member Functions inherited from Service | |
ServiceState | getState () |
virtual std::string | getStatusString () |
Service () | |
virtual | ~Service ()=default |
Public Attributes | |
int | pub_called |
Additional Inherited Members | |
Static Public Member Functions inherited from DataBatcher< int > | |
static void | validateConfigurableSizes (size_t batch_max_queue_size, size_t batch_trigger_publish_size) |
Static Public Attributes inherited from DataBatcher< int > | |
static const size_t | kDefaultMaxBatchSize |
static const size_t | kDefaultTriggerSize |
Protected Member Functions inherited from DataBatcher< int > | |
virtual void | emptyCollection () |
Protected Member Functions inherited from Service | |
void | setState (ServiceState new_state) |
Protected Attributes inherited from DataBatcher< int > | |
std::shared_ptr< std::list< int > > | batched_data_ |
std::recursive_mutex | mtx |
Simple extension to test basic functionality
Definition at line 27 of file data_batcher_test.cpp.
|
inlineexplicit |
Definition at line 30 of file data_batcher_test.cpp.
|
inlineoverridevirtual |
When the getTriggerBatchSize is met this method will be called.
Implements DataBatcher< int >.
Definition at line 44 of file data_batcher_test.cpp.
|
inlineoverridevirtual |
Cleanup. Should be called before destruction. The format overriding classes should use is the following:
virtual bool shutdown() { // immediately set the shutdown state bool b = Service::shutdown();
// do specific shutdown logic here
// return the result of Service::shutdown() or something else if desired return b; }
Reimplemented from Service.
Definition at line 39 of file data_batcher_test.cpp.
|
inlineoverridevirtual |
Called to start doing work. The format overriding classes should use is the following:
virtual bool start() { // do specific start logic here
// ensure the service state has been set to started bool b = Service::start();
// return the result of Service::start() or something else if desired return b; }
Reimplemented from Service.
Definition at line 35 of file data_batcher_test.cpp.
int TestBatcher::pub_called |
Definition at line 50 of file data_batcher_test.cpp.