00001
00002
00003
00004 #ifndef DEV_W3_ORG__2001_BLINDFOLD_SRC_TRIPLE_H
00005 #define DEV_W3_ORG__2001_BLINDFOLD_SRC_TRIPLE_H
00006 #include "config.h"
00007
00008 #include "Symbol.h"
00009
00018 class Triple {
00019
00020 public:
00021
00022
00023 Triple();
00024 Triple(const Triple& other);
00025 const Triple& operator=(const Triple& other);
00026 bool operator==(const Triple& other) const;
00027 bool operator<(const Triple& other) const;
00028 size_t hash() const;
00029 friend std::ostream& operator<<(std::ostream& s, const Triple& me);
00030 std::ostream& print_to(std::ostream& stream) const;
00031 ~Triple();
00032
00033
00034
00035
00036
00040 Triple(Symbol subject, Symbol predicate, Symbol object);
00041
00043 static const Triple null;
00044
00045
00046 typedef Symbol value_type;
00047 typedef value_type const * iterator;
00048 iterator begin() const;
00049 iterator end() const;
00050 size_t size() const;
00051 static const size_t max_elements = 3;
00052
00053
00054
00058 Symbol get(size_t index) const;
00059
00063 void set(size_t index, value_type symbol);
00064
00068 void clear();
00069
00070 operator bool() const { return data[0] || data[1] || data[2]; }
00071
00072 private:
00073
00074 Symbol data[max_elements];
00075 unsigned int _size;
00076
00077 };
00078
00079
00080
00081 STANDARD_EXTERNAL(Triple)
00082
00083 #endif