summaryrefslogtreecommitdiff
path: root/ACE/protocols/ace/INet/Sock_IOStream.cpp
blob: 06979f90942cb92a42fdc5fdb3711f63778fa01b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#ifndef ACE_IOS_SOCK_IOSTREAM_CPP
#define ACE_IOS_SOCK_IOSTREAM_CPP

#include "ace/INet/Sock_IOStream.h"
#include "ace/INet/IOS_util.h"

ACE_BEGIN_VERSIONED_NAMESPACE_DECL

namespace ACE
{
  namespace IOS
  {

    template <ACE_SYNCH_DECL>
    Sock_StreamBufferBase<ACE_SYNCH_USE>::Sock_StreamBufferBase (stream_type* stream)
      : BidirStreamBuffer<StreamHandler<ACE_SOCK_STREAM, ACE_SYNCH_USE> > (
            stream,
            BUFFER_SIZE,
            std::ios::in | std::ios::out)
      {
      }

    template <ACE_SYNCH_DECL>
    Sock_StreamBufferBase<ACE_SYNCH_USE>::~Sock_StreamBufferBase ()
      {
      }

    template <ACE_SYNCH_DECL>
    Sock_IOSBase<ACE_SYNCH_USE>::Sock_IOSBase (stream_type* stream)
      : streambuf_ (stream)
      {
        ace_ios_init (&this->streambuf_);
      }

    template <ACE_SYNCH_DECL>
    Sock_IOSBase<ACE_SYNCH_USE>::~Sock_IOSBase ()
      {
        try
          {
            this->streambuf_.sync();
          }
        catch (...)
          {
          }
      }

    template <ACE_SYNCH_DECL>
    typename Sock_IOSBase<ACE_SYNCH_USE>::buffer_type*
    Sock_IOSBase<ACE_SYNCH_USE>::rdbuf ()
      {
        return &this->streambuf_;
      }

    template <ACE_SYNCH_DECL>
    void Sock_IOSBase<ACE_SYNCH_USE>::close ()
      {
        this->streambuf_.sync ();
        this->streambuf_.close_stream ();
      }

    template <ACE_SYNCH_DECL>
    const typename Sock_IOSBase<ACE_SYNCH_USE>::stream_type&
    Sock_IOSBase<ACE_SYNCH_USE>::stream () const
      {
        return this->streambuf_.stream ();
      }


    template <ACE_SYNCH_DECL>
    Sock_OStreamBase<ACE_SYNCH_USE>::Sock_OStreamBase(stream_type* stream)
      : Sock_IOSBase<ACE_SYNCH_USE> (stream), std::ostream (Sock_IOSBase<ACE_SYNCH_USE>::rdbuf ())
      {
      }

    template <ACE_SYNCH_DECL>
    Sock_OStreamBase<ACE_SYNCH_USE>::~Sock_OStreamBase()
      {
      }

    template <ACE_SYNCH_DECL>
    void Sock_OStreamBase<ACE_SYNCH_USE>::set_interceptor (
          typename buffer_type::interceptor_type& interceptor)
      {
        this->rdbuf ()->set_interceptor (interceptor);
      }

    template <ACE_SYNCH_DECL>
    Sock_IStreamBase<ACE_SYNCH_USE>::Sock_IStreamBase(stream_type* stream)
      : Sock_IOSBase<ACE_SYNCH_USE> (stream), std::istream (Sock_IOSBase<ACE_SYNCH_USE>::rdbuf ())
      {
      }

    template <ACE_SYNCH_DECL>
    Sock_IStreamBase<ACE_SYNCH_USE>::~Sock_IStreamBase ()
      {
      }

    template <ACE_SYNCH_DECL>
    void Sock_IStreamBase<ACE_SYNCH_USE>::set_interceptor (
          typename buffer_type::interceptor_type& interceptor)
      {
        this->rdbuf ()->set_interceptor (interceptor);
      }

    template <ACE_SYNCH_DECL>
    Sock_IOStreamBase<ACE_SYNCH_USE>::Sock_IOStreamBase(stream_type* stream)
      : Sock_IOSBase<ACE_SYNCH_USE> (stream), std::iostream (Sock_IOSBase<ACE_SYNCH_USE>::rdbuf ())
      {
      }

    template <ACE_SYNCH_DECL>
    Sock_IOStreamBase<ACE_SYNCH_USE>::~Sock_IOStreamBase ()
      {
      }

    template <ACE_SYNCH_DECL>
    void Sock_IOStreamBase<ACE_SYNCH_USE>::set_interceptor (
          typename buffer_type::interceptor_type& interceptor)
      {
        this->rdbuf ()->set_interceptor (interceptor);
      }

  }
}

ACE_END_VERSIONED_NAMESPACE_DECL

#endif /* ACE_IOS_SOCK_IOSTREAM_CPP */