GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  MULTISTREAMBUF (3)

NAME

FBB::MultiStreambuf - Selectively writes multiple streams

CONTENTS

SYNOPSIS

#include <bobcat/multistreambuf>
Linking option: -lbobcat

DESCRIPTION

The FBB::MultiStreambuf class is a specialization of std::streambuf. It can be used to write selectively to multiple std::ostreams. Each std::ostream that is associated with a MultiStreambuf is given a mode-tag indicating whether the stream should always be used when information is inserted into the MultiStreambuf, just once, or not at all. Each of the stream\(cqs mode-tags may be set to any of the defined tag-values.

When the address of a MultiStreambuf is used to initialize a std::ostream the constructed std::ostream becomes an output-multiplexer: by inserting information into the std::ostream object, all std::ostream objects added to its MultiStreambuf buffer which have an active mode receive that information.

An MultiStreambuf object should be outlived by all active streams that are associated with it.

MultiStreambuf objects refer to std::ostreams which are passed to it, and not to their std::streambufs. So it is possible to change these std::ostream\(cqs std::streambufs without reinstalling the std::ostreams themselves.

No assumptions should be made about the order in which the std::ostream objects that are associated with the MultiStreambuf objects are visited when information is inserted.

NAMESPACE

FBB
All constructors, members, operators and manipulators, mentioned in this man-page, are defined in the namespace FBB.

INHERITS FROM

std::streambuf

ENUMERATION

In the Mode enumeration the following values are defined:
o OFF:
A std::ostream having this mode will not be used when information is inserted into a MultiStreambuf
o ON:
A std::ostream having this mode will be used when information is inserted into a MultiStreambuf
o ONCE:
A std::ostream having this mode will be used once, until the next flushing operation, when information is inserted into an MultiStreambuf
o RESET:
A std::ostream having this mode will not be used when information is inserted into a MultiStreambuf. At a flush operation all ONCE modes will be set to RESET
o ALL:
This mode is used in combination with the member remove to remove all std::ostream elements matching a specified std::ostream argument.

TYPES

The following subtypes are defined in the class FBB:MultiStreambuf:
o iterator:
This is a synonym of std::vector<stream>::iterator
o const_iterator:
This is a synonym of std::vector<stream>::const_iterator

NESTED CLASS

The class MultiStreambuf::stream is defined as a nested class of MultiStreambuf. It offers the following constructor and public members:
o stream(std::ostream &os, Mode mode = ON):
The constructor stores a std::ostream object, and associates a Mode value with it.
o void setMode(Mode mode):
This member is used to redefine the stream\(cqs Mode value.
o void mode() const:
This member returns the stream\(cqs Mode value.
o operator std::ostream &():
This member returns the stream\(cqs std::ostream.

CONSTRUCTORS

o MultiStreambuf():
The default constructor creates a MultiStreambuf object which contains no associated std::ostream objects.
o MultiStreambuf(std::ostream &os, Mode mode = ON):
This constructor creates a MultiStreambuf object which is immediately associated with the std::ostream specified as its first argument.
o MultiStreambuf(std::vector<MultiStreambuf::stream> const &osvector):
This constructor creates a MultiStreambuf object which is immediately associated with all std::ostream objects that are stored in the MultiStreambuf::stream elements of the specified vector. The copy constructor is available.

MEMBER FUNCTIONS

All members of std::ostringstream and std::exception are available, as MultiStreambuf inherits from these classes.
o iterator begin():
This member returns an iterator to the first stream element that is stored in a MultiStreambuf object.
o const_iterator begin():
This member returns an iterator to the first (unmodifiable) stream element that is stored in a MultiStreambuf object.
o iterator end():
This member returns an iterator pointing beyond the last stream element that is stored in a MultiStreambuf object.
o const_iterator end():
This member returns an iterator pointing beyond the last (unmodifiable) stream element that is stored in a MultiStreambuf object.
o void insert(std::ostream &os, Mode mode = ON):
This member adds the specified std::ostream using the specified Mode to the current set of stream objects. Note that if called multiple times for identical std::ostreams these objects are inserted multiple times as well.
o void insert(std::vector<stream> const &os):
This member adds all stream objects stored in the os vector to the current set of stream objects.
o bool remove(std::ostream &os, Mode mode = ONCE):
If os is stored in the MultiStreambuf it is removed, and true is returned. If mode ALL is specified all os objects that were stored in the MultiStreambuf object are removed (and true is returned). If the os object was not stored false is returned. To determine whether os has been stored in the MultiStreambuf object its address is compared to the addresses of the std::ostream objects that are stored inside the MultiStreambuf object: the object(s) having addresses &os is (are) removed.
o void void setOnce():
This member will reset all the RESET Mode values of the stored stream objects to ONCE.
o size_t size() const:
The number of streams currently serviced by the MultiStreambuf object is returned.

PROTECTED MEMBER FUNCTION

The member listed in this section implements the tasks of the comparably named virtual function in the class\(cqs private interface. This separates the redefinable interface from the user-interface. The class MultiStreamBuf can, in accordance with Liskov\(cqs Substitution Principle, be used as a std:streambuf; but it also offers a facility for classes deriving from MultiStreamBuf. This facility is listed here.
o int pSync():
The contents of the MultiStreamBuf\(cqs internal buffer is written to each of the std::ostream objects to which the MultiStreamBuf object has access.

EXAMPLE

#include <iostream> #include <fstream> #include <bobcat/multistreambuf>

using namespace std; using namespace FBB;

int main() { MultiStreambuf msb(cout); ostream os(&msb); ofstream out(\(dqout\(dq);

msb.insert(out, MultiStreambuf::ONCE);

os << \(dqThis is on cout and out\(dq << endl; os << \(dqThis is on cout only\(dq << endl;

msb.setOnce(); os << \(dqThis is on cout and out\(dq << endl; os << \(dqThis is on cout only\(dq << endl;

return 0; }

FILES

bobcat/multistreambuf - defines the class interface

SEE ALSO

bobcat(7)

BUGS

None Reported.

DISTRIBUTION FILES

o bobcat_3.25.01-x.dsc: detached signature;
o bobcat_3.25.01-x.tar.gz: source archive;
o bobcat_3.25.01-x_i386.changes: change log;
o libbobcat1_3.25.01-x_*.deb: debian package holding the libraries;
o libbobcat1-dev_3.25.01-x_*.deb: debian package holding the libraries, headers and manual pages;
o http://sourceforge.net/projects/bobcat: public archive location;

BOBCAT

Bobcat is an acronym of ‘Brokken\(cqs Own Base Classes And Templates\(cq.

COPYRIGHT

This is free software, distributed under the terms of the GNU General Public License (GPL).

AUTHOR

Frank B. Brokken (f.b.brokken@rug.nl).

Search for    or go to Top of page |  Section 3 |  Main Index


libbobcat-dev_3&.25&.01-x&.tar&.gz FBB::MULTISTREAMBUF (3bobcat) 2005-2015

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.