diff options
Diffstat (limited to 'veslibrary/ves_cpplibrary/src/lib/transport/XSwitchableTransport.h')
-rwxr-xr-x | veslibrary/ves_cpplibrary/src/lib/transport/XSwitchableTransport.h | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/veslibrary/ves_cpplibrary/src/lib/transport/XSwitchableTransport.h b/veslibrary/ves_cpplibrary/src/lib/transport/XSwitchableTransport.h new file mode 100755 index 0000000..e4bb82b --- /dev/null +++ b/veslibrary/ves_cpplibrary/src/lib/transport/XSwitchableTransport.h @@ -0,0 +1,37 @@ +#pragma once
+
+#include <vector>
+#include "XTransport.h"
+
+namespace vagt
+{
+ namespace transport
+ {
+ class XSwitchableTransport : public XTransport
+ {
+ public:
+ XSwitchableTransport(std::vector<std::shared_ptr<XTransport>>& processors);
+
+ virtual ~XSwitchableTransport() {}
+
+ virtual XErrorCode start() override;
+
+ virtual XErrorCode stop() override;
+
+ virtual XErrorCode post(const std::string& event) override;
+
+ virtual void cancelPost() override;
+
+ virtual void allowPost() override;
+
+ virtual bool shouldCancelPost() override;
+
+ private:
+ XErrorCode tryTransport(const std::string& event);
+ void switchTransport(vagt::transport::XErrorCode reason);
+
+ std::vector<std::shared_ptr<XTransport>> transports_;
+ unsigned int transportIndex_;
+ };
+ }
+}
|