cboolparimpl.h

00001 //==========================================================================
00002 //   CBOOLPARIMPL.H  - part of
00003 //                     OMNeT++/OMNEST
00004 //            Discrete System Simulation in C++
00005 //
00006 //  Author: Andras Varga
00007 //
00008 //==========================================================================
00009 
00010 /*--------------------------------------------------------------*
00011   Copyright (C) 1992-2008 Andras Varga
00012   Copyright (C) 2006-2008 OpenSim Ltd.
00013 
00014   This file is distributed WITHOUT ANY WARRANTY. See the file
00015   `license' for details on this and other legal matters.
00016 *--------------------------------------------------------------*/
00017 
00018 #ifndef __CBOOLPARIMPL_H
00019 #define __CBOOLPARIMPL_H
00020 
00021 #include "cparimpl.h"
00022 
00023 NAMESPACE_BEGIN
00024 
00031 class SIM_API cBoolParImpl : public cParImpl
00032 {
00033   protected:
00034     // selector: flags & FL_ISEXPR
00035     union {
00036       cExpression *expr;
00037       bool val;
00038     };
00039 
00040   private:
00041     void copy(const cBoolParImpl& other);
00042 
00043   protected:
00044     void deleteOld();
00045 
00046   public:
00049 
00053     explicit cBoolParImpl();
00054 
00058     cBoolParImpl(const cBoolParImpl& other) : cParImpl(other) {copy(other);}
00059 
00063     virtual ~cBoolParImpl();
00064 
00068     void operator=(const cBoolParImpl& otherpar);
00070 
00073 
00077     virtual cBoolParImpl *dup() const  {return new cBoolParImpl(*this);}
00078 
00082     virtual void parsimPack(cCommBuffer *buffer);
00083 
00087     virtual void parsimUnpack(cCommBuffer *buffer);
00089 
00092 
00096     virtual void setBoolValue(bool b);
00097 
00101     virtual void setLongValue(long l);
00102 
00106     virtual void setDoubleValue(double d);
00107 
00111     virtual void setStringValue(const char *s);
00112 
00116     virtual void setXMLValue(cXMLElement *node);
00117 
00122     virtual void setExpression(cExpression *e);
00124 
00127 
00131     virtual bool boolValue(cComponent *context) const;
00132 
00136     virtual long longValue(cComponent *context) const;
00137 
00141     virtual double doubleValue(cComponent *context) const;
00142 
00146     virtual const char *stringValue(cComponent *context) const;
00147 
00151     virtual std::string stdstringValue(cComponent *context) const;
00152 
00156     virtual cXMLElement *xmlValue(cComponent *context) const;
00157 
00161     virtual cExpression *getExpression() const;
00163 
00166 
00170     virtual Type getType() const;
00171 
00175     virtual bool isNumeric() const;
00177 
00180 
00185     virtual void convertToConst(cComponent *context);
00186 
00190     virtual std::string str() const;
00191 
00195     virtual void parse(const char *text);
00196 
00200     virtual int compare(const cParImpl *other) const;
00202 };
00203 
00204 NAMESPACE_END
00205 
00206 
00207 #endif
00208 
00209 
Generated on Tue Dec 2 11:16:27 2014 for OMNeT++ Simulation Library by  doxygen 1.6.3