Remove global variables. Factory for comm/codec messages in application class (Launcher)
[anna.git] / example / diameter / launcher / Launcher.hpp
index 9a61627..d550ceb 100644 (file)
@@ -15,6 +15,7 @@
 #include <fstream>
 
 // Project
+#include <anna/core/core.hpp>
 #include <anna/comm/comm.hpp>
 #include <anna/diameter.comm/Entity.hpp>
 #include <anna/time/Date.hpp>
@@ -61,6 +62,10 @@ class Launcher : public anna::comm::Application {
   int a_otaRequest;
   int a_burstPopCounter;
 
+  // comm Messages factory:
+  anna::Recycler<anna::diameter::comm::Message> a_commMessages;
+  anna::Recycler<anna::diameter::codec::Message> a_codecMessages;
+
   anna::comm::ServerSocket* a_httpServerSocket; // HTTP
   MyLocalServer* a_diameterLocalServer; // DIAMETER
   void checkTimeMeasure(const char * commandLineParameter, bool optional = true) throw(anna::RuntimeException);
@@ -90,6 +95,12 @@ public:
   void signalUSR2() throw(anna::RuntimeException);
   std::string help() const throw();
 
+  // Messages factory:
+  anna::diameter::comm::Message *createCommMessage() throw(anna::RuntimeException);
+  void releaseCommMessage(anna::diameter::comm::Message*) throw();
+  anna::diameter::codec::Message *createCodecMessage() throw(anna::RuntimeException);
+  void releaseCodecMessage(anna::diameter::codec::Message*) throw();
+
   // helpers
   bool getDataBlockFromHexFile(const std::string &pathfile, anna::DataBlock &db) const throw();