77#ifndef LASS_GUARDIAN_OF_INCLUSION_IO_PROXY_O_STREAM_H
78#define LASS_GUARDIAN_OF_INCLUSION_IO_PROXY_O_STREAM_H
84#if LASS_COMPILER_TYPE == LASS_COMPILER_TYPE_MSVC
86# pragma warning(disable: 4267)
102 typedef unsigned TMask;
104 ProxyOStreamLock(ProxyOStream* proxy, TMask messageMask);
105 ProxyOStreamLock(
const ProxyOStreamLock&) =
delete;
106 ProxyOStreamLock(ProxyOStreamLock&& other);
109 ProxyOStreamLock & operator=(
const ProxyOStreamLock&) =
delete;
110 ProxyOStreamLock & operator=(ProxyOStreamLock&&) =
delete;
112 template <
typename T> ProxyOStreamLock& operator<< (
const T& x);
113 ProxyOStreamLock& operator<<(std::ostream& (*x) (std::ostream&));
116 ProxyOStream* proxy_;
127 typedef unsigned TMask;
128 static const TMask acceptAll =
static_cast<TMask
>(-1);
133 ProxyOStream(std::ostream* destination = &std::cout, TMask filterMask = acceptAll);
135 void add(std::ostream* destination, TMask filterMask = acceptAll);
136 void remove(std::ostream* destination);
138 TMask
filter(std::ostream* destination)
const;
139 void setFilter(std::ostream* destination, TMask filterMask);
141 impl::ProxyOStreamLock operator()(TMask filterMask = acceptAll);
147 template <
typename T> impl::ProxyOStreamLock operator<< (
const T& x)
149 impl::ProxyOStreamLock result(
this, acceptAll);
154 impl::ProxyOStreamLock operator<< (std::ostream& (*x) (std::ostream&));
159 friend class impl::ProxyOStreamLock;
163 std::ostream* stream;
167 typedef std::vector<Destination> TDestinations;
169 TDestinations::iterator findStream(std::ostream* stream);
171 TDestinations destinations_;
183ProxyOStreamLock& ProxyOStreamLock::operator<< (
const T& x)
187 for (ProxyOStream::TDestinations::iterator i = proxy_->destinations_.begin(), end = proxy_->destinations_.end(); i != end; ++i)
191 LASS_ENFORCE_STREAM(*(i->stream)) << x;
204#if LASS_COMPILER_TYPE == LASS_COMPILER_TYPE_MSVC
A proxy output stream can distribute output to multiple destination streams.
void add(std::ostream *destination, TMask filterMask=acceptAll)
Add a std::ostream to the list of destination streams.
TMask filter(std::ostream *destination) const
Return accept mask on destination stream.
void setFilter(std::ostream *destination, TMask filterMask)
Set filter on destination stream.
ProxyOStream(std::ostream *destination=&std::cout, TMask filterMask=acceptAll)
Construct a proxy with a destination, and set a filter for it.
void remove(std::ostream *destination)
Remove a std::ostream from the list of destination streams.
bool checkMaskedSome(T a_bits, const T &a_mask)
Check the masked bits and return true if at least one is set.
#define LASS_DLL
DLL interface: import or export symbols?
streams, binary streams, vrmlstreams, ...
Library for Assembled Shared Sources.