New feature to allow to register components with different names for same class:...
[anna.git] / example / diameter / launcher / ProgrammedAnswers.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 example_diameter_launcher_ProgrammedAnswers_hpp
10 #define example_diameter_launcher_ProgrammedAnswers_hpp
11
12 // Standard
13 #include <deque>
14 #include <map>
15 #include <string>
16
17 namespace anna {
18   namespace diameter {
19     namespace codec {
20       class Message;
21       class Engine;
22     }
23   }
24 }
25
26
27 class ProgrammedAnswers {
28
29 typedef std::deque<anna::diameter::codec::Message*> codec_messages_deque;
30 typedef std::deque<anna::diameter::codec::Message*>::iterator codec_messages_deque_iterator;
31 typedef std::deque<anna::diameter::codec::Message*>::const_iterator codec_messages_deque_const_iterator;
32 typedef std::map < int /* message code */, codec_messages_deque* > reacting_answers_container;
33 typedef std::map < int /* message code */, codec_messages_deque* >::iterator  reacting_answers_iterator;
34 typedef std::map < int /* message code */, codec_messages_deque* >::const_iterator  reacting_answers_const_iterator;
35
36   reacting_answers_container a_deques;
37   bool a_rotate;
38   anna::diameter::codec::Engine *a_codecEngine;
39
40   public:
41     ProgrammedAnswers() { a_rotate = false; }
42     ~ProgrammedAnswers() { clear(); }
43
44     void setCodecEngine(anna::diameter::codec::Engine *codecEngine) throw() { a_codecEngine = codecEngine; }
45     bool rotate() const throw() { return a_rotate; }
46     void rotate(bool r) throw() { a_rotate = r; }
47
48     void clear () throw();
49     void dump () throw();
50     void addMessage(int code, anna::diameter::codec::Message *message) throw();
51     anna::diameter::codec::Message* getMessage(int code) const throw();
52     void nextMessage(int code) throw();
53     std::string asString(const char *queueName) const throw();
54 };
55
56 #endif