Main Page | Modules | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

basic_socketstream_pair.h

Go to the documentation of this file.
00001 // -*- Socket Streams -*-
00002 
00003 // Copyright (C) 2003, 2004, 2005 Pedro LamarĂ£o <pedro.lamarao@mndfck.org>
00004 
00005 // This file is part of the Socket Streams Library.  This library is free
00006 // software; you can redistribute it and/or modify it under the
00007 // terms of the GNU Lesser General Public License as published by the
00008 // Free Software Foundation; either version 2.1 of the License
00009 // or (at your option) any later version.
00010 
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 // GNU Lesser General Public License for more details.
00015 
00016 // You should have received a copy of the GNU Lesser General Public License along
00017 // with this library; see the file COPYING. If not, write to the Free
00018 // Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307,
00019 // USA
00020 
00025 #ifndef SOCKETSTREAM_BASIC_PAIR_H
00026 #define SOCKETSTREAM_BASIC_PAIR_H 1
00027 
00028 #error "basic_pair<> is not working in this version"
00029 
00030 #include <socketstream/config.h>
00031 
00032 #include <socketstream/sockets_base.h>
00033 #include <socketstream/basic_iosocketstream.h>
00034 
00035 namespace ss {
00036   
00042   template <typename _CharT, typename _Traits>
00043   class basic_pair {
00044   public:
00045 
00047 
00054     typedef _CharT     char_type;
00055     typedef _Traits  traits_type;
00056     
00057     typedef typename traits_type::int_type  int_type;
00058     typedef typename traits_type::pos_type  pos_type;
00059     typedef typename traits_type::off_type  off_type;
00061   
00062     typedef basic_pair<char_type, traits_type> __pair_type;
00063   
00067     basic_pair ()
00068     : _M_which(0)
00069     { }
00070   
00076     basic_pair (sockets_base::family __f, sockets_base::style __s)
00077     : _M_which(0)
00078     { }
00079   
00083     ~basic_pair ()
00084     { }
00085 
00089     __pair_type&
00090     one ()
00091     {
00092       _M_which = 0;
00093       return *this;
00094     }
00095   
00099     __pair_type&
00100     two ()
00101     {
00102       _M_which = 1;
00103       return *this;
00104     }
00105 
00109     basic_iosocketstream<char_type, traits_type>
00110     get_iostream ()
00111     {
00112       basic_socket __s(_M_pair[_M_which]);
00113       return basic_iosocketstream<char_type, traits_type>(__s);
00114     }
00115 
00119     basic_socket
00120     get_socket ()
00121     {
00122       return basic_socket(_M_pair[_M_which]);
00123     }
00124 
00125   private:
00126     
00127     sockets_base::socket_type _M_pair[1];
00128     
00129     int _M_which;
00130   
00131   };
00132   
00133   typedef basic_pair<char, std::char_traits<char> > pair;
00134   
00135 }
00136 
00137 #endif // SOCKETSTREAM_BASIC_PAIR_H

Generated on Sat May 21 21:25:32 2005 for Socket Streams Library by  doxygen 1.4.3