Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
receiver_state.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2020 Roc Streaming authors
3  *
4  * This Source Code Form is subject to the terms of the Mozilla Public
5  * License, v. 2.0. If a copy of the MPL was not distributed with this
6  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
7  */
8 
9 //! @file roc_pipeline/receiver_state.h
10 //! @brief Receiver pipeline state.
11 
12 #ifndef ROC_PIPELINE_RECEIVER_STATE_H_
13 #define ROC_PIPELINE_RECEIVER_STATE_H_
14 
15 #include "roc_core/atomic.h"
16 #include "roc_core/noncopyable.h"
17 #include "roc_core/stddefs.h"
18 
19 namespace roc {
20 namespace pipeline {
21 
22 //! Receiver pipeline state.
23 //! Thread-safe.
24 class ReceiverState : public core::NonCopyable<> {
25 public:
26  //! Initialize.
28 
29  //! Check whether pending packets counter is non-zero.
30  bool has_pending_packets() const;
31 
32  //! Add given number to pending packets counter.
33  void add_pending_packets(int increment);
34 
35  //! Get sessions counter.
36  size_t num_sessions() const;
37 
38  //! Add given number to sessions counter.
39  void add_sessions(int increment);
40 
41 private:
42  core::Atomic<int> pending_packets_;
43  core::Atomic<int> sessions_;
44 };
45 
46 } // namespace pipeline
47 } // namespace roc
48 
49 #endif // ROC_PIPELINE_RECEIVER_STATE_H_
Atomic.
Base class for non-copyable objects.
Definition: noncopyable.h:23
Receiver pipeline state. Thread-safe.
bool has_pending_packets() const
Check whether pending packets counter is non-zero.
void add_pending_packets(int increment)
Add given number to pending packets counter.
void add_sessions(int increment)
Add given number to sessions counter.
size_t num_sessions() const
Get sessions counter.
Root namespace.
Non-copyable object.
Commonly used types and functions.