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