Use a variable on the stack to not have a temporary in the call
[ACE_TAO.git] / ACE / protocols / ace / INet / HTTP_IOStream.h
blob621c1f3a3eea9c78f49c69357ae8148df75a4fbc
1 /**
2 * @file HTTP_IOStream.h
4 * @author Martin Corino <mcorino@remedy.nl>
5 */
7 #ifndef ACE_HTTP_IOSTREAM_H
8 #define ACE_HTTP_IOSTREAM_H
10 #include /**/ "ace/pre.h"
12 #include /**/ "ace/config-all.h"
14 #if !defined (ACE_LACKS_PRAGMA_ONCE)
15 # pragma once
16 #endif /* ACE_LACKS_PRAGMA_ONCE */
18 #include "ace/INet/INet_Export.h"
19 #include "ace/INet/BufferedStreamBuffer.h"
20 #include "ace/INet/HTTP_StreamPolicyBase.h"
21 #include <ostream>
22 #include <istream>
24 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
26 namespace ACE
28 namespace HTTP
30 /**
31 * @class ACE_HTTP_StreamBuffer
33 * @brief
36 class ACE_INET_Export StreamBuffer
37 : public ACE::IOS::BufferedStreamBuffer
39 public:
40 typedef StreamPolicyBase<StreamBuffer> policy_type;
42 StreamBuffer (std::iostream& stream, policy_type* policy = 0);
43 virtual ~StreamBuffer ();
45 virtual int sync ();
47 protected:
48 friend class StreamPolicyBase<StreamBuffer>;
50 enum
52 BUFFER_SIZE = 4096
55 virtual int read_from_stream (char* buffer, std::streamsize length);
57 virtual int write_to_stream (const char* buffer, std::streamsize length);
59 virtual int read_from_stream_i (char* buffer, std::streamsize length);
61 virtual int write_to_stream_i (const char* buffer, std::streamsize length);
63 private:
64 std::iostream & stream_;
65 policy_type * policy_;
69 /**
70 * @class ACE_HTTP_IOS
72 * @brief
75 class ACE_INET_Export IOS
76 : public virtual std::ios
78 public:
79 IOS (std::iostream& stream, StreamBuffer::policy_type* policy = 0);
80 ~IOS ();
82 StreamBuffer* rdbuf ();
84 protected:
85 StreamBuffer streambuf_;
88 /**
89 * @class ACE_HTTP_OStream
91 * @brief
94 class ACE_INET_Export OStream
95 : public IOS, public std::ostream
97 public:
98 explicit OStream(std::iostream& stream, StreamBuffer::policy_type* policy = 0);
99 ~OStream();
101 void set_interceptor (StreamBuffer::interceptor_type& interceptor);
105 * @class ACE_HTTP_IStream
107 * @brief
110 class ACE_INET_Export IStream
111 : public IOS, public std::istream
113 public:
114 explicit IStream(std::iostream& stream, StreamBuffer::policy_type* policy = 0);
115 ~IStream();
117 void set_interceptor (StreamBuffer::interceptor_type& interceptor);
122 ACE_END_VERSIONED_NAMESPACE_DECL
124 #if defined (__ACE_INLINE__)
125 #include "ace/INet/HTTP_IOStream.inl"
126 #endif
128 #include /**/ "ace/post.h"
129 #endif /* ACE_HTTP_IOSTREAM_H */