A processing that allows other (GUI) thread to monitor a port in a thread safe way. More...
#include <PortMonitor.hxx>
Public Types | |
typedef TheDataType | DataType |
typedef ThePortType | PortType |
Public Member Functions | |
PortMonitor (const Config &cfg=Config()) | |
virtual | ~PortMonitor () |
bool | Do () |
Supervised mode execution method (using ports). | |
const char * | GetClassName () const |
Override it in every subclass and retur the name of that class. | |
const DataType & | FreezeAndGetData () |
void | UnfreezeData () |
void | AttachStartSlot (SigSlot::Slotv0 &slot) |
void | AttachStopSlot (SigSlot::Slotv0 &slot) |
void | AttachSlotNewData (SigSlot::Slotv0 &slot) |
template<> | |
bool | Do () |
Supervised mode execution method (using ports). | |
template<> | |
PortMonitor (const Config &cfg) | |
template<> | |
bool | Do () |
Supervised mode execution method (using ports). | |
template<> | |
PortMonitor (const Config &cfg) | |
Protected Member Functions | |
bool | ConcreteStart () |
Processing objects have to redefine this method when starting them implies some internal changes. | |
bool | ConcreteStop () |
Processing objects have to redefine this method when stoping them implies some internal changes. |
A processing that allows other (GUI) thread to monitor a port in a thread safe way.
Subclass specializations of this template in order to use it.
class SpectrumPortMonitor : public CLAM::PortMonitor<CLAM::Spectrum> { public: const char * GetClassName() const {return "SpectrumPortMonitor";} };
In order to get data from a GUI thread you should use a PortMonitor::DataLocker
// Supose 'monitor' being a SpectrumPortMonitor reference. ... { const Spectrum & spectrum = monitor.FreezeAndGetData(); // The monitor won't overwrite the current copy until Release. // Do what ever with the object visualize(spectrum); monitor.UnfreezeData(); // After unfreezing, 'spectrum' is not safe to use. // and the monitor will be allowed to swap copies }
Definition at line 53 of file PortMonitor.hxx.
typedef TheDataType CLAM::PortMonitor< TheDataType, ThePortType >::DataType |
Definition at line 56 of file PortMonitor.hxx.
typedef ThePortType CLAM::PortMonitor< TheDataType, ThePortType >::PortType |
Definition at line 57 of file PortMonitor.hxx.
CLAM::PortMonitor< PortDataType, PortType >::PortMonitor | ( | const Config & | cfg = Config() |
) | [inline] |
Definition at line 103 of file PortMonitor.hxx.
References CLAM::Processing::Configure(), and CLAM::Hidden::initData().
CLAM::PortMonitor< PortDataType, PortType >::~PortMonitor | ( | ) | [inline, virtual] |
Definition at line 113 of file PortMonitor.hxx.
CLAM::PortMonitor< Audio, AudioInPort >::PortMonitor | ( | const Config & | cfg | ) | [inline] |
Definition at line 21 of file PortMonitor.cxx.
CLAM::PortMonitor< Audio, AudioInPort >::PortMonitor | ( | const Config & | cfg | ) | [inline] |
void CLAM::PortMonitor< TheDataType, ThePortType >::AttachSlotNewData | ( | SigSlot::Slotv0 & | slot | ) | [inline] |
Definition at line 71 of file PortMonitor.hxx.
void CLAM::PortMonitor< TheDataType, ThePortType >::AttachStartSlot | ( | SigSlot::Slotv0 & | slot | ) | [inline] |
Definition at line 69 of file PortMonitor.hxx.
void CLAM::PortMonitor< TheDataType, ThePortType >::AttachStopSlot | ( | SigSlot::Slotv0 & | slot | ) | [inline] |
Definition at line 70 of file PortMonitor.hxx.
bool CLAM::PortMonitor< TheDataType, ThePortType >::ConcreteStart | ( | void | ) | [inline, protected, virtual] |
Processing objects have to redefine this method when starting them implies some internal changes.
ie: adquiring resources.
Reimplemented from CLAM::Processing.
Definition at line 74 of file PortMonitor.hxx.
bool CLAM::PortMonitor< TheDataType, ThePortType >::ConcreteStop | ( | ) | [inline, protected, virtual] |
Processing objects have to redefine this method when stoping them implies some internal changes.
ie: releasing resources.
Reimplemented from CLAM::Processing.
Definition at line 75 of file PortMonitor.hxx.
bool CLAM::PortMonitor< Audio, AudioInPort >::Do | ( | ) | [inline, virtual] |
Supervised mode execution method (using ports).
Implements CLAM::Processing.
bool CLAM::PortMonitor< Audio, AudioInPort >::Do | ( | ) | [inline, virtual] |
Supervised mode execution method (using ports).
Implements CLAM::Processing.
Definition at line 5 of file PortMonitor.cxx.
References CLAM::PortMonitor< TheDataType, ThePortType >::Do(), and CLAM::Hidden::ScopedTryLock< TryMutexType >::Locked().
bool CLAM::PortMonitor< PortDataType, PortType >::Do | ( | ) | [inline, virtual] |
Supervised mode execution method (using ports).
Implements CLAM::Processing.
Definition at line 131 of file PortMonitor.hxx.
References CLAM::Processing::AbleToExecute(), SigSlot::Signalv0::Emit(), and CLAM::Hidden::ScopedTryLock< TryMutexType >::Locked().
Referenced by CLAM::PortMonitor< TheDataType, ThePortType >::Do().
const PortMonitor< PortDataType, PortType >::DataType & CLAM::PortMonitor< PortDataType, PortType >::FreezeAndGetData | ( | ) | [inline] |
Definition at line 118 of file PortMonitor.hxx.
const char* CLAM::PortMonitor< TheDataType, ThePortType >::GetClassName | ( | ) | const [inline, virtual] |
Override it in every subclass and retur the name of that class.
Implements CLAM::Processing.
Reimplemented in CLAM::PeaksPortMonitor, CLAM::SinTracksPortMonitor, CLAM::SpectrumPortMonitor, CLAM::SpecgramPortMonitor, CLAM::FundamentalPortMonitor, CLAM::FundTrackPortMonitor, CLAM::AudioPortMonitor, and CLAM::AudioBuffPortMonitor.
Definition at line 64 of file PortMonitor.hxx.
void CLAM::PortMonitor< PortDataType, PortType >::UnfreezeData | ( | ) | [inline] |
Definition at line 125 of file PortMonitor.hxx.