~ubuntu-branches/ubuntu/trusty/atlas-cpp/trusty-proposed

« back to all changes in this revision

Viewing changes to Atlas/Net/Loopback.cc

  • Committer: Bazaar Package Importer
  • Author(s): Michael Koch
  • Date: 2004-05-17 12:06:45 UTC
  • Revision ID: james.westby@ubuntu.com-20040517120645-5f8bi2a6n27ydjwi
Tags: upstream-0.4.93
ImportĀ upstreamĀ versionĀ 0.4.93

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// This file may be redistributed and modified only under the terms of
 
2
// the GNU Lesser General Public License (See COPYING for details).
 
3
// Copyright (C) 2000 Michael Day
 
4
 
 
5
#include <Atlas/Net/Loopback.h>
 
6
#include <Atlas/Bridge.h>
 
7
 
 
8
using Atlas::Bridge;
 
9
 
 
10
class LoopBridge : public Bridge
 
11
{
 
12
    public:
 
13
 
 
14
    LoopBridge(Bridge* bridge) : bridge(bridge) { }
 
15
    
 
16
    virtual void streamBegin()
 
17
    {
 
18
        bridge->streamBegin();
 
19
    }
 
20
    
 
21
    virtual void streamMessage(const Map&)
 
22
    {
 
23
        bridge->streamMessage(MapBegin);
 
24
    }
 
25
    
 
26
    virtual void streamEnd()
 
27
    {
 
28
        bridge->streamEnd();
 
29
    }
 
30
 
 
31
    virtual void mapItem(const std::string& name, const Map&)
 
32
    {
 
33
        bridge->mapItem(name, MapBegin);
 
34
    }
 
35
    
 
36
    virtual void mapItem(const std::string& name, const List&)
 
37
    {
 
38
        bridge->mapItem(name, ListBegin);
 
39
    }
 
40
    
 
41
    virtual void mapItem(const std::string& name, long data)
 
42
    {
 
43
        bridge->mapItem(name, data);
 
44
    }
 
45
    
 
46
    virtual void mapItem(const std::string& name, double data)
 
47
    {
 
48
        bridge->mapItem(name, data);
 
49
    }
 
50
 
 
51
    virtual void mapItem(const std::string& name, const std::string& data)
 
52
    {
 
53
        bridge->mapItem(name, data);
 
54
    }
 
55
    
 
56
    virtual void mapEnd()
 
57
    {
 
58
        bridge->mapEnd();
 
59
    }
 
60
    
 
61
    virtual void listItem(const Map&)
 
62
    {
 
63
        bridge->listItem(MapBegin);
 
64
    }
 
65
    
 
66
    virtual void listItem(const List&)
 
67
    {
 
68
        bridge->listItem(ListBegin);
 
69
    }
 
70
    
 
71
    virtual void listItem(long data)
 
72
    {
 
73
        bridge->listItem(data);
 
74
    }
 
75
    
 
76
    virtual void listItem(double data)
 
77
    {
 
78
        bridge->listItem(data);
 
79
    }
 
80
    
 
81
    virtual void listItem(const std::string& data)
 
82
    {
 
83
        bridge->listItem(data);
 
84
    }
 
85
    
 
86
    virtual void listEnd()
 
87
    {
 
88
        bridge->listEnd();
 
89
    }
 
90
 
 
91
    private:
 
92
 
 
93
    Bridge* bridge;
 
94
};
 
95
 
 
96
void Atlas::Net::Loopback(Bridge* d1, Bridge* d2, Bridge*& e1, Bridge*& e2)
 
97
{
 
98
    e1 = new LoopBridge(d1);
 
99
    e2 = new LoopBridge(d2);
 
100
}