00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef S11N_FACREG_TYPE
00029 # error "You must define S11N_FACREG_TYPE before including this file."
00030 #endif
00031
00032 #ifndef S11N_FACREG_TYPE_NAME
00033 # error "You must define S11N_FACREG_TYPE_NAME before including this file."
00034 #endif
00035
00036 #ifndef S11N_FACREG_INTERFACE_TYPE
00037 # define S11N_FACREG_INTERFACE_TYPE S11N_FACREG_TYPE
00038 #endif
00039
00040
00041 #ifdef S11N_FACREG_TYPE_IS_ABSTRACT
00042
00043
00044
00045
00046 namespace s11n { namespace fac {
00047
00048
00049
00050
00051 template <>
00052 struct S11N_EXPORT_API create_hook< S11N_FACREG_INTERFACE_TYPE , S11N_FACREG_TYPE >
00053 {
00054 typedef S11N_FACREG_INTERFACE_TYPE * result_type;
00055 typedef S11N_FACREG_TYPE actual_type;
00056
00057 static result_type create()
00058 {
00059 return 0;
00060 }
00061 };
00062 } }
00063 #endif // S11N_FACREG_TYPE_IS_ABSTRACT
00064
00065 namespace {
00066
00067 # ifndef s11n_FACTORY_REG_CONTEXT_DEFINED
00068 # define s11n_FACTORY_REG_CONTEXT_DEFINED 1
00069
00070
00071
00072
00073
00074
00075
00076
00077 template <typename Context>
00078 struct S11N_EXPORT_API s11n_factory_reg_context
00079 {
00080 s11n_factory_reg_context()
00081 {
00082 if( true == placeholder );
00083 }
00084
00085
00086
00087
00088 static bool placeholder;
00089 };
00090 # endif // !s11n_FACTORY_REG_CONTEXT_DEFINED
00091
00092
00093
00094
00095 template <>
00096 bool
00097 s11n_factory_reg_context< S11N_FACREG_TYPE >::placeholder= (
00098 ::s11n::fac::register_factory< S11N_FACREG_INTERFACE_TYPE >(
00099 std::string( S11N_FACREG_TYPE_NAME ),
00100 ::s11n::fac::create_hook<
00101 S11N_FACREG_INTERFACE_TYPE,
00102 S11N_FACREG_TYPE
00103 >::create
00104 ),
00105 true);
00106
00107 }
00108
00109 #ifdef S11N_FACREG_TYPE_IS_ABSTRACT
00110 # undef S11N_FACREG_TYPE_IS_ABSTRACT
00111 #endif
00112 #undef S11N_FACREG_TYPE
00113 #undef S11N_FACREG_INTERFACE_TYPE
00114 #undef S11N_FACREG_TYPE_NAME