Remove dynamic exceptions
[anna.git] / include / anna / core / oam / Handler.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_core_oam_Handler_hpp
10 #define anna_core_oam_Handler_hpp
11
12
13 #include <anna/core/RuntimeException.hpp>
14
15 // STL
16 #include <string>
17
18 #include <anna/core/oam/defines.hpp>
19
20 #include <cstdarg>
21
22
23 namespace anna {
24
25 namespace oam {
26
27 class Module;
28
29
30 /**
31 * Class used to manage OAM events and registration over a OAM module
32 */
33 class Handler {
34
35 protected:
36
37   /**
38   * Event for counters generated at the module provided. Base implementation trace the event based on #Module::getDefaultCounterDescription.
39   *
40   * Any re-implementation should invoke base class method.
41   *
42   * @param module Reference OAM module.
43   * @param type Counter enum-identification within the own context/module.
44   * @param amount Units increased.
45   *
46   * @return Boolean counter data for 'type' when registered, NULL if not found
47   */
48   virtual const counter_data_t *counterEvent(const Module *module, const int & type, const int & amount) const ;
49
50   /**
51   * Event for alarms generated at the module provided. Base implementation trace the event based on #Module::getDefaultAlarmDescription,
52   * replacing tags '__s__' and '__d__' by '<\%s>' and '<\%d>' (for texts and numbers) if they exists, and parsing with
53   * dynamic variables passed on activateAlarm()/cancelAlarm() prototypes.
54   *
55   * Any re-implementation should invoke base class method.
56   *
57   * @param module Reference OAM module.
58   * @param textPreffix Dynamic alarm modification regarding text preffix.
59   * @param textSuffix Dynamic alarm modification regarding text suffix.
60   * @param textSeparator Dynamic alarm modification regarding text sections separator.
61   * @param Activation activation/cancellation indicator.
62   * @param type Alarm enum-identification within the own context/module.
63   * @param argList Optional parsing data for dynamic-composed text.
64   *
65   * @return Boolean alarm data for 'type' when registered, NULL if not found
66   */
67   virtual const alarm_data_t *alarmEvent(const Module *module, const char *textPreffix, const char *textSuffix, char textSeparator, bool activation, const int & type, va_list argList) const ;
68
69
70 public:
71
72   /**
73    * Constructor
74    */
75   Handler() {;}
76
77   /**
78    * Destructor
79    */
80   ~Handler() {;}
81
82
83   /**
84   * Invokes module counter registration procedure.
85   * Default implementation does nothing specific
86   *
87   * @param module Reference OAM module
88   * @see #anna::oam::Module::registerCounter
89   */
90   virtual void registerCounter(Module *module, const int &type, const std::string &description, const int &offset) noexcept(false) {;}
91
92   /**
93   * Invokes module alarm registration procedure.
94   * Default implementation does nothing specific
95   *
96   * @param module Reference OAM module
97   * @see #anna::oam::Module::registerAlarm
98   */
99   virtual void registerAlarm(Module *module, const int &type, const std::string &description, const int &externalId, const std::string &dynamicVariablesCSL, const int &activationId, const int &cancellationId = -1) noexcept(false) {;}
100
101
102   friend class Module;
103 };
104
105 }
106 }
107
108 #endif
109