libFAUDES

Sections

Index

diag_attrfailuretypes.h

Go to the documentation of this file.
00001 /** @file diag_attrfailuretypes.h
00002     Contains the failure and indicator partition for a system (used as global attribute).
00003 */
00004 
00005 #ifndef DIAG_ATTRFAILURETYPES_H
00006 #define DIAG_ATTRFAILURETYPES_H
00007 
00008 #include <vector>
00009 #include <map>
00010 #include <set>
00011 #include "corefaudes.h"
00012 #include "diag_attrfailureevents.h"
00013 #include "diag_debug.h"
00014 
00015 namespace faudes {
00016 
00017 /**
00018  * Partitions the failure and indicator events.
00019  *
00020  * @ingroup DiagnosisPlugIn
00021  */
00022 class AttributeFailureTypeMap : public AttributeFlags {
00023 
00024 FAUDES_TYPE_DECLARATION(AttributeFailureTypeMap,AttributeFlags)
00025 
00026    public:
00027   /** Failure and indicator event partition. Mapping of failure type indices (as defined in GlobalEventSymbolTable) to associated failure events and indicator events. */
00028   TaNameSet<AttributeFailureEvents> mFailureTypeMap;
00029   
00030   /** Default constructor. */
00031   AttributeFailureTypeMap(void) : AttributeFlags() {
00032     mFailureTypeMap.Name("FailureTypes");
00033     mFailureTypeMap.SymbolTablep(DiagLabelSet::StaticLabelSymbolTablep());
00034   };
00035   
00036   /** Constructor from file. */
00037   AttributeFailureTypeMap(const std::string& rFilename)  : AttributeFlags() {
00038     mFailureTypeMap.Name("FailureTypes");
00039     mFailureTypeMap.SymbolTablep(DiagLabelSet::StaticLabelSymbolTablep());
00040     Read(rFilename);
00041   };
00042   
00043   /** Copyconstructor */
00044   AttributeFailureTypeMap(const AttributeFailureTypeMap& rOtherAttr)  : AttributeFlags(rOtherAttr) {
00045     mFailureTypeMap.Name("FailureTypes");
00046     mFailureTypeMap.SymbolTablep(DiagLabelSet::StaticLabelSymbolTablep());
00047     DoAssign(rOtherAttr);
00048   }
00049 
00050   /** Default destructor. */
00051   ~AttributeFailureTypeMap(void) {};
00052 
00053   /**
00054    *  Test for default value.
00055    *
00056    *  @return
00057    *    True for default value
00058    */
00059   bool IsDefault(void) const;
00060   
00061   /**
00062    * Test if mFailureTypeMap is empty.
00063    *
00064    * @return
00065    *   True if empty
00066   */
00067   bool Empty(void) const;
00068 
00069   /**
00070    *  Clears mFailureTypeMap.
00071    */
00072   void Clear(void);
00073 
00074   /**
00075    *  Add a set of failure events to failure type map. 
00076    *  Make sure that you do not insert a failure event which is part of another failure type as well!
00077    *
00078    *  @param failureType
00079    *    Name of failure type
00080    *  @param rfailureEvents
00081    *    Associated failure events
00082    *  @return
00083    *    Index of entry for failure type name in LabelSymbolTable.
00084    *  @exception Exception
00085    *  - Adding failure to LabelSymbolTable failed (id 300).
00086    */
00087   Idx AddFailureTypeMapping(const std::string& failureType, const EventSet& rfailureEvents);
00088   
00089   /**
00090    *  Inserts entire failure type map to mFailureTypeMap.
00091    *
00092    *  @param rFailureMap
00093    *    Mapping of failure type names to failure events
00094    */  
00095   void AddFailureTypeMap(const std::map<std::string,EventSet>& rFailureMap);
00096   
00097   /**
00098    *  Returns failure type of failure event.
00099    *
00100    *  @param failureEvent
00101    *    Index of failure event.
00102    *  @return
00103    *    Index of failure type.
00104    */
00105   Idx FailureType(Idx failureEvent) const;
00106   
00107   /**
00108    *  Obtain all failure events in mFailureTypeMap.
00109    *
00110    *  @return
00111    *    EventSet containing all failure events.
00112    */
00113   EventSet AllFailureEvents(void) const;
00114   
00115  protected:
00116   
00117   /**
00118    *  Write mFailureTypeMap to TokenWriter.
00119    *
00120    *  @param rTw
00121    *    Reference to TokenWriter
00122    *  @param rLabel
00123    *    Is ignored. Failure events are written in a section "FailureEvents" and indicator events in a separate section "IndicatorEvents".
00124    *  @param pContext
00125    *    Write context to provide contextual information
00126    */
00127   void DoWrite(TokenWriter& rTw, const std::string& rLabel = "", const Type* pContext = 0) const;
00128   
00129   /**
00130    *  Read mFailureTypeMap from TokenReader.
00131    *
00132    *  @param rTr
00133    *    Reference to TokenReader
00134    *  @param rLabel
00135    *    Is ignored. Failure events are read from section "FailureEvents" and indicator events from section "IndicatorEvents".
00136    *  @param pContext
00137    *    Write context to provide contextual information
00138    */
00139   void DoRead(TokenReader &rTr, const std::string &rLabel = "", const Type *pContext = 0);
00140   
00141   /**
00142    *  Copy attribute members.
00143    *
00144    *  @param rSrcAttr 
00145    *    Source to copy from
00146    */
00147   AttributeFailureTypeMap& DoAssign(const AttributeFailureTypeMap& rSrcAttr);   
00148 
00149   /**
00150    *  Test equality
00151    *
00152    *  @param rAttr 
00153    *    Other attribute to compare with
00154    */
00155    bool  DoEqual(const AttributeFailureTypeMap& rAttr) const;   
00156 
00157   
00158 }; // class AttributeFailureTypeMap
00159 
00160 
00161 } // namespace faudes
00162 
00163 #endif

libFAUDES 2.14g --- 2009-12-3 --- c++ source docu by doxygen 1.5.6