LASP 1.0
Library for Acoustic Signal Processing
Loading...
Searching...
No Matches
lasp_indatahandler.h
Go to the documentation of this file.
1#pragma once
2#include "lasp_types.h"
3#include <atomic>
4#include <functional>
5#include <memory>
6#include <thread>
7
8class StreamMgr;
9using SmgrHandle = std::shared_ptr<StreamMgr>;
10
11class DaqData;
12class Daq;
13
21using InCallbackType = std::function<void(const DaqData &)>;
25using InResetType = std::function<void(const Daq *)>;
26
28
29protected:
30 std::weak_ptr<StreamMgr> _mgr;
31#if LASP_DEBUG == 1
32 // This is a flag to indicate whether the method stop() is called for the
33 // current handler. It should call the method stop() from the derived class's
34 // destructor.
35 std::atomic<bool> stopCalled{false};
36#endif
37
38public:
42
53 InResetType resetfcn);
54
61 void start();
62
70 void stop();
71
72#if LASP_DEBUG == 1
73 const std::thread::id main_thread_id;
74 void checkRightThread() const;
75#else
76 void checkRightThread() const {}
77#endif
78};
Data coming from / going to DAQ. Non-interleaved format, which means data in buffer is ordered by cha...
Base cass for all DAQ (Data Acquisition) interfaces. A DAQ can be a custom device,...
Definition lasp_daq.h:29
std::weak_ptr< StreamMgr > _mgr
void start()
Adds the current InDataHandler to the list of handlers in the StreamMgr. After this happens,...
const InCallbackType inCallback
void checkRightThread() const
const InResetType reset
void stop()
Removes the currend InDataHandler from the list of handlers in the StreamMgr. From that point on,...
Stream manager. Used to manage the input and output streams. Implemented as a singleton: only one str...
std::function< void(const Daq *)> InResetType
Function definition for the reset callback.
std::function< void(const DaqData &)> InCallbackType
The function definition of callbacks with incoming DAQ data.
std::shared_ptr< StreamMgr > SmgrHandle