reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
CountStream.hxx
Go to the documentation of this file.
1#if !defined(RESIP_COUNTSTREAM_HXX)
2#define RESIP_COUNTSTREAM_HXX
3
4#ifdef HAVE_CONFIG_H
5#include "config.h"
6#endif
7
8#include <iostream>
9#include "rutil/Data.hxx"
10
11namespace resip
12{
13
19#ifdef RESIP_USE_STL_STREAMS
20 public std::streambuf
21#else
22 public ResipStreamBuf
23#endif
24{
25 public:
29 CountBuffer(size_t& count);
30 virtual ~CountBuffer();
31
32 protected:
33#ifdef RESIP_USE_STL_STREAMS
34 virtual int sync();
35 virtual int overflow(int c = -1);
36#else
37 virtual size_t writebuf(const char *s, size_t count);
38 virtual size_t putbuf(char ch);
39 virtual void flushbuf(void){}
40 virtual size_t readbuf(char *buf, size_t count)
41 {
42 resip_assert(0);
43 return 0;
44 }
45
46 virtual uint64_t tellpbuf(void);
47#endif
48
49 private:
50 size_t& mCount;
51};
52
61class CountStream : private CountBuffer, public EncodeStream
62{
63 public:
69 CountStream(size_t& count);
74
75};
76
77}
78
79#endif
80
81/* ====================================================================
82 * The Vovida Software License, Version 1.0
83 *
84 * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved.
85 *
86 * Redistribution and use in source and binary forms, with or without
87 * modification, are permitted provided that the following conditions
88 * are met:
89 *
90 * 1. Redistributions of source code must retain the above copyright
91 * notice, this list of conditions and the following disclaimer.
92 *
93 * 2. Redistributions in binary form must reproduce the above copyright
94 * notice, this list of conditions and the following disclaimer in
95 * the documentation and/or other materials provided with the
96 * distribution.
97 *
98 * 3. The names "VOCAL", "Vovida Open Communication Application Library",
99 * and "Vovida Open Communication Application Library (VOCAL)" must
100 * not be used to endorse or promote products derived from this
101 * software without prior written permission. For written
102 * permission, please contact vocal@vovida.org.
103 *
104 * 4. Products derived from this software may not be called "VOCAL", nor
105 * may "VOCAL" appear in their name, without prior written
106 * permission of Vovida Networks, Inc.
107 *
108 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
109 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
110 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
111 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
112 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
113 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
114 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
115 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
116 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
117 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
118 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
119 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
120 * DAMAGE.
121 *
122 * ====================================================================
123 *
124 * This software consists of voluntary contributions made by Vovida
125 * Networks, Inc. and many individuals on behalf of Vovida Networks,
126 * Inc. For more information on Vovida Networks, Inc., please see
127 * <http://www.vovida.org/>.
128 *
129 */
#define resip_assert(x)
This file needs to work for both C and C++ code.
Implementation of std::streambuf used to back CountStream.
virtual size_t putbuf(char ch)
virtual uint64_t tellpbuf(void)
virtual void flushbuf(void)
virtual size_t writebuf(const char *s, size_t count)
virtual size_t readbuf(char *buf, size_t count)
Used to count the amount of data written to a stream.
~CountStream()
Calls flush on itself to force the update to the count reference passed into the constructor.
dcm! – add UnusedChecking(_enum) below;
unsigned long long uint64_t
Definition Stun.hxx:39
#define EncodeStream