diag_attrfailureevents.cpp
Go to the documentation of this file.
1 /** @file diag_attrfailureevents.cpp
2  Implements failure and indicator events belonging to a common partition.
3 */
4 
6 
7 using namespace std;
8 
9 namespace faudes {
10 
11 // faudes type std
12 FAUDES_TYPE_IMPLEMENTATION(Void,AttributeFailureEvents,AttributeFlags)
13 
14 // Construct
16  // configure unregistered set type
17  mFailureEvents.Name("FailureEvents");
18  mFailureEvents.TypeName("FailureEvents");
19  mFailureEvents.XElementTag("Event");
20  mIndicatorEvents.Name("IndicatorEvents");
21  mIndicatorEvents.TypeName("IndicatorEvents");
22  mIndicatorEvents.XElementTag("Event");
23 }
24 
25 
26 // DoAssign()
27 void AttributeFailureEvents::DoAssign(const AttributeFailureEvents& rSrcAttr){
28  AttributeFlags::DoAssign(rSrcAttr);
29  mFailureEvents = rSrcAttr.mFailureEvents;
30  mIndicatorEvents = rSrcAttr.mIndicatorEvents;
31 }
32 
33 
34 // Equality
35 bool AttributeFailureEvents::DoEuqal(const AttributeFailureEvents& rAttr) const {
36  // test base
37  if(!AttributeFlags::DoEqual(rAttr)) return false;
38  // my members
39  if(mFailureEvents!=rAttr.mFailureEvents) return false;
40  if(mIndicatorEvents!=rAttr.mIndicatorEvents) return false;
41  // pass
42  return true;
43 }
44 
45 // IsDefault()
46 bool AttributeFailureEvents::IsDefault(void) const{
47  return (mFailureEvents.Empty() && mIndicatorEvents.Empty());
48 }
49 
50 // Clear()
51 void AttributeFailureEvents::Clear(void) {
52  mFailureEvents.Clear();
53  mIndicatorEvents.Clear();
54 }
55 
56 // DoWrite()
57 void AttributeFailureEvents::DoWrite(TokenWriter& rTw, const std::string& rLabel, const Type* pContext) const {
58  if(IsDefault()) return;
59  AttributeFlags::DoWrite(rTw,"",pContext);
60  if(!mFailureEvents.Empty())
61  mFailureEvents.Write(rTw,"FailureEvents", pContext);
62  if(!mIndicatorEvents.Empty())
63  mIndicatorEvents.Write(rTw,"IndicatorEvents", pContext);
64 }
65 
66 // DoXWrite()
67 void AttributeFailureEvents::DoXWrite(TokenWriter& rTw, const std::string& rLabel, const Type* pContext) const {
68  if(IsDefault()) return;
69  AttributeFlags::DoXWrite(rTw,"",pContext);
70  if(!mFailureEvents.Empty())
71  mFailureEvents.XWrite(rTw,"FailureEvents", pContext);
72  if(!mIndicatorEvents.Empty())
73  mIndicatorEvents.XWrite(rTw,"IndicatorEvents", pContext);
74 }
75 
76 
77 
78 // DoRead()
79 void AttributeFailureEvents::DoRead(TokenReader &rTr, const std::string &rLabel, const Type *pContext) {
80  AttributeFlags::DoRead(rTr,"",pContext);
81  Token token;
82  while(1) {
83  rTr.Peek(token);
84  if(token.Type()!=Token::Begin) break;
85  if(token.StringValue()=="FailureEvents") {
86  mFailureEvents.Read(rTr, "FailureEvents", pContext);
87  continue;
88  }
89  if(token.StringValue()=="IndicatorEvents") {
90  mIndicatorEvents.Read(rTr, "IndicatorEvents", pContext);
91  continue;
92  }
93  break;
94  }
95 }
96 
97 
98 } // namespace faudes
99 
#define FAUDES_TYPE_IMPLEMENTATION(ftype, ctype, cbase)
faudes type implementation macros, overall
Definition: cfl_types.h:946
Stores the failure and indicator events for a particular failure type.
EventSet mIndicatorEvents
Set of indicator events.
EventSet mFailureEvents
Set of failure events.
A TokenReader reads sequential tokens from a file or string.
bool Peek(Token &token)
Peek next token.
A TokenWriter writes sequential tokens to a file, a string or stdout.
Tokens model atomic data for stream IO.
Definition: cfl_token.h:53
const std::string & StringValue(void) const
Get string value of a name token.
Definition: cfl_token.cpp:177
TokenType Type(void) const
Get token Type.
Definition: cfl_token.cpp:198
Base class of all libFAUDES objects that participate in the run-time interface.
Definition: cfl_types.h:239
virtual void Name(const std::string &rName)
Set the objects's name.
Definition: cfl_types.cpp:117
Failure and indicator events for a common failure type.
virtual void Clear(void)
Clear all set.
Definition: cfl_baseset.h:1902
libFAUDES resides within the namespace faudes.

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