Remove dynamic exceptions
[anna.git] / include / anna / diameter.comm / ApplicationMessageOamModule.hpp
index c9c5b0d..f3498b5 100644 (file)
@@ -29,10 +29,10 @@ namespace comm {
 
 /**
   Special OAM module which tracks a replica for a set of counter types for each different application message managed by the
-  communication layer in a specific stack id. For example, if one process is managing CCR/A, RAR/A for Gx and AAR/A, RAR/A for Rx,
-  then two counter scopes should be registered (one for Gx, another for Rx). Each scope will store counters sets for each diameter
-  message. Having N counters within each scope (for example N=14), the total capacity is N/(number of counter types) different
-  message codes:
+  communication layer and result code in case of answer, in a specific stack id. For example, if one process is managing CCR/A,
+  RAR/A for Gx and AAR/A, RAR/A for Rx, then two counter scopes should be registered (one for Gx, another for Rx). Each scope
+  will store counters sets for each diameter event (message and optionally result code description). Having N counters within
+  each scope (for example N=14), the total capacity is N/(number of counter types) different events:
 
   <pre>
     Scope for Gx:
@@ -96,11 +96,15 @@ namespace comm {
       Re-Auth-Request_Received_AsServer
       Re-Auth-Answer_Received_AsServer
       Re-Auth-Answer_UnknownReceived_AsServer
+
+    Note: all other combinations including the result code for answers
+          may be dynamically created.
+
   </pre> 
 */
 class ApplicationMessageOamModule : public anna::oam::Module, public anna::Singleton <ApplicationMessageOamModule> {
 
-  std::map<int /* message code */, int /* base offset */> a_messageMap;
+  std::map<std::string /* event id */, int /* base offset */> a_eventMap;
   std::map<unsigned int /* stack id */, int /* scope id */> a_stackMap;
 
   int a_counter_types;
@@ -134,16 +138,22 @@ public:
     anna_declare_enum(Counter);
   };
 
-  /* virtual */std::string getDefaultInternalCounterDescription(const int & counterType) const throw() { return Counter::asCString((Counter::_v)counterType); }
+  /* virtual */std::string getDefaultInternalCounterDescription(const int & counterType) const { return Counter::asCString((Counter::_v)counterType); }
 
   // map stack id with a scope id
-  void createStackCounterScope(int /* scope id */, unsigned int /* stack id */) throw(anna::RuntimeException);
+  void createStackCounterScope(int /* scope id */, unsigned int /* stack id */) noexcept(false);
 
   // translate message code into offset and invoke parent class count method. The message applicationId will be used as stack id
-  void count (int messageCode, unsigned int stackId, const int & type, const int & amount = 1) throw(anna::RuntimeException);
+  // resultCode shall be -1 for non-answers
+  void count (int messageCode, int resultCode, unsigned int stackId, const int & type, const int & amount = 1) noexcept(false);
 
   // Number of different counter types for each message
-  int getCounterTypes() const throw() { return a_counter_types; }
+  int getCounterTypes() const { return a_counter_types; }
+
+  // -1 if multistack 
+  int monoStackScopeId() const {
+    return ((a_stackMap.size() != 1) ? -1 : a_stackMap.begin()->second);
+  }
 
 private: