diag_attrfailuretypes.h
Go to the documentation of this file.
1 /** @file diag_attrfailuretypes.h
2  Contains the failure and indicator partition for a system (used as global attribute).
3 */
4 
5 #ifndef DIAG_ATTRFAILURETYPES_H
6 #define DIAG_ATTRFAILURETYPES_H
7 
8 #include <vector>
9 #include <map>
10 #include <set>
11 #include "corefaudes.h"
12 #include "diag_attrfailureevents.h"
13 #include "diag_debug.h"
14 
15 namespace faudes {
16 
17 /**
18  * Partitions the failure and indicator events.
19  * This attribute is a wrapper to a nameset with failuretype attributes.
20  *
21  * Note: formally derived from AttributeFlags for strategic reasons only
22  *
23  * @ingroup DiagnosisPlugIn
24  */
26 
28 
29  public:
30 
31  /**
32  * Failure and indicator event partition.
33  * Mapping of failure type indices (as defined in GlobalEventSymbolTable)
34  * to associated failure events and indicator events.
35  */
37 
38  /** Default constructor. */
40 
41  /** Constructor from file. */
42  AttributeFailureTypeMap(const std::string& rFilename);
43 
44  /** Copyconstructor */
46 
47  /** Destructor. */
49 
50  /**
51  * Test for default value.
52  *
53  * @return
54  * True for default value
55  */
56  bool IsDefault(void) const;
57 
58  /**
59  * Test if mFailureTypeMap is empty.
60  *
61  * @return
62  * True if empty
63  */
64  bool Empty(void) const;
65 
66  /**
67  * Clears mFailureTypeMap.
68  */
69  void Clear(void);
70 
71  /**
72  * Add a set of failure events to failure type map.
73  * Make sure that you do not insert a failure event which is part of another failure type as well!
74  *
75  * @param failureType
76  * Name of failure type
77  * @param rfailureEvents
78  * Associated failure events
79  * @return
80  * Index of entry for failure type name in LabelSymbolTable.
81  * @exception Exception
82  * - Adding failure to LabelSymbolTable failed (id 300).
83  */
84  Idx AddFailureTypeMapping(const std::string& failureType, const EventSet& rfailureEvents);
85 
86  /**
87  * Inserts entire failure type map to mFailureTypeMap.
88  *
89  * @param rFailureMap
90  * Mapping of failure type names to failure events
91  */
92  void AddFailureTypeMap(const std::map<std::string,EventSet>& rFailureMap);
93 
94  /**
95  * Returns failure type of failure event.
96  *
97  * @param failureEvent
98  * Index of failure event.
99  * @return
100  * Index of failure type.
101  */
102  Idx FailureType(Idx failureEvent) const;
103 
104  /**
105  * Obtain all failure events in mFailureTypeMap.
106  *
107  * @return
108  * EventSet containing all failure events.
109  */
110  EventSet AllFailureEvents(void) const;
111 
112  protected:
113 
114  /**
115  * Write mFailureTypeMap to TokenWriter.
116  *
117  * @param rTw
118  * Reference to TokenWriter
119  * @param rLabel
120  * Is ignored. Failure events are written in a section "FailureEvents" and indicator events in a separate section "IndicatorEvents".
121  * @param pContext
122  * Write context to provide contextual information
123  */
124  void DoWrite(TokenWriter& rTw, const std::string& rLabel = "", const Type* pContext = 0) const;
125 
126  /**
127  * Write mFailureTypeMap to TokenWriter.
128  *
129  * @param rTw
130  * Reference to TokenWriter
131  * @param rLabel
132  * Is ignored. Failure events are written in a section "FailureEvents" and indicator events in a separate section "IndicatorEvents".
133  * @param pContext
134  * Write context to provide contextual information
135  */
136  void DoXWrite(TokenWriter& rTw, const std::string& rLabel = "", const Type* pContext = 0) const;
137 
138  /**
139  * Read mFailureTypeMap from TokenReader.
140  *
141  * @param rTr
142  * Reference to TokenReader
143  * @param rLabel
144  * Is ignored. Failure events are read from section "FailureEvents" and indicator events from section "IndicatorEvents".
145  * @param pContext
146  * Write context to provide contextual information
147  */
148  void DoRead(TokenReader &rTr, const std::string &rLabel = "", const Type *pContext = 0);
149 
150  /**
151  * Copy attribute members.
152  *
153  * @param rSrcAttr
154  * Source to copy from
155  */
156  void DoAssign(const AttributeFailureTypeMap& rSrcAttr);
157 
158  /**
159  * Test equality
160  *
161  * @param rAttr
162  * Other attribute to compare with
163  */
164  bool DoEqual(const AttributeFailureTypeMap& rAttr) const;
165 
166 
167 }; // class AttributeFailureTypeMap
168 
169 
170 } // namespace faudes
171 
172 #endif
#define FAUDES_API
Interface export/import symbols: windows.
Definition: cfl_platform.h:81
#define FAUDES_TYPE_DECLARATION(ftype, ctype, cbase)
faudes type declaration macro
Definition: cfl_types.h:867
Partitions the failure and indicator events.
TaNameSet< AttributeFailureEvents > mFailureTypeMap
Failure and indicator event partition.
Boolean flags Attribute.
Set of indices with symbolic names.
Definition: cfl_nameset.h:69
Set of indices with symbolic names and attributes.
Definition: cfl_nameset.h:564
A TokenReader reads sequential tokens from a file or string.
A TokenWriter writes sequential tokens to a file, a string or stdout.
Base class of all libFAUDES objects that participate in the run-time interface.
Definition: cfl_types.h:239
Includes all libFAUDES headers, no plugins.
Failure and indicator events for a common failure type.
Includes debugging to diagnosis plug-in.
libFAUDES resides within the namespace faudes.
uint32_t Idx
Type definition for index type (allways 32bit)

libFAUDES 2.32b --- 2024.03.01 --- c++ api documentaion by doxygen