NorMIT-nav  2023.01.05-dev+develop.0da12
An IGT application
cxStreamer.h
Go to the documentation of this file.
1 /*=========================================================================
2 This file is part of CustusX, an Image Guided Therapy Application.
3 
4 Copyright (c) SINTEF Department of Medical Technology.
5 All rights reserved.
6 
7 CustusX is released under a BSD 3-Clause license.
8 
9 See Lisence.txt (https://github.com/SINTEFMedtek/CustusX/blob/master/License.txt) for details.
10 =========================================================================*/
11 
12 #ifndef CXSTREAMER_H_
13 #define CXSTREAMER_H_
14 
15 #include "cxGrabberExport.h"
16 
17 #include <QObject>
18 #include <QString>
19 #include <QStringList>
20 #include <QTimer>
21 
22 #include <map>
23 #include "boost/shared_ptr.hpp"
24 #include <iostream>
25 
26 namespace cx
27 {
28 
29 typedef boost::shared_ptr<class Sender> SenderPtr;
30 typedef boost::shared_ptr<class Streamer> StreamerPtr;
31 
39 class cxGrabber_EXPORT Streamer : public QObject
40 {
41  Q_OBJECT
42 
43 public:
44  Streamer();
45  virtual ~Streamer(){}
46 
47  virtual void startStreaming(SenderPtr sender) = 0;
48  virtual void stopStreaming() = 0;
49  virtual bool isStreaming() = 0;
50 
51  void setSendInterval(int milliseconds);
52  int getSendInterval() const;
53 
54 signals:
55  void stateChanged();
56 
57 protected slots:
58  virtual void streamSlot() = 0;
59 
60 protected:
61  void setInitialized(bool initialized);
62  bool isInitialized();
63  void createSendTimer(bool singleshot = false);
64  bool isReadyToSend();
66  QTimer* mSendTimer;
67 
68 private:
69  int mSendInterval;
70  bool mInitialized;
71 
72 };
73 
74 typedef std::map<QString, QString> StringMap;
75 
83 class cxGrabber_EXPORT CommandLineStreamer : public Streamer
84 {
85  Q_OBJECT
86 
87 public:
90 
91  virtual QStringList getArgumentDescription() = 0;
92  virtual QString getType() = 0;
93 
94  virtual void initialize(StringMap arguments);
95 
96 protected slots:
97  virtual void streamSlot() {std::cout << "THIS SHOULD NOT HAPPEN...." << std::endl;}
98 
99 
100 protected:
102 };
103 typedef boost::shared_ptr<CommandLineStreamer> CommandLineStreamerPtr;
104 }
105 
106 #endif /* CXSTREAMER_H_ */
cx::CommandLineStreamer::mArguments
StringMap mArguments
Definition: cxStreamer.h:101
cx::Streamer
Definition: cxStreamer.h:39
cx::CommandLineStreamer::CommandLineStreamer
CommandLineStreamer()
Definition: cxStreamer.h:88
cx
Namespace for all CustusX production code.
Definition: cx_dev_group_definitions.h:13
cx::CommandLineStreamerPtr
boost::shared_ptr< CommandLineStreamer > CommandLineStreamerPtr
Definition: cxStreamer.h:103
cx::CommandLineStreamer::streamSlot
virtual void streamSlot()
Definition: cxStreamer.h:97
cx::StringMap
std::map< QString, QString > StringMap
Definition: cxCommandlineImageStreamerFactory.h:28
cx::Streamer::~Streamer
virtual ~Streamer()
Definition: cxStreamer.h:45
cx::Streamer::mSender
SenderPtr mSender
Definition: cxStreamer.h:65
cx::CommandLineStreamer
Definition: cxStreamer.h:83
cx::Streamer::mSendTimer
QTimer * mSendTimer
Definition: cxStreamer.h:66
cx::CommandLineStreamer::~CommandLineStreamer
virtual ~CommandLineStreamer()
Definition: cxStreamer.h:89
cx::SenderPtr
boost::shared_ptr< Sender > SenderPtr
Definition: cxSender.h:64
cx::StreamerPtr
boost::shared_ptr< class Streamer > StreamerPtr
Definition: cxImageReceiverThread.h:29