1 // ANNA - Anna is Not Nothingness Anymore //
3 // (c) Copyright 2005-2015 Eduardo Ramos Testillano & Francisco Ruiz Rayo //
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 //
9 #ifndef anna_core_oam_Configuration_hpp
10 #define anna_core_oam_Configuration_hpp
13 #include <anna/core/Singleton.hpp>
14 #include <anna/core/RuntimeException.hpp>
33 * Class used for general OAM configuration
35 class Configuration : public anna::Singleton <Configuration> {
37 // Post-configuration for the final alarm text used for context data over each module (functionality, logic data, etc.):
38 typedef std::vector<std::string> string_vector_t;
39 string_vector_t a_alarm_text_preffix_components;
40 string_vector_t a_alarm_text_suffix_components;
41 bool a_alarms_preffix_enabled; // Show general alarm preffix
42 bool a_alarms_suffix_enabled; // Show general alarm suffix
45 // Delimiters (zone separator for preffix/text/suffix, and left/right/separator for preffix/suffix):
46 char a_alarm_text_delimiter_zS;
47 std::string a_alarm_text_delimiter_psL;
48 std::string a_alarm_text_delimiter_psS;
49 std::string a_alarm_text_delimiter_psR;
51 const string_vector_t * getAlarmPreffixComponents() const throw() { return (a_alarms_preffix_enabled ? &a_alarm_text_preffix_components : NULL); }
52 const string_vector_t * getAlarmSuffixComponents() const throw() { return (a_alarms_suffix_enabled ? &a_alarm_text_suffix_components : NULL); }
54 void getAlarmTextDelimiters(char & zS, std::string & psL, std::string & psS, std::string & psR) const throw();
57 Configuration(); // private constructor
59 friend class anna::Singleton <Configuration>;
65 * Final detailed alarm text is composed by three parts: preffix, database text and suffix.
66 * To separate these zones, we configure the zone separator (space character by default).
67 * Within preffix/suffix we can configure left, right and separator delimiters (by default,
68 * we use square brackets and pipe):
71 * ------- preffix ------- ------- suffix -------
72 * [ pc1 | pc2 | ... | pcM ] text [ sc1 | sc2 | ... | scN ]
74 * Then, pc[i]/sc[i] are the preffix/suffix components.
75 * Usually, 'pc1' is the application facility name.
76 * Dashes could be used instead of pipe '|' with nice result.
80 * @param zS Zone separator delimiter
81 * @param psL Preffix/Suffix left delimiter
82 * @param psS Preffix/Suffix separator delimiter
83 * @param psR Preffix/Suffix right delimiter
85 void setAlarmTextDelimiters(const char zS, const std::string & psL, const std::string & psS, const std::string & psR) throw();
89 * Optional preffix definition to modify dinamically the alarm texts at context.
90 * This affects to all the management modules. It is usually used on application
91 * start tipically with the facility name, although this information is already
92 * shown at the EG component but easier to identify through that detailed text.
93 * Note that preffix components string should be multilanguage texts.
95 * @param components Preffix components for alarm text
97 void setAlarmPreffixComponents(const std::vector<std::string> & components) throw() { a_alarm_text_preffix_components = components; }
101 * Optional suffix definition to modify dinamically the alarm texts at context.
102 * This affects to all the management modules. It is usually used by application
103 * libraries tipically with the oam module name. However this information could be
104 * only useful for developers, and usually would be set by each oam module.
105 * Note that suffix components string should be multilanguage texts.
107 * @param components Suffix components for alarm text
109 void setAlarmSuffixComponents(const std::vector<std::string> & components) throw() { a_alarm_text_suffix_components = components; }
113 * Show general alarm preffix (enabled by default at constructor).
115 void enableAlarmsPreffix() throw();
119 * Show general alarm suffix (enabled by default at constructor).
121 void enableAlarmsSuffix() throw();
125 * Hide general alarm preffix (enabled by default at constructor).
127 void disableAlarmsPreffix() throw();
131 * Hide general alarm suffix (enabled by default at constructor).
133 void disableAlarmsSuffix() throw();
136 * Class XML representation
138 * @return XML with class content
140 anna::xml::Node* asXML(anna::xml::Node* parent) const throw();