Merge pull request #2216 from jwillemsen/jwi-cxxversionchecks
[ACE_TAO.git] / ACE / protocols / ace / INet / Sock_IOStream.cpp
blob9b09310fe441a638d8a5f84c6b38fe69c16ecdad
1 #ifndef ACE_IOS_SOCK_IOSTREAM_CPP
2 #define ACE_IOS_SOCK_IOSTREAM_CPP
4 #include "ace/INet/Sock_IOStream.h"
5 #include "ace/INet/IOS_util.h"
7 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
9 namespace ACE
11 namespace IOS
13 template <ACE_SYNCH_DECL>
14 Sock_StreamBufferBase<ACE_SYNCH_USE>::Sock_StreamBufferBase (stream_type* stream)
15 : BidirStreamBuffer<StreamHandler<ACE_SOCK_STREAM, ACE_SYNCH_USE> > (
16 stream,
17 BUFFER_SIZE,
18 std::ios::in | std::ios::out)
22 template <ACE_SYNCH_DECL>
23 Sock_StreamBufferBase<ACE_SYNCH_USE>::~Sock_StreamBufferBase ()
27 template <ACE_SYNCH_DECL>
28 Sock_IOSBase<ACE_SYNCH_USE>::Sock_IOSBase (stream_type* stream)
29 : streambuf_ (stream)
31 ace_ios_init (&this->streambuf_);
34 template <ACE_SYNCH_DECL>
35 Sock_IOSBase<ACE_SYNCH_USE>::~Sock_IOSBase ()
37 try
39 this->streambuf_.sync();
41 catch (...)
46 template <ACE_SYNCH_DECL>
47 typename Sock_IOSBase<ACE_SYNCH_USE>::buffer_type*
48 Sock_IOSBase<ACE_SYNCH_USE>::rdbuf ()
50 return &this->streambuf_;
53 template <ACE_SYNCH_DECL>
54 void Sock_IOSBase<ACE_SYNCH_USE>::close ()
56 this->streambuf_.sync ();
57 this->streambuf_.close_stream ();
60 template <ACE_SYNCH_DECL>
61 const typename Sock_IOSBase<ACE_SYNCH_USE>::stream_type&
62 Sock_IOSBase<ACE_SYNCH_USE>::stream () const
64 return this->streambuf_.stream ();
68 template <ACE_SYNCH_DECL>
69 Sock_OStreamBase<ACE_SYNCH_USE>::Sock_OStreamBase(stream_type* stream)
70 : Sock_IOSBase<ACE_SYNCH_USE> (stream), std::ostream (Sock_IOSBase<ACE_SYNCH_USE>::rdbuf ())
74 template <ACE_SYNCH_DECL>
75 Sock_OStreamBase<ACE_SYNCH_USE>::~Sock_OStreamBase()
79 template <ACE_SYNCH_DECL>
80 void Sock_OStreamBase<ACE_SYNCH_USE>::set_interceptor (
81 typename buffer_type::interceptor_type& interceptor)
83 this->rdbuf ()->set_interceptor (interceptor);
86 template <ACE_SYNCH_DECL>
87 Sock_IStreamBase<ACE_SYNCH_USE>::Sock_IStreamBase(stream_type* stream)
88 : Sock_IOSBase<ACE_SYNCH_USE> (stream), std::istream (Sock_IOSBase<ACE_SYNCH_USE>::rdbuf ())
92 template <ACE_SYNCH_DECL>
93 Sock_IStreamBase<ACE_SYNCH_USE>::~Sock_IStreamBase ()
97 template <ACE_SYNCH_DECL>
98 void Sock_IStreamBase<ACE_SYNCH_USE>::set_interceptor (
99 typename buffer_type::interceptor_type& interceptor)
101 this->rdbuf ()->set_interceptor (interceptor);
104 template <ACE_SYNCH_DECL>
105 Sock_IOStreamBase<ACE_SYNCH_USE>::Sock_IOStreamBase(stream_type* stream)
106 : Sock_IOSBase<ACE_SYNCH_USE> (stream), std::iostream (Sock_IOSBase<ACE_SYNCH_USE>::rdbuf ())
110 template <ACE_SYNCH_DECL>
111 Sock_IOStreamBase<ACE_SYNCH_USE>::~Sock_IOStreamBase ()
115 template <ACE_SYNCH_DECL>
116 void Sock_IOStreamBase<ACE_SYNCH_USE>::set_interceptor (
117 typename buffer_type::interceptor_type& interceptor)
119 this->rdbuf ()->set_interceptor (interceptor);
125 ACE_END_VERSIONED_NAMESPACE_DECL
127 #endif /* ACE_IOS_SOCK_IOSTREAM_CPP */