17# if ALIB_CONFIGURATION
92 if( targetCamp ==
nullptr )
93 targetCamp=
CAMPS.Back();
119 auto targetCampIt=
CAMPS.rbegin();
120 while(targetCampIt !=
CAMPS.rend() &&
121 *targetCampIt != targetCamp )
125 "Target camp given to function alib::Bootstrap() is not included in list alib::CAMPS.\n"
131 phaseIntegral <= UnderlyingIntegral( targetPhase ) ;
158 hashMap.MaxLoadFactor ( 5.0 );
159 hashMap.Reserve ( expectedSize, ValueReference::Absolute );
165 for(
auto campIt= targetCampIt ; campIt !=
CAMPS.rend() ; ++campIt )
169 if((*campIt)->resourcePool !=
nullptr && (*campIt)->resourcePool != actPool)
171 actPool= (*campIt)->resourcePool;
175 (*campIt)->resourcePool= actPool;
181 #if ALIB_CONFIGURATION
185 if ( targetCamp->
config ==
nullptr )
191 targetCamp->
config = (*monoAllocator)().New<Configuration>(*monoAllocator);
192 #if ALIB_DEBUG_CRITICAL_SECTIONS
193 targetCamp->
config->
NodeTable().dcs.DCSName=
"ALib-Camp-Configuration";
198 auto* actConfig = targetCamp->
config;
200 for(
auto module= targetCampIt ;
module != CAMPS.rend() ; ++module )
203 if( (*module)->config !=
nullptr && (*module)->config != actConfig)
205 actConfig = (*module)->config;
207 ALIB_DBG( (*module)->configLock->Dbg.Name=
"CampConfig";) )
211 (*module)->config = actConfig;
220 ALIB_DBG(
bool foundThisModuleInList =
false; )
221 for (
auto* camp :
CAMPS )
224 if(camp->bootstrapState >= UnderlyingIntegral(actualPhase ) )
230 "With this invocation of Bootstrap() a camp skips a bootstrap phase.\n"
231 "Resource category of the target camp: ", camp->ResourceCategory )
232 camp->bootstrap(actualPhase );
234 camp->bootstrapState= UnderlyingIntegral(actualPhase );
237 if (camp == targetCamp )
239 ALIB_DBG( foundThisModuleInList =
true );
244 "The target camp of function Bootstrap is not included in list alib::CAMPS "
245 "or was already bootstrapped for this phase!\n"
252 #if ALIB_DEBUG_CRITICAL_SECTIONS
257 # if ALIB_CONFIGURATION
269 #if ALIB_DEBUG_CRITICAL_SECTIONS && ALIB_MONOMEM
275 if( targetCamp ==
nullptr )
276 targetCamp=
CAMPS.Front();
281 auto targetCampIt=
CAMPS.begin();
282 while( targetCampIt !=
CAMPS.end()
283 && *targetCampIt != targetCamp )
286 "Target camp given to function alib::Shutdown() is not included in list alib::CAMPS.\n"
290 ALIB_DBG(
bool foundThisModuleInList=
false );
293 ; phaseIntegral<= UnderlyingIntegral( targetPhase )
299 for(
auto campIt=
CAMPS.rbegin() ; campIt !=
CAMPS.rend() ; ++campIt )
303 "CAMPS",
"Trying to terminate a not (fully) initialized module. "
307 if (( *campIt )->bootstrapState > -UnderlyingIntegral(actualPhase) )
312 || ( ( *campIt )->bootstrapState == -1 && phaseIntegral == 2 ),
313 "CAMPS",
"With this invocation of Bootstrap(), a camp skips a bootstrap phase \n"
314 "Resource category of the target camp: ", ( *campIt )->ResourceCategory )
317 ( *campIt )->shutdown(actualPhase );
318 ( *campIt )->bootstrapState = -UnderlyingIntegral(actualPhase );
320 ALIB_DBG(
if(( *campIt ) == targetCamp )
321 foundThisModuleInList=
true; )
324 if(( *campIt ) == targetCamp )
329 "The target camp of function Shutdown is not included in list alib::CAMPS "
330 "or was already shutdown for this phase!\n"
334 #if ALIB_DEBUG_CRITICAL_SECTIONS && ALIB_CONFIGURATION
337 for(
auto campIt=
CAMPS.rbegin() ; campIt !=
CAMPS.rend() ; ++campIt )
338 if ( ( *campIt )->isConfigOwner )
339 (*campIt)->config->NodeTable().dcs.DCSLock=
nullptr;
344 for(
auto campIt=
CAMPS.rbegin() ; campIt !=
CAMPS.rend() ; ++campIt )
346 if ( ( *campIt )->isResourceOwner )
lang::Destruct( *(*campIt)->resourcePool );
347 #if ALIB_CONFIGURATION
348 if ( ( *campIt )->isConfigOwner )
350 auto& cfgAllocator= (*campIt)->config->GetAllocator();
352 #if ALIB_DEBUG_CRITICAL_SECTIONS
353 (*campIt)->config->NodeTable().dcs.DCSLock=
nullptr;
360 if(( *campIt ) == targetCamp )
365 && targetCamp ==
CAMPS.Front() )
void BaseLoadFactor(float newBaseLoadFactor) noexcept
SharedLock * configLock
A shared lock associated to member config.
NCString ResourceCategory
lang::resources::ResourcePool * resourcePool
config::Configuration * config
detail::StaticResourceMap & BootstrapGetInternalHashMap()
lang::Placeholder< lang::DbgCriticalSections > DbgCriticalSectionsPH
DbgLockAsserter Dbg
The debug tool instance.
#define IF_ALIB_FILES(...)
#define IF_ALIB_BOXING(...)
#define IF_ALIB_THREADS(...)
#define IF_ALIB_CONFIGURATION(...)
#define IF_ALIB_ALOX(...)
#define IF_ALIB_SINGLETONS(...)
#define IF_ALIB_THREADMODEL(...)
#define ALIB_BOXING_BOOTSTRAP_VTABLE_DBG_REGISTER(Identifier)
#define IF_ALIB_TIME(...)
#define ALIB_ASSERT_ERROR(cond,...)
#define IF_ALIB_ENUMS(...)
#define IF_ALIB_CAMP(...)
#define IF_ALIB_EXPRESSIONS(...)
static ALIB_FORCE_INLINE void Destruct(T &object)
ALIB_API MonoAllocator GLOBAL_ALLOCATOR
ALIB_API RecursiveLock GLOBAL_ALLOCATOR_LOCK
ALIB_API void Bootstrap()
ShutdownPhases
Termination levels usable with Bootstrapping ALib Camps.
@ Destruct
The main phase of termination that destructs everything.
lox::ALoxCamp ALOX
The singleton instance of ALib Camp class ALoxCamp.
ALIB_WARNINGS_ALLOW_UNSAFE_BUFFER_USAGE void AssertALibVersionAndFlags(int alibVersion, int alibRevision, TCompilationFlags compilationFlags)
config::ConfigCamp CONFIG
The singleton instance of ALib Camp class ConfigCamp.
lang::basecamp::BaseCamp BASECAMP
The singleton instance of ALib Camp class BaseCamp.
expressions::ExpressionsCamp EXPRESSIONS
The singleton instance of ALib Camp class ExpressionsCamp.
BootstrapPhases
Initialization levels usable with Bootstrapping ALib Camps.
@ Final
The final initialization phase. Here, camps are initializing their custom setup.
bool NonCampModulesInitialized
ALIB_API List< MonoAllocator, lang::Camp * > CAMPS
cli::CliCamp CLI
The singleton instance of ALib Camp class CliCamp.
files::FilesCamp FILES
The singleton instance of ALib Camp class FilesCamp.
monomem::TMonoAllocator< lang::HeapAllocator > MonoAllocator
void BootstrapAddDefaultCamps()
ALIB_WARNINGS_RESTORE void Bootstrap(int alibVersion, int alibRevision, TCompilationFlags compilationFlags)
lang::integer integer
Type alias in namespace alib.