hmbdc
simplify-high-performance-messaging-programming
 All Classes Namespaces Functions Variables Friends Pages
PoolT.hpp
1 #include "hmbdc/Copyright.hpp"
2 #pragma once
3 #include "hmbdc/pattern/PoolConsumer.hpp"
4 #include <stdint.h>
5 #include <memory>
6 #include <vector>
7 
8 namespace hmbdc { namespace pattern {
9 
10 template <typename Buffer = void*>
11 struct PoolT {
12  PoolT(PoolT const&) = delete;
13  PoolT& operator = (PoolT const&) = delete;
14  using ptr = std::shared_ptr<PoolT>;
15  void addConsumer(PoolConsumer&, uint64_t = 0xfffffffffffffffful);
16  uint32_t consumerSize() const;
17  void start(uint16_t, uint64_t = 0, bool = true);
18  void startAll(uint64_t = 0);
19  void startThruRecycling(uint16_t, uint64_t = 0);
20  void startAt(uint16_t, uint64_t, std::vector<uint16_t> const&);
21  void runOnce(uint16_t);
22  void stop();
23  void join();
24  static
25  ptr create(Buffer& lfb, uint32_t maxConsumerSize) {
26  return std::shared_ptr<PoolT>(
27  new PoolT(lfb, maxConsumerSize)
28  );
29  }
30  ~PoolT();
31 
32 private:
33  PoolT(Buffer&, uint32_t);
34  void* impl_;
35 };
36 
37 }}
Definition: PoolConsumer.hpp:13
Definition: PoolT.hpp:11