Testing library separation: now not in launcher but isolated
[anna.git] / include / anna / diameter / codec / MessagesDeque.hpp
1 // ANNA - Anna is Not Nothingness Anymore                                                         //
2 //                                                                                                //
3 // (c) Copyright 2005-2015 Eduardo Ramos Testillano & Francisco Ruiz Rayo                         //
4 //                                                                                                //
5 // See project site at http://redmine.teslayout.com/projects/anna-suite                           //
6 // See accompanying file LICENSE or copy at http://www.teslayout.com/projects/public/anna.LICENSE //
7
8
9 #ifndef anna_diameter_codec_MessagesDeque_hpp
10 #define anna_diameter_codec_MessagesDeque_hpp
11
12 // Standard
13 #include <deque>
14 #include <map>
15 #include <string>
16
17 namespace anna {
18 namespace diameter {
19 namespace codec {
20
21
22 class Message;
23
24
25 class MessagesDeque {
26
27 typedef std::deque<anna::diameter::codec::Message*> codec_messages_deque;
28 typedef std::deque<anna::diameter::codec::Message*>::iterator codec_messages_deque_iterator;
29 typedef std::deque<anna::diameter::codec::Message*>::const_iterator codec_messages_deque_const_iterator;
30 typedef std::map < int /* message code */, codec_messages_deque* > messages_container;
31 typedef std::map < int /* message code */, codec_messages_deque* >::iterator  messages_iterator;
32 typedef std::map < int /* message code */, codec_messages_deque* >::const_iterator  messages_const_iterator;
33
34   messages_container a_deques;
35   bool a_rotate;
36
37   public:
38     MessagesDeque() { a_rotate = false; }
39     ~MessagesDeque() { clear(); }
40
41     bool rotate() const throw() { return a_rotate; }
42     void rotate(bool r) throw() { a_rotate = r; }
43
44     void clear () throw();
45     void dump (const char *filenamePrefix = "programmed_message") throw();
46     void addMessage(int code, anna::diameter::codec::Message *message) throw();
47     anna::diameter::codec::Message* getMessage(int code) const throw();
48     void nextMessage(int code) throw();
49     std::string asString(const char *queueName) const throw();
50 };
51
52 }
53 }
54 }
55
56
57 #endif
58