diag_attrlabelset.cpp

Go to the documentation of this file.
00001 /** @file diag_attrlabelset.cpp
00002 Implements the label representation for state estimates.
00003 */
00004 
00005 #include "diag_attrlabelset.h"
00006 
00007 using namespace std;
00008 
00009 
00010 namespace faudes {
00011 
00012   // my statics
00013 SymbolTable DiagLabelSet::msLabelSymbolTable;
00014 Idx DiagLabelSet::msLabelN = DiagLabelSet::msLabelSymbolTable.InsEntry("N");
00015 Idx DiagLabelSet::msLabelA = DiagLabelSet::msLabelSymbolTable.InsEntry("A");
00016 Idx DiagLabelSet::msLabelRelN = DiagLabelSet::msLabelSymbolTable.InsEntry("relN");
00017 Idx DiagLabelSet::msLabelSpecViolated = DiagLabelSet::msLabelSymbolTable.InsEntry("F");
00018 
00019 // faudes type std
00020 FAUDES_TYPE_IMPLEMENTATION(Void,DiagLabelSet,AttributeFlags)
00021 
00022 
00023 // construct
00024 DiagLabelSet::DiagLabelSet(void) { 
00025   // set my static table
00026   mDiagLabels.SymbolTablep(&msLabelSymbolTable);
00027   FD_DC("DiagLabelSet("<<this<<")::DiagLabelSet() with LabelSymbolTable "<< mDiagLabels.SymbolTablep());
00028   // configure unregistered type 
00029   mDiagLabels.Name("DiagLabels");
00030   mDiagLabels.TypeName("DiagLabels");
00031   mDiagLabels.XElementTag("Label");
00032 }
00033 
00034 // construct and set symbol table
00035 DiagLabelSet::DiagLabelSet(SymbolTable *pSymTab) {
00036   // set specified table
00037   mDiagLabels.SymbolTablep(pSymTab);
00038   FD_DC("DiagLabelSet("<<this<<")::DiagLabelSet() with LabelSymbolTable "<< mDiagLabels.SymbolTablep()); 
00039   // configure unregistered type 
00040   mDiagLabels.Name("DiagLabels");
00041   mDiagLabels.TypeName("DiagLabels");
00042   mDiagLabels.XElementTag("Label");
00043 }
00044 
00045 
00046 // copy my members
00047 void DiagLabelSet::DoAssign(const DiagLabelSet& rSrcAttr) {
00048   AttributeFlags::DoAssign(rSrcAttr); 
00049   mDiagLabels=rSrcAttr.mDiagLabels; 
00050 }
00051 
00052 // equality 
00053 bool DiagLabelSet::DoEqual(const DiagLabelSet& rOtherSet) const {
00054   // call base
00055   if(!AttributeFlags::DoEqual(rOtherSet)) return false;
00056   // test my members
00057   if(mDiagLabels != rOtherSet.mDiagLabels) return false;
00058   // pass
00059   return true;
00060 }
00061 
00062 
00063 // IsDefault()
00064 bool DiagLabelSet::IsDefault(void) const {
00065   return mDiagLabels.Empty();
00066 }
00067 
00068 // StaticLabelSymbolTablep()
00069 SymbolTable* DiagLabelSet::StaticLabelSymbolTablep(void) {
00070   return &msLabelSymbolTable;
00071 }
00072 
00073 // LabelSymbolTablep()
00074 void DiagLabelSet::LabelSymbolTablep(SymbolTable *pSymTab) {
00075   mDiagLabels.SymbolTablep(pSymTab);
00076 }
00077 
00078 // Empty()
00079 bool DiagLabelSet::Empty(void) const {
00080   return mDiagLabels.Empty();
00081 }
00082 
00083 // Size()
00084 Idx DiagLabelSet::Size(void) const {
00085   return mDiagLabels.Size();
00086 }
00087 
00088 // Exists()
00089 bool DiagLabelSet::Exists(Idx index) const {
00090   return mDiagLabels.Exists(index);
00091 }
00092 
00093 // Insert()
00094 bool DiagLabelSet::Insert(Idx index) {
00095   return mDiagLabels.Insert(index);
00096 }
00097 
00098 // InsertSet()
00099 void DiagLabelSet::InsertSet(const DiagLabelSet& rSet) {
00100   mDiagLabels.InsertSet(rSet.mDiagLabels);
00101 }
00102 
00103 // Erase()
00104 bool DiagLabelSet::Erase(Idx index) {
00105   return mDiagLabels.Erase(index);
00106 }
00107 
00108 // Clear()
00109 void DiagLabelSet::Clear(void) {
00110   return mDiagLabels.Clear();
00111 }
00112 
00113 // IndexOfLabelN()
00114 Idx DiagLabelSet::IndexOfLabelN(void) {
00115   return msLabelN;  
00116 }
00117 
00118 // IndexOfLabelA()
00119 Idx DiagLabelSet::IndexOfLabelA(void) {
00120   return msLabelA;  
00121 }
00122 
00123 // IndexOfLabelRelN()
00124 Idx DiagLabelSet::IndexOfLabelRelN(void) {
00125   return msLabelRelN;  
00126 }
00127 
00128 // IndexOfLabelRelN()
00129 Idx DiagLabelSet::IndexOfLabelSpecViolated(void) {
00130   return msLabelSpecViolated;  
00131 }
00132 
00133 // Symbol()
00134 string DiagLabelSet::Symbol(Idx index) {
00135   return msLabelSymbolTable.Symbol(index);  
00136 }
00137 
00138 // PrettyPrintLabelSet()
00139 string DiagLabelSet::Str(void) const {
00140   string str;
00141   NameSet::Iterator it;
00142   for (it = mDiagLabels.Begin(); it != mDiagLabels.End(); it++) {
00143     str += mDiagLabels.SymbolicName(*it);
00144   }    
00145   return str;  
00146 }
00147 
00148 // DoWrite()
00149 void DiagLabelSet::DoWrite(TokenWriter& rTw, const std::string& rLabel, const Type* pContext) const {
00150   if(IsDefault()) return;
00151   mDiagLabels.Write(rTw, "DiagLabels", pContext);
00152 }
00153 
00154 // DoWrite()
00155 void DiagLabelSet::DoXWrite(TokenWriter& rTw, const std::string& rLabel, const Type* pContext) const {
00156   if(IsDefault()) return;
00157   mDiagLabels.XWrite(rTw, "DiagLabels", pContext);
00158 }
00159 
00160 // DoRead()
00161 void DiagLabelSet::DoRead(TokenReader &rTr, const std::string &rLabel, const Type *pContext) {
00162   mDiagLabels.Read(rTr, "DiagLabels", pContext);
00163 }
00164 
00165 // operator *
00166 DiagLabelSet DiagLabelSet::operator * (const DiagLabelSet& rOtherSet) const {
00167   FD_DC("DiagLabelSet(" << this << ")::operator * (" << &rOtherSet << ")");
00168   DiagLabelSet res;
00169   res.mDiagLabels = mDiagLabels * rOtherSet.mDiagLabels;
00170   return res;
00171 }
00172 
00173 // operator +
00174 DiagLabelSet DiagLabelSet::operator + (const DiagLabelSet& rOtherSet) const {
00175   FD_DC("DiagLabelSet(" << this << ")::operator + (" << &rOtherSet << ")");
00176   DiagLabelSet res;
00177   res.mDiagLabels = mDiagLabels + rOtherSet.mDiagLabels;
00178   return res;
00179 }
00180 
00181 // operator -
00182 DiagLabelSet DiagLabelSet::operator - (const DiagLabelSet& rOtherSet) const {
00183   FD_DC("DiagLabelSet(" << this << ")::operator - (" << &rOtherSet << ")");
00184   DiagLabelSet res;
00185   res.mDiagLabels = mDiagLabels - rOtherSet.mDiagLabels;
00186   return res;
00187 }
00188 
00189 
00190 // operator <=
00191 bool DiagLabelSet::operator <= (const DiagLabelSet& rOtherSet) const {
00192   return mDiagLabels.operator <= (rOtherSet.mDiagLabels);
00193 }
00194 
00195 // operator >=
00196 bool DiagLabelSet::operator >= (const DiagLabelSet& rOtherSet) const {
00197   return mDiagLabels.operator >= (rOtherSet.mDiagLabels);
00198 }
00199 
00200 
00201 } // namespace faudes

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