socket_streams.hpp
Go to the documentation of this file.
00001 
00010 /*****************************************************************************
00011 ** Ifdefs
00012 *****************************************************************************/
00013 
00014 #ifndef ECL_STREAMS_SOCKET_STREAMS_HPP_
00015 #define ECL_STREAMS_SOCKET_STREAMS_HPP_
00016 
00017 
00018 /*****************************************************************************
00019 ** Includes
00020 *****************************************************************************/
00021 
00022 #include <string>
00023 #include <ecl/config/macros.hpp>
00024 #include <ecl/devices/socket.hpp>
00025 #include <ecl/exceptions/standard_exception.hpp>
00026 #include "text_stream.hpp"
00027 
00028 /*****************************************************************************
00029 ** Namespaces
00030 *****************************************************************************/
00031 
00032 namespace ecl {
00033 
00034 /*****************************************************************************
00035 ** Interfaces [SocketClientStream]
00036 *****************************************************************************/
00045 class ECL_PUBLIC SocketClientStream : public TextStream<SocketClient> {
00046 public:
00053         SocketClientStream() {};
00054 
00066         SocketClientStream(const std::string &host_name, const unsigned int &port_number) ecl_throw_decl(StandardException) {
00067                 ecl_try {
00068                         if ( !this->device().open(host_name, port_number) ) {
00069                                 error = this->device().error();
00070                         }
00071                 } ecl_catch(StandardException &e) {
00072                         ecl_throw(StandardException(LOC,e));
00073                 }
00074         }
00075 
00076         virtual ~SocketClientStream() {};
00077 };
00078 
00079 /*****************************************************************************
00080 ** Interfaces [SocketClientStream]
00081 *****************************************************************************/
00090 class ECL_PUBLIC SocketServerStream : public TextStream<SocketServer> {
00091 public:
00098         SocketServerStream() {};
00099 
00110         SocketServerStream(const unsigned int &port_number) throw(StandardException) {
00111                 try {
00112                         this->device().open(port_number);
00113                 } catch(StandardException &e) {
00114                         throw StandardException(LOC,e);
00115                 }
00116         }
00117 
00118         virtual ~SocketServerStream() {};
00119 };
00120 
00121 } // namespace ecl
00122 
00123 
00124 #endif /* ECL_STREAMS_SOCKET_STREAMS_HPP_ */


ecl_streams
Author(s): Daniel Stonier (d.stonier@gmail.com)
autogenerated on Thu Jan 2 2014 11:12:54