Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

vartype.h
Go to the documentation of this file.
1 
30 #pragma once
31 
33 
34 namespace abacus {
35 
36 
38 
43 class VarType : public AbacusRoot {
44 public:
45 
47  enum TYPE {
51  };
52 
54  VarType() { }
55 
57 
60  VarType(TYPE t) : type_(t) { }
61 
63 
72  friend std::ostream &operator<<(std::ostream &out, const VarType &rhs);
73 
75  TYPE type() const { return type_; }
76 
77 
79 
82  void type(TYPE t) { type_ = t; }
83 
84 
86  bool discrete() const { return (type_ != Continuous); }
87 
88 
90  bool binary() const { return (type_ == Binary); }
91 
92 
94  bool integer() const { return (type_ == Integer); }
95 
96 private:
97 
99 };
100 
101 }
abacus::VarType
Variable types.
Definition: vartype.h:43
abacus::VarType::Integer
@ Integer
A general integer variable.
Definition: vartype.h:49
abacusroot.h
abacus
Definition: abacusroot.h:48
abacus::VarType::type
void type(TYPE t)
Sets the variable type to t.
Definition: vartype.h:82
abacus::VarType::binary
bool binary() const
Returns true if the type of the variable is Binary, false otherwise.
Definition: vartype.h:90
abacus::VarType::VarType
VarType(TYPE t)
Creates a variable type t.
Definition: vartype.h:60
abacus::VarType::type_
TYPE type_
The type of the variable.
Definition: vartype.h:98
abacus::AbacusRoot
Base class of all other classes of ABACUS.
Definition: abacusroot.h:68
abacus::VarType::type
TYPE type() const
Returns the type of the variable.
Definition: vartype.h:75
abacus::VarType::integer
bool integer() const
Returns true if the type of the variable is Integer, false otherwise.
Definition: vartype.h:94
abacus::VarType::Binary
@ Binary
A variable having value 0 or 1.
Definition: vartype.h:50
abacus::VarType::VarType
VarType()
The default constructor: Lets the type of the variable uninitialized.
Definition: vartype.h:54
abacus::VarType::TYPE
TYPE
The enumeration with the different variable types.
Definition: vartype.h:47
abacus::VarType::operator<<
friend std::ostream & operator<<(std::ostream &out, const VarType &rhs)
Output operator for variable types.
abacus::VarType::Continuous
@ Continuous
A continuous variable.
Definition: vartype.h:48
abacus::VarType::discrete
bool discrete() const
Returns true if the type of the variable is Integer or Binary, false otherwise.
Definition: vartype.h:86