cisst-saw
Toggle main menu visibility
Loading...
Searching...
No Matches
tmp
cisst-saw
cisst
cisstCommon
cmnMultiplexerStreambufProxy.h
Go to the documentation of this file.
1
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
/* ex: set filetype=cpp softtabstop=4 shiftwidth=4 tabstop=4 cindent expandtab: */
3
4
/*
5
6
Author(s): Ofri Sadowsky
7
Created on: 2002-05-20
8
9
(C) Copyright 2002-2007 Johns Hopkins University (JHU), All Rights
10
Reserved.
11
12
--- begin cisst license - do not edit ---
13
14
This software is provided "as is" under an open source license, with
15
no warranty. The complete license can be found in license.txt and
16
http://www.cisst.org/cisst/license.txt.
17
18
--- end cisst license ---
19
20
*/
21
22
26
#pragma once
27
28
#ifndef _cmnMultiplexerStreambufProxy_h
29
#define _cmnMultiplexerStreambufProxy_h
30
31
#include <
cisstCommon/cmnPortability.h
>
32
#include <
cisstCommon/cmnLODMultiplexerStreambuf.h
>
33
34
#include <list>
35
#include <algorithm>
36
86
template
<
class
_element,
class
_trait>
87
class
cmnMultiplexerStreambufProxy :
public
std::basic_streambuf<_element, _trait>
88
{
89
private
:
92
cmnMultiplexerStreambufProxy(
const
cmnMultiplexerStreambufProxy<_element, _trait> & other);
93
94
public
:
95
96
typedef
cmnLODMultiplexerStreambuf<_element, _trait>
ChannelType
;
97
typedef
typename
std::basic_streambuf<_element, _trait>::int_type
int_type
;
98
100
cmnMultiplexerStreambufProxy
(
ChannelType
*output,
cmnLogLevel
level)
101
: OutputChannel(output), LogLevel(level)
102
{}
103
105
cmnLogLevel
GetLOD
(
void
)
const
{
106
return
LogLevel;
107
}
108
110
void
SetLOD
(
cmnLogLevel
level) {
111
LogLevel = level;
112
}
113
115
ChannelType
*
GetOutput
(
void
)
const
{
116
return
OutputChannel;
117
}
118
119
// Here we override the basic_streambuf methods for multiplexing.
120
// This part is declared 'protected' following the declarations of
121
// basic_streambuf. See basic_streambuf documentation for more
122
// details.
123
protected
:
124
126
virtual
std::streamsize
xsputn
(
const
_element * s, std::streamsize n);
127
129
virtual
int
sync
(
void
);
130
135
virtual
int_type
overflow
(
int_type
c = _trait::eof());
136
137
138
private
:
139
ChannelType
* OutputChannel;
140
cmnLogLevel
LogLevel;
141
142
};
143
144
145
//********************************
146
// Template method implementation
147
//********************************
148
149
151
template
<
class
_element,
class
_trait>
152
std::streamsize
cmnMultiplexerStreambufProxy<_element, _trait>::xsputn
(
const
_element *s, std::streamsize n)
153
{
154
return
OutputChannel->xsputn(s, n, LogLevel);
155
}
156
157
159
template
<
class
_element,
class
_trait>
160
int
cmnMultiplexerStreambufProxy<_element, _trait>::sync
()
161
{
162
return
OutputChannel->sync();
163
}
164
165
170
template
<
class
_element,
class
_trait>
171
typename
cmnMultiplexerStreambufProxy<_element, _trait>::int_type
172
cmnMultiplexerStreambufProxy<_element, _trait>::overflow
(
int_type
c)
173
{
174
return
OutputChannel->overflow(c, LogLevel);
175
}
176
177
178
#endif
// _cmnMultiplexerStreambufProxy_h
cmnLODMultiplexerStreambuf
A Streambuffer class that allows output to multiple streambuf objects for Level of Detail information...
Definition
cmnLODMultiplexerStreambuf.h:109
cmnMultiplexerStreambufProxy::overflow
virtual int_type overflow(int_type c=_trait::eof())
Definition
cmnMultiplexerStreambufProxy.h:172
cmnMultiplexerStreambufProxy::cmnMultiplexerStreambufProxy
cmnMultiplexerStreambufProxy(ChannelType *output, cmnLogLevel level)
Definition
cmnMultiplexerStreambufProxy.h:100
cmnMultiplexerStreambufProxy::xsputn
virtual std::streamsize xsputn(const _element *s, std::streamsize n)
Definition
cmnMultiplexerStreambufProxy.h:152
cmnMultiplexerStreambufProxy::sync
virtual int sync(void)
Definition
cmnMultiplexerStreambufProxy.h:160
cmnMultiplexerStreambufProxy::GetLOD
cmnLogLevel GetLOD(void) const
Definition
cmnMultiplexerStreambufProxy.h:105
cmnMultiplexerStreambufProxy::GetOutput
ChannelType * GetOutput(void) const
Definition
cmnMultiplexerStreambufProxy.h:115
cmnMultiplexerStreambufProxy::int_type
std::basic_streambuf< _element, _trait >::int_type int_type
Definition
cmnMultiplexerStreambufProxy.h:97
cmnMultiplexerStreambufProxy::ChannelType
cmnLODMultiplexerStreambuf< _element, _trait > ChannelType
Definition
cmnMultiplexerStreambufProxy.h:96
cmnMultiplexerStreambufProxy::SetLOD
void SetLOD(cmnLogLevel level)
Definition
cmnMultiplexerStreambufProxy.h:110
cmnLODMultiplexerStreambuf.h
Type Definitions for dynamic control of output messages.
cmnLogLevel
short cmnLogLevel
Definition
cmnLogLoD.h:55
cmnPortability.h
Portability across compilers and operating systems tools.
Generated by
1.18.0