MPD  0.20.18
Public Member Functions
MusicPipe Class Reference

A queue of MusicChunk objects. More...

#include <MusicPipe.hxx>

Public Member Functions

 MusicPipe ()=default
 Creates a new MusicPipe object. More...
 
 MusicPipe (const MusicPipe &)=delete
 
 ~MusicPipe ()
 Frees the object. More...
 
MusicPipe & operator= (const MusicPipe &)=delete
 
gcc_pure bool CheckFormat (AudioFormat other) const noexcept
 Checks if the audio format if the chunk is equal to the specified audio_format. More...
 
gcc_pure bool Contains (const MusicChunk *chunk) const noexcept
 Checks if the specified chunk is enqueued in the music pipe. More...
 
gcc_pure const MusicChunk * Peek () const noexcept
 Returns the first MusicChunk from the pipe. More...
 
MusicChunk * Shift () noexcept
 Removes the first chunk from the head, and returns it. More...
 
void Clear (MusicBuffer &buffer) noexcept
 Clears the whole pipe and returns the chunks to the buffer. More...
 
void Push (MusicChunk *chunk) noexcept
 Pushes a chunk to the tail of the pipe. More...
 
gcc_pure unsigned GetSize () const noexcept
 Returns the number of chunks currently in this pipe. More...
 
gcc_pure bool IsEmpty () const noexcept
 

Detailed Description

A queue of MusicChunk objects.

One party appends chunks at the tail, and the other consumes them from the head.

Definition at line 39 of file MusicPipe.hxx.

Constructor & Destructor Documentation

◆ MusicPipe() [1/2]

MusicPipe::MusicPipe ( )
default

Creates a new MusicPipe object.

It is empty.

◆ MusicPipe() [2/2]

MusicPipe::MusicPipe ( const MusicPipe &  )
delete

◆ ~MusicPipe()

MusicPipe::~MusicPipe ( )
inline

Frees the object.

It must be empty now.

Definition at line 67 of file MusicPipe.hxx.

Member Function Documentation

◆ CheckFormat()

gcc_pure bool MusicPipe::CheckFormat ( AudioFormat  other) const
inlinenoexcept

Checks if the audio format if the chunk is equal to the specified audio_format.

Definition at line 80 of file MusicPipe.hxx.

◆ Clear()

void MusicPipe::Clear ( MusicBuffer &  buffer)
noexcept

Clears the whole pipe and returns the chunks to the buffer.

Parameters
bufferthe buffer object to return the chunks to

◆ Contains()

gcc_pure bool MusicPipe::Contains ( const MusicChunk *  chunk) const
noexcept

Checks if the specified chunk is enqueued in the music pipe.

◆ GetSize()

gcc_pure unsigned MusicPipe::GetSize ( ) const
inlinenoexcept

Returns the number of chunks currently in this pipe.

Definition at line 123 of file MusicPipe.hxx.

◆ IsEmpty()

gcc_pure bool MusicPipe::IsEmpty ( ) const
inlinenoexcept

Definition at line 129 of file MusicPipe.hxx.

◆ operator=()

MusicPipe& MusicPipe::operator= ( const MusicPipe &  )
delete

◆ Peek()

gcc_pure const MusicChunk* MusicPipe::Peek ( ) const
inlinenoexcept

Returns the first MusicChunk from the pipe.

Returns nullptr if the pipe is empty.

Definition at line 97 of file MusicPipe.hxx.

◆ Push()

void MusicPipe::Push ( MusicChunk *  chunk)
noexcept

Pushes a chunk to the tail of the pipe.

◆ Shift()

MusicChunk* MusicPipe::Shift ( )
noexcept

Removes the first chunk from the head, and returns it.


The documentation for this class was generated from the following file: