symbol.icc
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042 #include <iostream>
00043
00044 namespace Gecode { namespace Support {
00045
00049 class GECODE_SUPPORT_EXPORT Symbol {
00050 private:
00051
00055 class SO {
00056 public:
00058 static char* strdup(const char* s);
00060 unsigned int use_cnt;
00062 bool cancel(void);
00064 void subscribe(void);
00065
00067 char* s;
00069 bool own;
00070
00072 SO(const char* s0, bool copy);
00074 void append(SO* s0);
00076 bool eq(const SO* other) const;
00078 bool eq(const char* other) const;
00080 unsigned int size(void) const;
00082 int hash(int m) const;
00084 std::ostream& print(std::ostream& os) const;
00086 static void* operator new(size_t s);
00088 static void operator delete(void* p);
00089 };
00090
00092 SO* so;
00093 public:
00095 Symbol(void);
00097 Symbol(const char* s0, bool copy = false);
00099 Symbol(int i);
00101 Symbol(unsigned int i);
00103 Symbol(const Symbol& s0);
00105 const Symbol& operator=(const Symbol& s0);
00107 bool operator==(const Symbol& s0) const;
00109 bool operator==(const char* s0) const;
00111 bool empty(void) const;
00113 Symbol copy(void) const;
00115 Symbol& operator+=(const Symbol& s);
00117 int hash(int m) const;
00119 std::ostream& print(std::ostream& os) const;
00121 std::string toString(void) const;
00123 GECODE_MSC_VIRTUAL ~Symbol(void);
00124 };
00125
00126 }}
00127
00128 forceinline
00129 std::ostream&
00130 operator<<(std::ostream& os, const Gecode::Support::Symbol& x) {
00131 return x.print(os);
00132 }
00133
00134