You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Processor.h 2.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. #pragma once
  2. #include <openvibe/ov_all.h>
  3. #include <functional>
  4. #include "StreamBundle.h"
  5. #include "Contexted.h"
  6. namespace OpenViBE {
  7. namespace Tracker {
  8. /**
  9. * \class Processor
  10. * \author J. T. Lindgren
  11. * \brief A signal processing component that can receive/return data
  12. * \details
  13. *
  14. * Processor in OpenViBE tracker is a kind of bridge to Designer that is
  15. * used to send data in, do some processing with a scenario, and get the processed
  16. * data back. A processor can also be one-directional.
  17. *
  18. *
  19. */
  20. class Processor : protected Contexted
  21. {
  22. public:
  23. explicit Processor(const Kernel::IKernelContext& ctx) : Contexted(ctx) {}
  24. // Set the processor XML file
  25. virtual bool initialize(const std::string& xmlFile) = 0;
  26. virtual bool uninitialize() = 0;
  27. // Get the processor XML filename
  28. virtual const std::string& getFilename() const { return m_xmlFilename; }
  29. // Connect the processor to a specific StreamBundle to read from
  30. virtual bool setNewSource(StreamBundle* source, bool sendHeader, bool sendEnd) = 0;
  31. // Connect the processor to a specific StreamBundle to write to
  32. virtual bool setNewTarget(StreamBundle* target) = 0;
  33. // Launch Designer to configure the processor
  34. virtual bool configure(const char* filename); // If filename is NULL, use internal
  35. // Launch the Player
  36. virtual bool play(const bool playFast, const std::function<bool(CTime)>& quitCallback) = 0;
  37. // Stop the Player
  38. virtual bool stop() = 0;
  39. virtual bool isRunning() const = 0;
  40. virtual CTime getCurrentTime() const = 0;
  41. // Communication port tcp/ip port IDs
  42. virtual bool setProcessorPorts(const uint32_t sendPort, const uint32_t recvPort) = 0;
  43. virtual bool getProcessorPorts(uint32_t& sendPort, uint32_t& recvPort) const = 0;
  44. // Command line arguments passed to the processor (Designer) launch call
  45. bool setArguments(const char* args)
  46. {
  47. m_arguments = std::string(args);
  48. return true;
  49. }
  50. const char* getArguments() const { return m_arguments.c_str(); }
  51. // Serialize state to configuration manager
  52. virtual bool save() = 0;
  53. virtual bool load() = 0;
  54. protected:
  55. std::string m_xmlFilename;
  56. std::string m_arguments;
  57. bool m_playFast = false;
  58. };
  59. } // namespace Tracker
  60. } // namespace OpenViBE