MuseScore
3.4
Music composition and notation
Main Page
Related Pages
+
Namespaces
Namespace List
+
Namespace Members
+
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
+
Functions
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
y
+
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
x
+
Typedefs
b
c
d
e
f
g
h
i
j
l
m
n
o
p
s
t
v
+
Enumerations
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
+
Enumerator
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
+
Classes
Class List
Class Index
Class Hierarchy
+
Class Members
+
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
+
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
+
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Typedefs
+
Enumerations
a
c
d
e
f
g
h
l
m
o
p
r
s
t
v
x
+
Enumerator
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
v
z
+
Properties
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
z
+
Related Functions
a
b
c
f
i
l
m
o
p
q
r
s
t
v
z
+
Files
File List
+
File Members
+
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
+
Functions
a
c
d
e
g
i
l
m
o
q
r
u
Variables
Typedefs
Enumerations
+
Enumerator
a
c
d
e
f
h
m
n
r
s
t
w
+
Macros
_
a
b
c
d
f
g
h
k
l
m
n
o
p
q
r
s
t
u
v
x
y
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Pages
libmscore
fifo.h
Go to the documentation of this file.
1
//=============================================================================
2
// MuseScore
3
// Music Composition & Notation
4
//
5
// Copyright (C) 2002-2011 Werner Schweer
6
//
7
// This program is free software; you can redistribute it and/or modify
8
// it under the terms of the GNU General Public License version 2
9
// as published by the Free Software Foundation and appearing in
10
// the file LICENCE.GPL
11
//=============================================================================
12
13
#ifndef __FIFO_H__
14
#define __FIFO_H__
15
16
#include <atomic>
17
18
namespace
Ms
{
19
20
//---------------------------------------------------------
21
// FifoBase
22
// - works only for one reader/writer
23
// - reader writes ridx
24
// - writer writes widx
25
// - reader decrements counter
26
// - writer increments counter
27
// - counter increment/decrement must be atomic
28
//---------------------------------------------------------
29
30
class
FifoBase
{
31
32
protected
:
33
int
ridx
;
// read index
34
int
widx
;
// write index
35
std::atomic<int>
counter
;
// objects in fifo
36
int
maxCount
;
37
38
void
push
();
39
void
pop
();
40
41
public
:
42
FifoBase
() {
clear
(); }
43
virtual
~FifoBase
() {}
44
void
clear
();
45
int
count
()
const
{
return
counter
; }
46
bool
empty
()
const
{
return
counter == 0; }
47
bool
isFull
()
const
{
return
maxCount ==
counter
; }
48
};
49
50
51
}
// namespace Ms
52
#endif
53
Ms::FifoBase
Definition:
fifo.h:30
Ms::FifoBase::maxCount
int maxCount
Definition:
fifo.h:36
Ms::FifoBase::FifoBase
FifoBase()
Definition:
fifo.h:42
Ms::FifoBase::clear
void clear()
Definition:
fifo.cpp:21
Ms::FifoBase::count
int count() const
Definition:
fifo.h:45
Ms::FifoBase::isFull
bool isFull() const
Definition:
fifo.h:47
Ms::FifoBase::empty
bool empty() const
Definition:
fifo.h:46
Ms::FifoBase::pop
void pop()
Definition:
fifo.cpp:43
Ms::FifoBase::~FifoBase
virtual ~FifoBase()
Definition:
fifo.h:43
Ms::FifoBase::push
void push()
Definition:
fifo.cpp:32
Ms
Definition:
aeolus.cpp:26
Ms::FifoBase::ridx
int ridx
Definition:
fifo.h:33
Ms::FifoBase::counter
std::atomic< int > counter
Definition:
fifo.h:35
Ms::FifoBase::widx
int widx
Definition:
fifo.h:34
Generated by
1.8.13