00001 00002 00003 00004 00005 00006 00007 00008 00009 00010 00011 #pragma once 00012 00013 #include <cstddef> 00014 #include <functional> 00015 #include <memory> 00016 #include <system_error> 00017 00018 namespace OpcUa 00019 { 00020 00021 class BreakableChannel 00022 { 00023 public: 00024 virtual ~BreakableChannel(){} 00025 BreakableChannel(){} 00026 BreakableChannel(const BreakableChannel&) = delete; 00027 BreakableChannel(BreakableChannel&&) = delete; 00028 BreakableChannel& operator=(const BreakableChannel&) = delete; 00029 00030 public: 00031 virtual void Stop() = 0; 00032 }; 00033 00034 00035 class InputChannel : public virtual BreakableChannel 00036 { 00037 public: 00038 typedef std::shared_ptr<InputChannel> SharedPtr; 00039 typedef std::unique_ptr<InputChannel> UniquePtr; 00040 00041 public: 00042 virtual ~InputChannel(){} 00043 InputChannel(){} 00044 InputChannel(const InputChannel&) = delete; 00045 InputChannel(InputChannel&&) = delete; 00046 InputChannel& operator=(const InputChannel&) = delete; 00047 00048 public: 00053 virtual std::size_t Receive(char* data, std::size_t size) = 0; 00054 }; 00055 00056 00057 class OutputChannel : public virtual BreakableChannel 00058 { 00059 public: 00060 typedef std::shared_ptr<OutputChannel> SharedPtr; 00061 typedef std::unique_ptr<OutputChannel> UniquePtr; 00062 00063 public: 00064 virtual ~OutputChannel(){} 00065 00066 OutputChannel(){} 00067 OutputChannel(const OutputChannel&) = delete; 00068 OutputChannel(OutputChannel&&) = delete; 00069 OutputChannel& operator=(const OutputChannel&) = delete; 00070 00071 public: 00072 virtual void Send(const char* message, std::size_t size) = 0; 00073 }; 00074 00075 00076 class IOChannel : 00077 public InputChannel, 00078 public OutputChannel 00079 { 00080 public: 00081 typedef std::shared_ptr<IOChannel> SharedPtr; 00082 typedef std::unique_ptr<IOChannel> UniquePtr; 00083 }; 00084 00085 } 00086