reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
DataStream.hxx
Go to the documentation of this file.
1#ifndef RESIP_DataStream_hxx
2#define RESIP_DataStream_hxx
3
4#ifdef HAVE_CONFIG_H
5#include "config.h"
6#endif
7
8#include <iostream>
10
11namespace resip
12{
13
14class Data;
15
19class DataBuffer :
20#ifdef RESIP_USE_STL_STREAMS
21 public std::streambuf
22#else
23 public ResipStreamBuf
24#endif
25{
26 public:
27 DataBuffer(Data& str);
28 virtual ~DataBuffer();
29
30 protected:
31#ifdef RESIP_USE_STL_STREAMS
32 virtual int sync();
33 virtual int overflow(int c = -1);
34#else
35 virtual size_t writebuf(const char *s, size_t count);
36 virtual size_t readbuf(char *buf, size_t count);
37 virtual size_t putbuf(char ch);
38 virtual void flushbuf(void)
39 {}
40 virtual uint64_t tellpbuf(void);
41#endif
43 private:
44 DataBuffer(const DataBuffer&);
45 DataBuffer& operator=(const DataBuffer&);
46};
47
56class DataStream : private DataBuffer
57#ifdef RESIP_USE_STL_STREAMS
58, public std::iostream
59#else
60, public ResipFastOStream
61#endif
62
63{
64 public:
68 DataStream(Data& str);
73
74 private:
75 DataStream(const DataStream&);
76 DataStream& operator=(const DataStream&);
77};
78
82class iDataStream : private DataBuffer, public DecodeStream
83{
84 public:
88 iDataStream(Data& str);
90
91 private:
93 iDataStream& operator=(const iDataStream&);
94
95};
96
103class oDataStream : private DataBuffer, public EncodeStream
104{
105 public:
109 oDataStream(Data& str);
113 ~oDataStream();
114
116 void reset();
117
118 private:
119 oDataStream(const oDataStream&);
120 oDataStream& operator=(const oDataStream&);
121};
122}
123#endif
124
125/* ====================================================================
126 * The Vovida Software License, Version 1.0
127 *
128 * Copyright (c) 2000-2005
129 *
130 * Redistribution and use in source and binary forms, with or without
131 * modification, are permitted provided that the following conditions
132 * are met:
133 *
134 * 1. Redistributions of source code must retain the above copyright
135 * notice, this list of conditions and the following disclaimer.
136 *
137 * 2. Redistributions in binary form must reproduce the above copyright
138 * notice, this list of conditions and the following disclaimer in
139 * the documentation and/or other materials provided with the
140 * distribution.
141 *
142 * 3. The names "VOCAL", "Vovida Open Communication Application Library",
143 * and "Vovida Open Communication Application Library (VOCAL)" must
144 * not be used to endorse or promote products derived from this
145 * software without prior written permission. For written
146 * permission, please contact vocal@vovida.org.
147 *
148 * 4. Products derived from this software may not be called "VOCAL", nor
149 * may "VOCAL" appear in their name, without prior written
150 * permission of Vovida Networks, Inc.
151 *
152 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
153 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
154 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
155 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
156 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
157 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
158 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
159 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
160 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
161 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
162 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
163 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
164 * DAMAGE.
165 *
166 * ====================================================================
167 *
168 * This software consists of voluntary contributions made by Vovida
169 * Networks, Inc. and many individuals on behalf of Vovida Networks,
170 * Inc. For more information on Vovida Networks, Inc., please see
171 * <http://www.vovida.org/>.
172 *
173 */
Implementation of std::streambuf used to back the DataStream, iDataStream, and oDataStream.
virtual int sync()
virtual ~DataBuffer()
virtual int overflow(int c=-1)
An iostream that operates on an existing Data.
~DataStream()
Calls flush on itself to force the update to the Data reference passed into the constructor.
An alternative to std::string, encapsulates an arbitrary buffer of bytes.
Definition Data.hxx:90
std::ostream replacement.
An istream that operates on an existing Data.
An ostream that operates on an existing Data.
void reset()
Clears the underlying Data reference.
~oDataStream()
Calls flush on itself to force the update to the Data reference passed into the constructor.
dcm! – add UnusedChecking(_enum) below;
unsigned long long uint64_t
Definition Stun.hxx:39
Replaces STL streams for general encoding purposes.
#define EncodeStream
#define DecodeStream