BOSS 7.0.2
BESIII Offline Software System
Loading...
Searching...
No Matches
Stream.cxx
Go to the documentation of this file.
1/*
2 * Stream.cxx
3 * ers
4 *
5 * Created by Matthias Wiesmann on 01.12.04.
6 * Copyright 2004 CERN. All rights reserved.
7 *
8 */
9
10#include <iostream>
11#include <sstream>
12
13#include "ers/Issue.h"
14#include "ers/StreamFactory.h"
15
16const char* const ers::Stream::NULL_STREAM_KEY = "null" ;
17
18namespace {
19 ers::Stream *create_stream(const std::string &protocol, const std::string &uri) {
20 (void) uri ;
21 if (protocol==ers::Stream::NULL_STREAM_KEY) return new ers::Stream() ;
22 return 0 ;
23 }
25} // anonymous namespace
26
27// --------------
28// Member methods
29// --------------
30
34
35ers::Stream::operator std::string() const {
36 std::ostringstream stream ;
37 print_to(stream);
38 return stream.str();
39} // to string
40
41/** Sends the issue to the stream.
42 * \param i the issue to send
43 * \note This implementation silently discards the Issue
44 */
45
46void ers::Stream::send(const Issue *i) {
47 (void) i ;
48} // send
49
50/** Reads an isssue on the stream
51 * \return the issue that has been read
52 * \note This implementation always returns a null pointer
53 */
54
56 return 0 ;
57} // receive
58
59void ers::Stream::print_to(std::ostream& stream) const {
60 stream << NULL_STREAM_KEY << ':' ;
61} // print_to
62
63std::ostream& ers::operator<<(std::ostream& target, const ers::Stream & s) {
64 s.print_to(target);
65 return target ;
66} // operator<<
67
68
69
XmlRpcServer s
Definition: HelloServer.cpp:11
bool register_factory(const std::string &name, create_stream_callback callback)
register a factory method
static StreamFactory * instance()
return the singleton
Root/Null issue stream.
virtual ~Stream()
Definition: Stream.cxx:33
virtual void print_to(std::ostream &stream) const
Definition: Stream.cxx:59
virtual void send(const Issue *i)
Sends an issue into the stream.
Definition: Stream.cxx:46
virtual Issue * receive()
Receives an issue from the stream.
Definition: Stream.cxx:55
static const char *const NULL_STREAM_KEY
std::ostream & operator<<(std::ostream &, const Issue &)