sp_simeventset.h

Go to the documentation of this file.
00001 
00003 /*
00004    Copyright (C) 2008  Thomas Moor
00005    Exclusive copyright is granted to Klaus Schmidt
00006 */
00007 
00008 
00009 #ifndef FAUDES_SP_SIMEVENTSET_H
00010 #define FAUDES_SP_SIMEVENTSET_H
00011 
00012 #include "tokenreader.h"
00013 #include "tokenwriter.h"
00014 #include "nameset.h"
00015 #include "attributes.h"
00016 #include "cgenerator.h"
00017 #include "tp_timeinterval.h"
00018 #include "tp_timeconstraint.h"
00019 
00020 namespace faudes {
00021 
00022 
00047 class SimPriorityEventAttribute {
00048   public:
00049   long int mPriority;
00050 };
00051 
00073 class  SimStochasticEventAttribute {
00074   public:
00075 
00077   typedef enum {Extern, Trigger, Delay} Type;  
00078   Type mType;             
00079 
00081   std::string static TStr(Type type) { 
00082    if(type == Extern) return "extern"; 
00083    if(type == Trigger) return "trigger"; 
00084    if(type == Delay) return "delay"; 
00085     return "unknown"; 
00086   };
00087 
00089   typedef enum {Exponential,  Uniform, Gauss, Vector} Pdf;  
00090   Pdf mPdf;              
00091 
00093   std::vector<double> mParameter; 
00094 
00095 
00096 };
00097 
00098 
00099 
00100 
00149 class SimEventAttribute : public AttributeCFlags {
00150 
00151   public:
00152 
00154     SimEventAttribute(void) : AttributeCFlags() { mStochastic=false; 
00155       mPriority=true; mPriorityAttribute.mPriority=0;};
00156 
00158     bool IsDefault(void) const {return (!mStochastic) &&
00159        (mPriority && mPriorityAttribute.mPriority==0) && AttributeCFlags::IsDefault(); };
00160 
00162     bool IsStochastic(void) const {return mStochastic; };
00163 
00165     bool IsPriority(void) const {return mPriority; };
00166 
00168     void Stochastic(const SimStochasticEventAttribute&  rStochasticAttribute) {
00169       mStochasticAttribute= rStochasticAttribute; mStochastic=true; mPriority=false;};
00170 
00172     void Priority(const SimPriorityEventAttribute& rPriorityAttribute) {
00173       mPriorityAttribute = rPriorityAttribute; mPriority=true; mStochastic=false; }
00174 
00176     const SimPriorityEventAttribute& Priority(void) const {return mPriorityAttribute; };
00177 
00179     const SimStochasticEventAttribute&  Stochastic(void) const {return mStochasticAttribute; };
00180 
00182     tpTime::Type mScheduledFor;
00183 
00185     tpTime::Type mExpiresAt;
00186 
00188     tpTime::Type mDelayFor;
00189 
00191     TimeInterval mReferenceInterval;
00192  
00193 protected:
00194 
00196     bool mStochastic;
00197 
00199     bool mPriority;
00200 
00202     SimPriorityEventAttribute mPriorityAttribute;
00203 
00205     SimStochasticEventAttribute mStochasticAttribute;
00206 
00225    virtual void DoRead(TokenReader& rTr,const std::string& rLabel="", const Type* pContext=0);
00226  
00243    virtual void DoWrite(TokenWriter& rTw,const std::string& rLabel="", const Type* pContext=0) const;
00244 
00245 
00246 
00247 
00248 }; // class SimEventAttribute
00249 
00250 
00257 typedef TaNameSet<SimEventAttribute> sEventSet;
00258 
00261 } // namespace
00262 
00263 #endif

Generated on Mon Nov 10 08:13:15 2008 for libFAUDES 2.11v by  doxygen 1.4.4