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

libFAUDES 2.23h --- 2014.04.03 --- c++ api documentaion by doxygen