00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef COH_SYSTEM_CLASS_LOADER_HPP
00017 #define COH_SYSTEM_CLASS_LOADER_HPP
00018
00019 #include "coherence/lang/compatibility.hpp"
00020
00021 #include "coherence/lang/Class.hpp"
00022 #include "coherence/lang/ClassLoader.hpp"
00023 #include "coherence/lang/FinalHandle.hpp"
00024 #include "coherence/lang/ObjectArray.hpp"
00025 #include "coherence/lang/System.hpp"
00026
00027 COH_OPEN_NAMESPACE2(coherence,lang)
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037 class COH_EXPORT SystemClassLoader
00038 : public class_spec<SystemClassLoader,
00039 extends<Object>,
00040 implements<ClassLoader> >
00041 {
00042 friend class factory<SystemClassLoader>;
00043
00044
00045
00046 protected:
00047
00048
00049
00050 using this_spec::create;
00051
00052 private:
00053
00054
00055
00056 SystemClassLoader();
00057
00058
00059
00060
00061 public:
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072 virtual Class::View registerClass(Class::View vClass);
00073
00074
00075
00076
00077 public:
00078
00079
00080
00081 virtual Class::View loadByName(String::View vsName) const;
00082
00083
00084
00085
00086 virtual Class::View loadByType(const std::type_info& info) const;
00087
00088
00089
00090
00091 virtual ClassLoader::Handle getParent() const;
00092
00093
00094
00095
00096 public:
00097
00098
00099
00100 void toStream(std::ostream& out) const;
00101
00102
00103
00104
00105 public:
00106
00107
00108
00109
00110
00111 static SystemClassLoader::Handle getInstance();
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121 static void main(ObjectArray::View vasArg);
00122 };
00123
00124 COH_CLOSE_NAMESPACE2
00125
00126
00127
00128
00129 #include "coherence/lang/TypedClass.hpp"
00130 #include "coherence/lang/TypedExecutableClass.hpp"
00131
00132
00133
00134
00135
00136
00137
00138 #define COH_REGISTER_CLASS(CLASS) \
00139 COH_STATIC_INIT(coherence::lang::SystemClassLoader::getInstance()-> \
00140 registerClass(CLASS))
00141
00142
00143
00144
00145
00146 #define COH_REGISTER_NAMED_CLASS(NAME, CLASS) \
00147 static coherence::lang::FinalHandle<coherence::lang::Class> s_coh_static_class_##NAME \
00148 (coherence::lang::System::common(), CLASS); \
00149 COH_REGISTER_CLASS(s_coh_static_class_##NAME)
00150
00151
00152
00153
00154
00155
00156 #define COH_REGISTER_TYPED_CLASS(TYPE) \
00157 COH_REGISTER_NAMED_CLASS(TYPE, coherence::lang::TypedClass<TYPE >::create())
00158
00159
00160
00161
00162
00163
00164 #define COH_REGISTER_EXECUTABLE_CLASS(TYPE) \
00165 COH_REGISTER_NAMED_CLASS(TYPE, (coherence::lang::TypedExecutableClass<TYPE, \
00166 coherence::lang::TypedClass<TYPE > >::create()))
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178 #define COH_REGISTER_METHOD(NAME, METHOD) \
00179 COH_STATIC_INIT(s_coh_static_class_##NAME->declare(METHOD))
00180
00181 #endif // COH_SYSTEM_CLASS_LOADER_HPP