realroot_doc 0.1.1
|
00001 /******************************************************************* 00002 * This file is part of the source code of the realroot kernel. 00003 * Author(s): B. Mourrain, GALAAD, INRIA 00004 ********************************************************************/ 00005 #ifndef mmx_realroot_set_of_hpp 00006 #define mmx_realroot_set_of_hpp 00007 //=================================================================== 00008 #include <basix/basix.hpp> 00009 #include <basix/glue.hpp> 00010 //==================================================================== 00011 namespace mmx { 00012 //=================================================================== 00013 00014 template<class X> struct set_of 00015 { 00016 typedef X T; 00017 set_of<X>(){} 00018 set_of<X>(const set_of<X>& t) {} 00019 set_of<X>(const X& x) {} 00020 }; 00021 00022 template<class X> 00023 bool operator== (const set_of<X>& r1, const set_of<X>& r2) { return true; } 00024 template<class X> 00025 bool operator!= (const set_of<X>& r1, const set_of<X>& r2) { return !(r1==r2); } 00026 00027 template<class C> inline set_of<C> make_set(const C& c) { return set_of<C>(); } 00028 template<class C> inline int hash(const set_of<C>& R){ return 1;} 00029 template<class C> inline int soft_hash(const set_of<C>& R){ return 1;} 00030 template<class C> inline bool eq(const set_of<C>& R1, const set_of<C>& R2) 00031 { 00032 return R1==R2; 00033 } 00034 00035 template<class X> inline syntactic flatten(const set_of<X>& s) 00036 { 00037 return syntactic("XXX");//type_name< X >()); 00038 } 00039 00040 template<typename U,typename T> 00041 struct as_helper<set_of<U>,set_of<T> > 00042 { 00043 static inline 00044 set_of<U> cv (const set_of<T>& x) { return set_of<U>(); } 00045 }; 00046 00047 #define DECLARE_SET(X,T) \ 00048 template<> inline syntactic flatten(const set_of<T>& Z){return syntactic(X);} 00049 00050 #define DEFINE_SET(X,T) \ 00051 static set_of<T> T##_set= set_of<T>(); \ 00052 define_constant<always,set_of<T> > (X, T##_set); \ 00053 define<always> ("set_of", make_set<T>); 00054 00055 //=================================================================== 00056 } 00057 #endif //