2011CaoTme7: LogicValue.h

File LogicValue.h, 1.1 KB (added by jpc, 14 years ago)

C++ header de la classe LogicValue

Line 
1
2#ifndef __LOGICVALUE_H__
3#define __LOGICVALUE_H__
4
5#include <iostream>
6
7
8class LogicValue {
9 public:
10 enum Value { Zero=0, One=1, Undefined=2 };
11 public:
12 LogicValue ();
13 LogicValue ( int );
14 ~LogicValue ();
15 void print ( std::ostream& ) const;
16 int toInt () const;
17 void fromInt ( int );
18 private:
19 Value _value;
20
21 friend bool operator == ( const LogicValue& lhs, const LogicValue& rhs );
22 friend bool operator != ( const LogicValue& lhs, const LogicValue& rhs );
23};
24
25
26LogicValue operator not ( const LogicValue& lhs );
27LogicValue operator and ( const LogicValue& lhs, const LogicValue& rhs );
28LogicValue operator or ( const LogicValue& lhs, const LogicValue& rhs );
29LogicValue operator xor ( const LogicValue& lhs, const LogicValue& rhs );
30bool operator == ( const LogicValue& lhs, const LogicValue& rhs );
31bool operator != ( const LogicValue& lhs, const LogicValue& rhs );
32
33inline std::ostream& operator<< ( std::ostream& o, const LogicValue& v ) { v.print(o); return o; }
34
35#endif // __LOGICVALUE_H__