00001 00034 #ifndef ABA_VARTYPE_H 00035 #define ABA_VARTYPE_H 00036 #include <iostream> 00037 using namespace std; 00038 00039 #include "abacus/abacusroot.h" 00040 00041 #ifdef ABACUS_PARALLEL 00042 class ABA_MESSAGE; 00043 #endif 00044 00045 class ABA_VARTYPE : public ABA_ABACUSROOT { 00046 public: 00047 00054 enum TYPE {Continuous, Integer, Binary}; 00055 00059 ABA_VARTYPE(); 00060 00065 ABA_VARTYPE(TYPE t); 00066 #ifdef ABACUS_PARALLEL 00067 00073 ABA_VARTYPE(ABA_MESSAGE &msg); 00074 00079 void pack(ABA_MESSAGE &msg) const; 00080 #endif 00081 00091 friend ostream &operator<<(ostream &out, const ABA_VARTYPE &rhs); 00092 00095 TYPE type() const; 00096 00101 void type(TYPE t); 00102 00106 bool discrete() const; 00107 00111 bool binary() const; 00112 00116 bool integer() const; 00117 00118 private: 00119 00122 TYPE type_; 00123 }; 00124 00125 00126 inline ABA_VARTYPE::ABA_VARTYPE() 00127 00128 { } 00129 00130 inline ABA_VARTYPE::ABA_VARTYPE(TYPE t) 00131 : 00132 type_(t) 00133 { } 00134 00135 inline ABA_VARTYPE::TYPE ABA_VARTYPE::type() const 00136 { 00137 return type_; 00138 } 00139 00140 inline void ABA_VARTYPE::type(TYPE t) 00141 { 00142 type_ = t; 00143 } 00144 00145 inline bool ABA_VARTYPE::discrete() const 00146 { 00147 if (type_ == Continuous) return false; 00148 else return true; 00149 } 00150 00151 inline bool ABA_VARTYPE::binary() const 00152 { 00153 if (type_ == Binary) return true; 00154 else return false; 00155 } 00156 00157 00158 #endif // ABA_VARTYPE_H 00159 00160