00001 // Cell.h 00002 00003 #ifndef CELL_H 00004 #define CELL_H 00005 00006 #include "Value.h" 00007 00008 namespace Yosokumo 00009 { 00010 00011 /** 00012 * Represents a <code>Value</code> with an associated key or name. 00013 * <ul> 00014 * <li>name when the cell appears in a row (only case seen in the API) 00015 * <li>key when the cell appears in a column 00016 * </ul> 00017 */ 00018 00019 class Cell 00020 { 00021 /** 00022 * A name or a key, depending on the context in which the cell appears. 00023 */ 00024 uint64_t nameOrKey; 00025 /** 00026 * The value of the cell. 00027 */ 00028 Value value; 00029 00030 public: 00031 00032 // Constructors 00033 00034 /** 00035 * Initializes a newly created <code>Cell</code> object with default 00036 * values: 00037 * <ul> 00038 * <li>key - 0 00039 * <li>value - EmptyValue 00040 * </ul> 00041 */ 00042 Cell(); 00043 00044 00045 /** 00046 * Initializes a newly created <code>Cell</code> object with key and value 00047 * specified by the input parameter. 00048 * 00049 * @param nameOrKey the name or key of the cell. 00050 * @param value the value of the cell. 00051 */ 00052 00053 Cell(uint64_t nameOrKey, const Value &value); 00054 00055 // Equality operators 00056 00057 /** 00058 * Equality operator - compare two <code>Cells</code> for equality. 00059 * 00060 * @param rhs the righthand side of the equality. 00061 * 00062 * @return <code>true</code> if and only if <code>this</code> 00063 * <code>Cells</code> and the righthand side 00064 * <code>Cells</code> are identically equal. 00065 */ 00066 bool operator==(const Cell &rhs) const; 00067 00068 /** 00069 * Inequality operator - compare two <code>Cells</code> for inequality. 00070 * 00071 * @param rhs the righthand side of the inequality. 00072 * 00073 * @return <code>true</code> if and only if <code>this</code> 00074 * <code>Cells</code> and the righthand side 00075 * <code>Cells</code> are not identically equal. 00076 */ 00077 bool operator!=(const Cell &rhs) const; 00078 00079 // Setters and getters 00080 00081 /** 00082 * Set the name of the cell. 00083 * 00084 * @param name the new name to assign to the cell. 00085 */ 00086 void setName(uint64_t name); 00087 00088 /** 00089 * Return the name of the cell. 00090 * 00091 * @return the name of the cell. 00092 */ 00093 uint64_t getName() const; 00094 00095 /** 00096 * Set the key of the cell. 00097 * 00098 * @param key the new key to assign to the cell. 00099 */ 00100 void setKey(uint64_t key); 00101 00102 /** 00103 * Return the key of the cell. 00104 * 00105 * @return the key of the cell. 00106 */ 00107 uint64_t getKey() const; 00108 00109 /** 00110 * Set the value of the cell. 00111 * 00112 * @param value the new value to assign to the cell. 00113 */ 00114 void setValue(const Value &value); 00115 00116 /** 00117 * Return the value of the cell. 00118 * 00119 * @return the value of the cell. 00120 */ 00121 Value getValue() const; 00122 00123 /** 00124 * Return a string representation of this <code>Cell</code>. 00125 * 00126 * @return the string representation of this <code>Cell</code>. 00127 */ 00128 std::string toString() const; 00129 00130 }; // end class Cell 00131 00132 } // end namespace Yosokumo 00133 00134 #endif // CELL_H 00135 00136 // end Cell.h