Fix indentation and style issues in fmAlarmUtils

Several indentation issues were solved, also some style was applied
to improve code's readability.

cpplint is being used to get all these warnings, however there are
some warnings that were suppressed. This means that this file still
has the following issues:

- line length > 80 characters
- C casting in C++ code
- References that can be const or pointers

These issues will be solved in a next iteration as are more intrusive
with the code.

No functionality changes were done.

Story: 2006425
Task: 36322

Change-Id: I4a2d3bcf9a13e0ce2659cc9a8211fc727b34d80e
Signed-off-by: Erich Cordoba <erich.cordoba.malibran@intel.com>
This commit is contained in:
Erich Cordoba 2019-08-23 16:00:53 -05:00
parent 7ff98a067f
commit c905ae2c55
2 changed files with 597 additions and 490 deletions

File diff suppressed because it is too large Load Diff

View File

@ -15,72 +15,80 @@
#include <vector>
enum EFmAlarmIndexMap {
FM_ALM_IX_UUID=0,
FM_ALM_IX_ALARM_ID,
FM_ALM_IX_ALARM_STATE,
FM_ALM_IX_ENTITY_ID,
FM_ALM_IX_INSTANCE_ID,
FM_ALM_IX_TIMESTAMP,
FM_ALM_IX_SEVERITY,
FM_ALM_IX_REASON,
FM_ALM_IX_ALARM_TYPE,
FM_ALM_IX_PROBABLE_CAUSE,
FM_ALM_IX_REPAIR_ACTION,
FM_ALM_IX_SERVICE_AFFECT,
FM_ALM_IX_SUPPRESSION,
FM_ALM_IX_INHIBIT_ALARM,
FM_ALM_IX_MAX
FM_ALM_IX_UUID=0,
FM_ALM_IX_ALARM_ID,
FM_ALM_IX_ALARM_STATE,
FM_ALM_IX_ENTITY_ID,
FM_ALM_IX_INSTANCE_ID,
FM_ALM_IX_TIMESTAMP,
FM_ALM_IX_SEVERITY,
FM_ALM_IX_REASON,
FM_ALM_IX_ALARM_TYPE,
FM_ALM_IX_PROBABLE_CAUSE,
FM_ALM_IX_REPAIR_ACTION,
FM_ALM_IX_SERVICE_AFFECT,
FM_ALM_IX_SUPPRESSION,
FM_ALM_IX_INHIBIT_ALARM,
FM_ALM_IX_MAX
};
enum EFmLogIndexMap {
FM_LOG_IX_UUID=0,
FM_LOG_IX_LOG_ID,
FM_LOG_IX_ENTITY_ID,
FM_LOG_IX_INSTANCE_ID,
FM_LOG_IX_TIMESTAMP,
FM_LOG_IX_SEVERITY,
FM_LOG_IX_REASON,
FM_LOG_IX_LOG_TYPE,
FM_LOG_IX_PROBABLE_CAUSE,
FM_LOG_IX_SERVICE_AFFECT,
FM_LOG_IX_MAX
FM_LOG_IX_UUID=0,
FM_LOG_IX_LOG_ID,
FM_LOG_IX_ENTITY_ID,
FM_LOG_IX_INSTANCE_ID,
FM_LOG_IX_TIMESTAMP,
FM_LOG_IX_SEVERITY,
FM_LOG_IX_REASON,
FM_LOG_IX_LOG_TYPE,
FM_LOG_IX_PROBABLE_CAUSE,
FM_LOG_IX_SERVICE_AFFECT,
FM_LOG_IX_MAX
};
enum EFmEventLogIndexMap {
FM_EVENT_LOG_IX_UUID=0,
FM_EVENT_LOG_IX_EVENT_ID,
FM_EVENT_LOG_IX_STATE,
FM_EVENT_LOG_IX_ENTITY_ID,
FM_EVENT_LOG_IX_INSTANCE_ID,
FM_EVENT_LOG_IX_TIMESTAMP,
FM_EVENT_LOG_IX_SEVERITY,
FM_EVENT_LOG_IX_REASON,
FM_EVENT_LOG_IX_EVENT_TYPE,
FM_EVENT_LOG_IX_PROBABLE_CAUSE,
FM_EVENT_LOG_IX_REPAIR_ACTION,
FM_EVENT_LOG_IX_SERVICE_AFFECT,
FM_EVENT_LOG_IX_SUPPRESSION,
FM_EVENT_LOG_IX_MAX
FM_EVENT_LOG_IX_UUID=0,
FM_EVENT_LOG_IX_EVENT_ID,
FM_EVENT_LOG_IX_STATE,
FM_EVENT_LOG_IX_ENTITY_ID,
FM_EVENT_LOG_IX_INSTANCE_ID,
FM_EVENT_LOG_IX_TIMESTAMP,
FM_EVENT_LOG_IX_SEVERITY,
FM_EVENT_LOG_IX_REASON,
FM_EVENT_LOG_IX_EVENT_TYPE,
FM_EVENT_LOG_IX_PROBABLE_CAUSE,
FM_EVENT_LOG_IX_REPAIR_ACTION,
FM_EVENT_LOG_IX_SERVICE_AFFECT,
FM_EVENT_LOG_IX_SUPPRESSION,
FM_EVENT_LOG_IX_MAX
};
bool fm_alarm_set_field(EFmAlarmIndexMap field, SFmAlarmDataT *a, std::string &val);
bool fm_alarm_get_field(EFmAlarmIndexMap field, const SFmAlarmDataT *a, std::string &val);
bool fm_log_set_field(EFmLogIndexMap field, SFmAlarmDataT *a, std::string &val);
bool fm_event_log_set_field(EFmEventLogIndexMap field, SFmAlarmDataT *a, std::string &val);
void fm_formatted_str_to_vector(const std::string &s, std::vector<std::string> &alarm);
bool fm_alarm_to_string(const SFmAlarmDataT *alarm, std::string &str);
bool fm_alarm_from_string(const std::string &str,SFmAlarmDataT *alarm);
bool fm_alarm_set_field(EFmAlarmIndexMap field, SFmAlarmDataT *a,
std::string &val);
bool fm_alarm_get_field(EFmAlarmIndexMap field, const SFmAlarmDataT *a,
std::string &val);
bool fm_log_set_field(EFmLogIndexMap field, SFmAlarmDataT *a,
std::string &val);
bool fm_event_log_set_field(EFmEventLogIndexMap field, SFmAlarmDataT *a,
std::string &val);
void fm_formatted_str_to_vector(const std::string &s,
std::vector<std::string> &alarm);
bool fm_alarm_to_string(const SFmAlarmDataT *alarm,
std::string &str);
bool fm_alarm_from_string(const std::string &str,
SFmAlarmDataT *alarm);
/**
* This will create an alarm list from an alarm - will translate to string.
* The indexes of this API are based on EFmAlarmIndexMap
*/
void fm_alarm_to_list(const SFmAlarmDataT *a, std::vector<std::string> &list);
bool fm_alarm_filter_to_string(const AlarmFilter *alarm, std::string &str);
bool fm_alarm_filter_from_string(const std::string &str, AlarmFilter *alarm);
void fm_alarm_to_list(const SFmAlarmDataT *a,
std::vector<std::string> &list);
bool fm_alarm_filter_to_string(const AlarmFilter *alarm,
std::string &str);
bool fm_alarm_filter_from_string(const std::string &str,
AlarmFilter *alarm);
/**
* Generate a FM UUID