Skip to content

Commit

Permalink
Allow to reload config and initialize more than once
Browse files Browse the repository at this point in the history
  • Loading branch information
nadrino committed Sep 8, 2024
1 parent 458a097 commit c954742
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions include/GenericToolbox.Utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ namespace GenericToolbox{
};

inline void InitBaseClass::initialize() {
if( _isInitialized_ ) throw std::logic_error("Can't re-initialize while already done. Call unInitialize() before.");
//if( _isInitialized_ ) throw std::logic_error("Can't re-initialize while already done. Call unInitialize() before.");
this->initializeImpl();
_isInitialized_ = true;
}
Expand Down Expand Up @@ -490,12 +490,10 @@ namespace GenericToolbox{
};

template<class ConfigType> inline void ConfigBaseClass<ConfigType>::setConfig(const ConfigType &config_) {
if( this->isInitialized() ) throw std::logic_error("Can't read the config while already initialized.");
_config_ = config_;
}

template<class ConfigType> inline void ConfigBaseClass<ConfigType>::readConfig() {
if( this->isInitialized() ) throw std::logic_error("Can't read the config while already initialized.");
_isConfigReadDone_ = true;
this->readConfigImpl();
}
Expand All @@ -505,7 +503,6 @@ namespace GenericToolbox{
}

template<class ConfigType> inline void ConfigBaseClass<ConfigType>::initialize() {
if( this->isInitialized() ) throw std::logic_error("Can't re-initialize while already done. Call unInitialize() before.");
if( not _isConfigReadDone_ ) this->readConfig();
InitBaseClass::initialize();
}
Expand Down

0 comments on commit c954742

Please sign in to comment.