NEW Restruct launcher source code. Separate classes in different files to improve...
[anna.git] / example / diameter / launcher / ProgrammedAnswers.hpp
index e69de29..00b9d4d 100644 (file)
@@ -0,0 +1,53 @@
+// ANNA - Anna is Not Nothingness Anymore                                                         //
+//                                                                                                //
+// (c) Copyright 2005-2015 Eduardo Ramos Testillano & Francisco Ruiz Rayo                         //
+//                                                                                                //
+// See project site at http://redmine.teslayout.com/projects/anna-suite                           //
+// See accompanying file LICENSE or copy at http://www.teslayout.com/projects/public/anna.LICENSE //
+
+
+#ifndef example_diameter_launcher_ProgrammedAnswers_hpp
+#define example_diameter_launcher_ProgrammedAnswers_hpp
+
+// Standard
+#include <deque>
+#include <map>
+#include <string>
+
+namespace anna {
+  namespace diameter {
+    namespace codec {
+      class Message;
+    }
+  }
+}
+
+
+class ProgrammedAnswers {
+
+typedef std::deque<anna::diameter::codec::Message*> codec_messages_deque;
+typedef std::deque<anna::diameter::codec::Message*>::iterator codec_messages_deque_iterator;
+typedef std::deque<anna::diameter::codec::Message*>::const_iterator codec_messages_deque_const_iterator;
+typedef std::map < int /* message code */, codec_messages_deque* > reacting_answers_container;
+typedef std::map < int /* message code */, codec_messages_deque* >::iterator  reacting_answers_iterator;
+typedef std::map < int /* message code */, codec_messages_deque* >::const_iterator  reacting_answers_const_iterator;
+
+  reacting_answers_container a_deques;
+  bool a_rotate;
+
+  public:
+    ProgrammedAnswers() { a_rotate = false; }
+    ~ProgrammedAnswers() { clear(); }
+
+    bool rotate() const throw() { return a_rotate; }
+    void rotate(bool r) throw() { a_rotate = r; }
+
+    void clear () throw();
+    void dump () throw();
+    void addMessage(int code, anna::diameter::codec::Message *message) throw();
+    anna::diameter::codec::Message* getMessage(int code) const throw();
+    void nextMessage(int code) throw();
+    std::string asString(const char *queueName) const throw();
+};
+
+#endif