PPI: Complete connector implementation
[senf.git] / PPI / DebugModules.hh
1 // $Id$
2 //
3 // Copyright (C) 2007 
4 // Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
5 // Kompetenzzentrum fuer Satelitenkommunikation (SatCom)
6 //     Stefan Bund <g0dil@berlios.de>
7 //
8 // This program is free software; you can redistribute it and/or modify
9 // it under the terms of the GNU General Public License as published by
10 // the Free Software Foundation; either version 2 of the License, or
11 // (at your option) any later version.
12 //
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 // GNU General Public License for more details.
17 //
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the
20 // Free Software Foundation, Inc.,
21 // 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
22
23 /** \file
24     \brief DebugModules public header */
25
26 #ifndef HH_DebugModules_
27 #define HH_DebugModules_ 1
28
29 // Custom includes
30 #include <deque>
31 #include "Packets/Packets.hh"
32 #include "Module.hh"
33
34 //#include "DebugModules.mpp"
35 ///////////////////////////////hh.p////////////////////////////////////////
36
37 namespace senf {
38 namespace ppi {
39 namespace module {
40 namespace debug {
41     
42     class ActivePacketSource
43         : public Module
44     {
45     public:
46         connector::ActiveOutput output;
47
48         ActivePacketSource();
49
50         void submit(Packet packet);
51     };
52
53     class PassivePacketSource
54         : public Module
55     {
56         typedef std::deque<Packet> Queue;
57
58     public:
59         typedef Queue::size_type size_type;
60         
61         PassivePacketSource();
62         
63         connector::PassiveOutput output;
64         
65         void submit(Packet packet);
66
67         bool empty();
68         size_type size();
69
70     private:
71         void request();
72         void init();
73         
74         Queue packets_;
75     };
76
77     class ActivePacketSink
78         : public Module
79     {
80     public:
81         connector::ActiveInput input;
82
83         ActivePacketSink();
84
85         Packet request();
86     };
87
88     class PassivePacketSink
89         : public Module
90     {
91         typedef std::deque<Packet> Queue;
92
93     public:
94         typedef Queue::size_type size_type;
95         typedef Queue::const_iterator iterator;
96
97         connector::PassiveInput input;
98         
99         PassivePacketSink();
100
101         bool empty();
102         size_type size();
103         iterator begin();
104         iterator end();
105
106         Packet back();
107         Packet pop_back();
108
109         void clear();
110
111     private:
112         void request();
113         
114         Queue packets_;
115     };
116
117 }}}}
118
119 ///////////////////////////////hh.e////////////////////////////////////////
120 #include "DebugModules.cci"
121 //#include "DebugModules.ct"
122 //#include "DebugModules.cti"
123 #endif
124
125 \f
126 // Local Variables:
127 // mode: c++
128 // fill-column: 100
129 // comment-column: 40
130 // c-file-style: "senf"
131 // indent-tabs-mode: nil
132 // ispell-local-dictionary: "american"
133 // compile-command: "scons -u test"
134 // End: