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/ObjectArray.hpp"
00024 #include "coherence/lang/TypedClass.hpp"
00025 #include "coherence/lang/TypedExecutableClass.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
00125
00126
00127
00128
00129
00130
00131
00132 #define COH_REGISTER_CLASS(CLASS) \
00133 COH_STATIC_INIT(coherence::lang::SystemClassLoader::getInstance()-> \
00134 registerClass(CLASS))
00135
00136
00137
00138
00139
00140
00141 #define COH_REGISTER_TYPED_CLASS(TYPE) \
00142 COH_REGISTER_CLASS(coherence::lang::TypedClass<TYPE >::create())
00143
00144
00145
00146
00147
00148
00149 #define COH_REGISTER_EXECUTABLE_CLASS(TYPE) \
00150 COH_REGISTER_CLASS((coherence::lang::TypedExecutableClass<TYPE, \
00151 coherence::lang::TypedClass<TYPE> >::create()))
00152
00153 COH_CLOSE_NAMESPACE2
00154
00155 #endif // COH_SYSTEM_CLASS_LOADER_HPP