FAST  3.2.0
Framework for Heterogeneous Medical Image Computing and Visualization
Streamer.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include <FAST/ProcessObject.hpp>
5 #include "FAST/Exception.hpp"
6 #include <thread>
7 
8 namespace fast {
9 
10 
11 class FAST_EXPORT NoMoreFramesException : public Exception {
12  public:
13  explicit NoMoreFramesException(std::string message) : Exception(message) {};
14 };
15 
19 class FAST_EXPORT Streamer : public ProcessObject {
20  public:
21  typedef std::shared_ptr<Streamer> pointer;
22  Streamer();
23  virtual ~Streamer() {};
24  static std::string getStaticNameOfClass() {
25  return "Streamer";
26  }
27  virtual std::string getNameOfClass() const = 0;
28 
32  virtual void stop();
33 
34  virtual void setMaximumNrOfFrames(int maximumNrOfFrames);
35  protected:
39  virtual void waitForFirstFrame();
40 
44  virtual void startStream();
45 
49  virtual void frameAdded();
50 
54  virtual void generateStream() = 0;
55 
56  bool m_firstFrameIsInserted = false;
57  bool m_streamIsStarted = false;
58  bool m_stop = false;
59 
60  std::mutex m_firstFrameMutex;
61  std::mutex m_stopMutex;
62  std::unique_ptr<std::thread> m_thread;
63  std::condition_variable m_firstFrameCondition;
64 
65 
66 };
67 
68 } // end namespace fast
fast::Streamer
Definition: Streamer.hpp:19
fast::NoMoreFramesException
Definition: Streamer.hpp:11
fast::Exception
Definition: Exception.hpp:15
fast
Definition: AffineTransformation.hpp:7
fast::Streamer::pointer
std::shared_ptr< Streamer > pointer
Definition: Streamer.hpp:21
fast::Streamer::m_stopMutex
std::mutex m_stopMutex
Definition: Streamer.hpp:61
fast::Streamer::m_firstFrameCondition
std::condition_variable m_firstFrameCondition
Definition: Streamer.hpp:63
fast::Streamer::m_firstFrameMutex
std::mutex m_firstFrameMutex
Definition: Streamer.hpp:60
fast::NoMoreFramesException::NoMoreFramesException
NoMoreFramesException(std::string message)
Definition: Streamer.hpp:13
fast::Streamer::m_thread
std::unique_ptr< std::thread > m_thread
Definition: Streamer.hpp:62
DataTypes.hpp
ProcessObject.hpp
Exception.hpp
fast::Streamer::~Streamer
virtual ~Streamer()
Definition: Streamer.hpp:23
fast::Streamer::getStaticNameOfClass
static std::string getStaticNameOfClass()
Definition: Streamer.hpp:24
fast::ProcessObject
Definition: ProcessObject.hpp:22