runMACS
 All Data Structures Files Functions Variables Enumerations Enumerator Macros
ImageGrabber.h
Go to the documentation of this file.
1 #ifndef IMAGE_GRABBER_H
2 #define IMAGE_GRABBER_H
3 
4 #include <string>
5 #include <exception>
6 #include <functional>
7 
8 #include <interfaces/IImageStreamExtractor.h>
9 
10 #include <zmq.hpp>
11 
16 class ImageGrabberException: public std::exception {
17 public:
18  ImageGrabberException(const std::string & _message);
19  ~ImageGrabberException() throw();
20  virtual const char* what() const throw();
21 private:
22  std::string message;
23 };
24 
25 class ImageGrabber;
26 
28  friend ImageGrabber;
29 public:
30  virtual int getWidth() = 0;
31  virtual int getHeight() = 0;
32  virtual int getBytesPerPixel() = 0;
33  virtual void startServing() = 0;
34  virtual void stopServing() = 0;
35  virtual void addEndpoint(const std::string & _endpoint) = 0;
36 protected:
37  virtual ~_ImageGrabberImpl() = 0;
38 };
39 
45 class ImageGrabber {
46 public:
52  ImageGrabber(const std::string & _deviceName,
53  const std::string & _deviceType,
54  const std::string & _deviceSource,
55  zmq::context_t & ctx,
56  const std::string & _brokerEndpoint);
57  ~ImageGrabber();
62  int getWidth();
67  int getHeight();
72  int getBytesPerPixel();
75  void startServing();
78  void stopServing();
87  void addEndpoint(const std::string & _endpoint);
88 
89 private:
90  _ImageGrabberImpl* impl;
91 };
92 
93 #endif /* IMAGE_GRABBER_H */
94 
Base for all ImageGrabber related exceptions.
Definition: ImageGrabber.h:16
virtual ~_ImageGrabberImpl()=0
virtual const char * what() const
virtual int getHeight()=0
virtual void startServing()=0
virtual int getBytesPerPixel()=0
ImageGrabber(const std::string &_deviceName, const std::string &_deviceType, const std::string &_deviceSource, zmq::context_t &ctx, const std::string &_brokerEndpoint)
Setup a grabber.
ImageGrabberException(const std::string &_message)
virtual void addEndpoint(const std::string &_endpoint)=0
void startServing()
Start the server asynchronously.
virtual void stopServing()=0
Public interface to an ImageGrabber grabber.
Definition: ImageGrabber.h:45
int getBytesPerPixel()
void stopServing()
Stop the server.
virtual int getWidth()=0
void addEndpoint(const std::string &_endpoint)
Add a publisher endpoint.