5545871c49c51ed41922b098d25d0acd0bf9cdc8
[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         
73         Queue packets_;
74     };
75
76     class ActivePacketSink
77         : public Module
78     {
79     public:
80         connector::ActiveInput input;
81
82         ActivePacketSink();
83
84         Packet request();
85     };
86
87     class PassivePacketSink
88         : public Module
89     {
90         typedef std::deque<Packet> Queue;
91
92     public:
93         typedef Queue::size_type size_type;
94         typedef Queue::const_iterator iterator;
95
96         connector::PassiveInput input;
97         
98         PassivePacketSink();
99
100         bool empty();
101         size_type size();
102         iterator begin();
103         iterator end();
104
105         Packet back();
106         Packet pop_back();
107
108         void clear();
109
110     private:
111         void request();
112         
113         Queue packets_;
114     };
115
116 }}}}
117
118 ///////////////////////////////hh.e////////////////////////////////////////
119 #include "DebugModules.cci"
120 //#include "DebugModules.ct"
121 //#include "DebugModules.cti"
122 #endif
123
124 \f
125 // Local Variables:
126 // mode: c++
127 // fill-column: 100
128 // comment-column: 40
129 // c-file-style: "senf"
130 // indent-tabs-mode: nil
131 // ispell-local-dictionary: "american"
132 // compile-command: "scons -u test"
133 // End: