summaryrefslogtreecommitdiff
path: root/ACE/protocols/ace/INet/StreamInterceptor.h
blob: 94cf93125ac46006ad9d765e161f877ddc9b50b3 (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
// $Id$

/**
 * @file StreamInterceptor.h
 *
 * @author Martin Corino <mcorino@remedy.nl>
 */

#ifndef ACE_IOS_STREAM_INTERCEPTOR_H
#define ACE_IOS_STREAM_INTERCEPTOR_H

#include /**/ "ace/pre.h"

#include /**/ "ace/config-all.h"

#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */

#include "ace/INet/INet_Export.h"
#include <iosfwd>
#include <ios>

ACE_BEGIN_VERSIONED_NAMESPACE_DECL

namespace ACE
  {
    namespace IOS
      {
        /**
        * @class ACE_IOS_StreamInterceptorBase
        *
        * @brief Abstract base for stream interceptors.
        *
        */
        template <class ACE_CHAR_T, class TR = std::char_traits<ACE_CHAR_T> >
        class StreamInterceptorBase
          {
            public:
              typedef std::basic_ios<ACE_CHAR_T, TR> ios_type;
              typedef ACE_CHAR_T char_type;
              typedef typename ios_type::openmode openmode;

              virtual ~StreamInterceptorBase ();
            protected:
              StreamInterceptorBase ();

            public:
              virtual void before_write (const char_type* buffer,
                                         std::streamsize length_to_write);
              virtual void after_write (int length_written);
              virtual void before_read (std::streamsize length_to_read);
              virtual void after_read (const char_type* buffer,
                                       int length_read);
              virtual void on_eof (void);
          };

        typedef StreamInterceptorBase<char> StreamInterceptor;

      }
  }

ACE_END_VERSIONED_NAMESPACE_DECL

#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/INet/StreamInterceptor.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */

#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("StreamInterceptor.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */

#include /**/ "ace/post.h"
#endif /* ACE_IOS_STREAM_INTERCEPTOR_H */