00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 #ifndef COH_CLASS_SPEC_HPP
00017 #define COH_CLASS_SPEC_HPP
00018 
00019 #include "coherence/lang/compatibility.hpp"
00020 
00021 #include "coherence/lang/lang_spec.hpp"
00022 #include "coherence/lang/TypedHandle.hpp"
00023 #include "coherence/lang/TypedHolder.hpp"
00024 
00025 COH_OPEN_NAMESPACE2(coherence,lang)
00026 
00027 class Object;
00028 
00029 extern COH_EXPORT void coh_throw_clone_not_supported(const std::type_info&);
00030 
00031 
00032 
00033 
00034 
00035 
00036 
00037 
00038 
00039 
00040 
00041 
00042 
00043 
00044 
00045 
00046 
00047 
00048 
00049 
00050 
00051 
00052 
00053 
00054 
00055 
00056 
00057 
00058 
00059 
00060 
00061 
00062 
00063 
00064 
00065 
00066 
00067 
00068 
00069 
00070 
00071 
00072 
00073 
00074 
00075 
00076 
00077 
00078 
00079 template<class T, class E = extends<Object, void>, class I = implements<> >
00080 class COH_EXPORT_SPEC class_spec
00081     : public E, public E::inherited, public virtual I::implements_chain
00082     {
00083     
00084 
00085     public:
00086 
00087 
00088 
00089         typedef class_spec this_spec;
00090 
00091 
00092 
00093 
00094         typedef factory<T> factory_spec;
00095 
00096 
00097 
00098 
00099         typedef class_spec super;
00100 
00101 
00102 
00103 
00104         typedef typename E::inherited super_spec;
00105 
00106 
00107 
00108 
00109         typedef typename E::inherited_literal inherited;
00110 
00111 
00112 
00113 
00114 
00115 
00116         typedef typename E::alias alias;
00117 
00118 
00119 
00120 
00121         typedef TypedHandle<T> Handle;
00122 
00123 
00124 
00125 
00126         typedef TypedHandle<const T> View;
00127 
00128 
00129 
00130 
00131         typedef TypedHolder<T> Holder;
00132 
00133 
00134 
00135 
00136         typedef typename I::interface_1  interface_1;
00137         typedef typename I::interface_2  interface_2;
00138         typedef typename I::interface_3  interface_3;
00139         typedef typename I::interface_4  interface_4;
00140         typedef typename I::interface_5  interface_5;
00141         typedef typename I::interface_6  interface_6;
00142         typedef typename I::interface_7  interface_7;
00143         typedef typename I::interface_8  interface_8;
00144         typedef typename I::interface_9  interface_9;
00145         typedef typename I::interface_10 interface_10;
00146         typedef typename I::interface_11 interface_11;
00147         typedef typename I::interface_12 interface_12;
00148         typedef typename I::interface_13 interface_13;
00149         typedef typename I::interface_14 interface_14;
00150         typedef typename I::interface_15 interface_15;
00151         typedef typename I::interface_16 interface_16;
00152 
00153 
00154     
00155 
00156     protected:
00157 
00158 
00159 
00160 
00161 
00162 
00163 
00164 
00165 
00166         COH_DEFINE_PROXY_CONSTRUCTORS(class_spec)
00167 
00168     public:
00169 
00170 
00171 
00172 
00173 
00174 
00175 
00176 
00177         COH_DEFINE_CREATE_METHODS(Handle, factory_spec::create)
00178 
00179         virtual TypedHandle<Object> clone() const
00180             {
00181             coh_throw_clone_not_supported(typeid(T));
00182             return NULL;
00183             }
00184 
00185         virtual size64_t sizeOf(bool fDeep = false) const
00186             {
00187             return fDeep
00188                     ? inherited::sizeOf( true)
00189                     : sizeof(T);
00190             }
00191 
00192         virtual void* _cast(coh_class_id pInfo) const
00193             {
00194             
00195             
00196             
00197             
00198             void* p = COH_CLASS_ID(T) == pInfo
00199                     ? (void*) static_cast<const T*>(this)
00200                     : I::implements_chain::_icast(pInfo);
00201             return p ? p : super_spec::_cast(pInfo);
00202             }
00203 
00204 
00205         COH_GENERATE_CLASS_ID(T)
00206 
00207         
00208 
00209 
00210 
00211 
00212         virtual coh_class_id _getClassId() const
00213             {
00214             return COH_CLASS_ID(T);
00215             }
00216 
00217     protected:
00218 
00219 
00220 
00221 
00222 
00223         static inline Handle create(const T& that)
00224             {
00225             return Handle(factory_spec::create(that));
00226             }
00227     };
00228 
00229 COH_CLOSE_NAMESPACE2
00230 
00231 #endif // COH_CLASS_SPEC_HPP