- Timestamp:
- 08/11/09 08:32:02 (15 years ago)
- Location:
- library
- Files:
-
- 13 modified
Legend:
- Unmodified
- Added
- Removed
-
library/bdm/base/user_info.cpp
r490 r493 63 63 64 64 void UI::MappedUI::add_class ( const string &class_name, const type_info * const class_type_info, const UI* const ui ) { 65 pair< const string, const UI* const > new_pair = make_pair ( class_name, ui ); 66 mapped_strings().insert ( new_pair ); 67 mapped_type_infos().insert ( make_pair ( class_type_info, new_pair.first ) ); 65 pair< StringToUIMap::iterator, bool> inres = 66 mapped_strings().insert ( 67 StringToUIMap::value_type( class_name, ui ) ); 68 if ( inres.second ) { 69 mapped_type_infos().insert ( 70 TypeInfoToStringMap::value_type ( 71 class_type_info, class_name ) ); 72 } 68 73 } 69 74 -
library/bdm/base/user_info.h
r483 r493 514 514 515 515 516 //! The only UI descendant class which is not intended for direct use. It should be accessed within the ::UIREGISTER macro only.516 //! The only UI descendant class which is not intended for direct use. It should be accessed within the UIREGISTER macro only. 517 517 //! \ref ui_page 518 518 template<typename T> class ParticularUI : private UI { 519 p rivate:520 //! Default constructor, which is intentionally declared as private519 public: 520 //! Constructor used by the UIREGISTER macro. 521 521 ParticularUI<T> ( const string &class_name ) : UI ( class_name, &typeid ( T ) ) {}; 522 523 public:524 //! The only instance of this class (each type T has its own instance) which is used as a factory for processing related UI525 static const ParticularUI<T>& factory;526 522 527 523 //! A method returning a brand new instance of class T, this method is the reason why there have to be a parameterless construcotor in class T … … 533 529 } 534 530 531 #define CONCATENATE0( name, line ) name##line 532 #define CONCATENATE( name, line ) CONCATENATE0( name, line ) 533 535 534 /*! 536 535 \def UIREGISTER(class_name) … … 543 542 */ 544 543 #ifndef BDMLIB 545 #define UIREGISTER(class_name) template<> const ParticularUI<class_name>& ParticularUI<class_name>::factory = ParticularUI<class_name>(#class_name)544 #define UIREGISTER(class_name) static ParticularUI<class_name> CONCATENATE(registrator, __LINE__)(#class_name) 546 545 #else 547 546 #define UIREGISTER(class_name) -
library/tests/datalink_test.cpp
r477 r493 1 #define BDMLIB // not an ideal way to prevent double registration of UI factories...2 1 #include "../bdm/stat/exp_family.h" 3 2 #include "UnitTest++.h" -
library/tests/egiw_harness.h
r477 r493 29 29 void from_setting ( const Setting &set ); 30 30 }; 31 UIREGISTER(egiw_harness); 31 32 32 33 } -
library/tests/egiw_test.cpp
r477 r493 1 #define BDMLIB // not an ideal way to prevent double registration of UI factories...2 1 #include "base/bdmbase.h" 3 2 #include "base/user_info.h" … … 12 11 13 12 using namespace bdm; 14 15 template<>16 const ParticularUI<egiw> &ParticularUI<egiw>::factory (17 ParticularUI<egiw> ( "egiw" ) );18 19 template<>20 const ParticularUI<egiw_harness> &ParticularUI<egiw_harness>::factory (21 ParticularUI<egiw_harness> ( "egiw_harness" ) );22 13 23 14 TEST ( test_egiw ) { -
library/tests/epdf_harness.cpp
r489 r493 10 10 namespace bdm { 11 11 12 template<>13 const ParticularUI<epdf_harness> &ParticularUI<epdf_harness>::factory (14 ParticularUI<epdf_harness> ( "epdf_harness" ) );15 16 12 void epdf_harness::test_config ( const char *config_file_name ) { 17 13 RV::clear_all(); -
library/tests/epdf_harness.h
r482 r493 13 13 #ifndef EPDF_HARNESS_H 14 14 #define EPDF_HARNESS_H 15 16 #define BDMLIB // not an ideal way to prevent double registration of UI factories...17 15 18 16 #include "bdmroot.h" … … 76 74 void check_cond_covariance( mprod &mep ); 77 75 }; 76 UIREGISTER(epdf_harness); 78 77 79 78 } -
library/tests/epdf_test.cpp
r477 r493 1 #define BDMLIB // not an ideal way to prevent double registration of UI factories...2 1 #include "base/user_info.h" 3 2 #include "stat/exp_family.h" … … 6 5 7 6 using namespace bdm; 8 9 template<>10 const ParticularUI<egamma> &ParticularUI<egamma>::factory (11 ParticularUI<egamma> ( "egamma" ) );12 13 template<>14 const ParticularUI<enorm<ldmat> > &ParticularUI<enorm<ldmat> >::factory (15 ParticularUI<enorm<ldmat> > ( "enorm<ldmat>" ) );16 17 template<>18 const ParticularUI<enorm<fsqmat> > &ParticularUI<enorm<fsqmat> >::factory (19 ParticularUI<enorm<fsqmat> > ( "enorm<fsqmat>" ) );20 21 template<>22 const ParticularUI<enorm<chmat> > &ParticularUI<enorm<chmat> >::factory (23 ParticularUI<enorm<chmat> > ( "enorm<chmat>" ) );24 7 25 8 TEST ( test_egamma ) { -
library/tests/loggers_test.cpp
r477 r493 1 #define BDMLIB // not an ideal way to prevent double registration of UI factories...2 1 #include "base/loggers.h" 3 2 #include "test_util.h" -
library/tests/mpdf_harness.cpp
r484 r493 8 8 9 9 namespace bdm { 10 11 template<>12 const ParticularUI<mpdf_harness> &ParticularUI<mpdf_harness>::factory (13 ParticularUI<mpdf_harness> ( "mpdf_harness" ) );14 10 15 11 void mpdf_harness::test_config ( const char *config_file_name ) { -
library/tests/mpdf_harness.h
r484 r493 13 13 #ifndef MPDF_HARNESS_H 14 14 #define MPDF_HARNESS_H 15 16 #define BDMLIB // not an ideal way to prevent double registration of UI factories...17 15 18 16 #include "bdmroot.h" … … 54 52 void check_covariance(); 55 53 }; 54 UIREGISTER(mpdf_harness); 56 55 57 56 } -
library/tests/mpdf_test.cpp
r492 r493 1 #define BDMLIB // not an ideal way to prevent double registration of UI factories...2 1 #include "base/bdmbase.h" 3 2 #include "base/user_info.h" … … 9 8 10 9 using namespace bdm; 11 12 template<>13 const ParticularUI<mgamma> &ParticularUI<mgamma>::factory (14 ParticularUI<mgamma> ( "mgamma" ) );15 16 template<>17 const ParticularUI<mlnorm<ldmat> > &ParticularUI<mlnorm<ldmat> >::factory (18 ParticularUI<mlnorm<ldmat> > ( "mlnorm<ldmat>" ) );19 20 template<>21 const ParticularUI<mlnorm<chmat> > &ParticularUI<mlnorm<chmat> >::factory (22 ParticularUI<mlnorm<chmat> > ( "mlnorm<chmat>" ) );23 10 24 11 TEST ( test_mepdf ) { -
library/tests/test_util.cpp
r486 r493 1 #define BDMLIB // not an ideal way to prevent double registration of UI factories...2 1 #include "test_util.h" 3 2 #include "stat/exp_family.h"