CatapultServer  v0.5.0.1 (Elephant)
DisruptorBarriers.h
Go to the documentation of this file.
1 
21 #pragma once
22 #include "DisruptorBarrier.h"
23 #include <boost/thread.hpp>
24 #include <vector>
25 #include <stdint.h>
26 
27 namespace catapult { namespace disruptor {
28 
31  public:
33  explicit DisruptorBarriers(size_t levelsCount);
34 
35  public:
37  inline size_t size() const {
38  return m_barriers.size();
39  }
40 
42  inline const DisruptorBarrier& operator[](size_t level) const {
43  return *m_barriers[level];
44  }
45 
47  inline DisruptorBarrier& operator[](size_t level) {
48  return *m_barriers[level];
49  }
50 
51  private:
53  std::vector<std::unique_ptr<DisruptorBarrier>> m_barriers;
54  };
55 }}
catapult::disruptor::DisruptorBarriers
Container for disruptor barriers.
Definition: DisruptorBarriers.h:30
exceptions.h
catapult::disruptor::DisruptorBarriers::size
size_t size() const
Returns number of barriers.
Definition: DisruptorBarriers.h:37
catapult::disruptor::DisruptorBarriers::operator[]
DisruptorBarrier & operator[](size_t level)
Returns a barrier at a given level.
Definition: DisruptorBarriers.h:47
DisruptorBarrier.h
catapult::disruptor::DisruptorBarriers::m_barriers
std::vector< std::unique_ptr< DisruptorBarrier > > m_barriers
Holds all barriers (barrier level is an index).
Definition: DisruptorBarriers.h:53
DisruptorBarriers.h
catapult
Definition: AddressExtractionExtension.cpp:28
catapult::disruptor::DisruptorBarriers::operator[]
const DisruptorBarrier & operator[](size_t level) const
Returns a barrier at a given level.
Definition: DisruptorBarriers.h:42
catapult::disruptor::DisruptorBarrier
Definition: DisruptorBarrier.h:32
catapult::disruptor::DisruptorBarriers::DisruptorBarriers
DisruptorBarriers(size_t levelsCount)
Creates levelsCount barriers with consecutive levels.
Definition: DisruptorBarriers.cpp:26