Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members   Related Pages   Examples  

Triple.h

00001 // See the file LICENSE in the some directory as this file for legal
00002 // notices about this software.   
00003 // $Id: Triple_8h-source.html,v 1.7 2001/10/10 20:40:58 sandro Exp $
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     // STANDARD MEMBER FUNCTIONS
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     // (RE)IMPLEMENTATION OF INHERITED MEMBERS
00034 
00035     // CLASS-SPECIFIC PUBLIC INTERFACE
00036 
00040     Triple(Symbol subject, Symbol predicate, Symbol object);
00041     
00043     static const Triple null;
00044     
00045     // STL-style Iteration
00046     typedef Symbol value_type;
00047     typedef value_type const * iterator;   // non-const iterator not allowed
00048     iterator begin() const;
00049     iterator end() const;
00050     size_t size() const;
00051     static const size_t max_elements = 3;
00052     
00053     // (It is possible to do this with operator[] returning an object
00054     // for which operator= is defined, but that seems a bit silly.)
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   /* TRIPLE */  // -*-C++-*-

Home to blindfold. This page generated via doxygen 1.2.11.1 Wed Oct 10 16:40:33 2001.