10# if !defined (HPP_ALIB)
14# if !defined (HPP_ALIB_LANG_BASECAMP)
18# if ALIB_BOXING && !defined (HPP_ALIB_BOXING_BOXING)
22# if ALIB_CONFIGURATION
23# if !defined (HPP_ALIB_CONFIG_CONFI)
26# if !defined (HPP_ALIB_CONFIG_CONFIGURATION)
31# if !defined (HPP_ALIB_LANG_RESOURCES_LOCALRESOURCEPOOL)
36# if !defined (HPP_ALIB_TIME_TIME)
41# if ALIB_THREADS && !defined (HPP_ALIB_THREADS_THREAD)
47# if !defined (HPP_ALIB_ALOXMODULE)
52# if !defined (HPP_ALIB_CLI_CLI)
57# if !defined (HPP_ALIB_EXPRESSIONS_EXPRESSIONS)
62# if !defined (HPP_ALIB_FILES_CAMP)
66# if !defined (HPP_ALIB_LANG_CAMP_BOOTSTRAP)
70# if !defined (HPP_ALIB_LANG_CAMP_INLINES)
103 if(
Camps.IsEmpty() )
106 if( targetCamp ==
nullptr )
107 targetCamp=
Camps.Back();
122 auto targetCampIt=
Camps.rbegin();
123 while(targetCampIt !=
Camps.rend() &&
124 *targetCampIt != targetCamp )
128 "Target camp given to function alib::Bootstrap() is not included in list alib::Camps.\n"
134 phaseIntegral <= UnderlyingIntegral( targetPhase ) ;
160 hashMap.MaxLoadFactor ( 5.0 );
161 hashMap.Reserve ( expectedSize, ValueReference::Absolute );
167 for(
auto campIt= targetCampIt ; campIt !=
Camps.rend() ; ++campIt )
171 if((*campIt)->resourcePool !=
nullptr && (*campIt)->resourcePool != actPool)
173 actPool= (*campIt)->resourcePool;
177 (*campIt)->resourcePool= actPool;
183 #if ALIB_CONFIGURATION
187 if ( targetCamp->
config ==
nullptr )
195 Priorities::DefaultValues, Responsibility::KeepWithSender );
198 Priorities::Environment, Responsibility::KeepWithSender );
201 Priorities::CLI, Responsibility::KeepWithSender );
204 Priorities::ProtectedValues, Responsibility::KeepWithSender );
210 if (
ArgVN !=
nullptr )
218 auto* actConfig = targetCamp->
config;
219 for(
auto module= targetCampIt ;
module != Camps.rend() ; ++module )
222 if( (*module)->config !=
nullptr && (*module)->config != actConfig)
223 actConfig= (*module)->config;
225 (*module)->config= actConfig;
232 ALIB_DBG(
bool foundThisModuleInList =
false; )
233 for (
auto* camp :
Camps )
235 if(camp->bootstrapState >= UnderlyingIntegral(actualPhase ) )
242 camp->resourcePool ==
nullptr )
246 #if ALIB_CONFIGURATION
248 camp->config ==
nullptr )
250 camp->config = targetCamp->
config;
256 "With this invocation of Bootstrap() a camp skips a bootstrap phase \n"
257 "Resource category of the target camp: ", camp->ResourceCategory )
258 camp->bootstrap(actualPhase );
260 camp->bootstrapState= UnderlyingIntegral(actualPhase );
263 if (camp == targetCamp )
265 ALIB_DBG( foundThisModuleInList =
true );
270 "The target camp of function Bootstrap is not included in list alib::Camps "
271 "or was already bootstrapped for this phase!\n"
280 if( targetCamp ==
nullptr )
281 targetCamp=
Camps.Front();
286 auto targetCampIt=
Camps.begin();
287 while( targetCampIt !=
Camps.end()
288 && *targetCampIt != targetCamp )
291 "Target camp given to function alib::Shutdown() is not included in list alib::Camps.\n"
295 ALIB_DBG(
bool foundThisModuleInList=
false );
298 ; phaseIntegral<= UnderlyingIntegral( targetPhase )
304 for(
auto campIt=
Camps.rbegin() ; campIt !=
Camps.rend() ; ++campIt )
308 "CAMPS",
"Trying to terminate a not (fully) initialized module. "
312 if (( *campIt )->bootstrapState > -UnderlyingIntegral(actualPhase) )
317 || ( ( *campIt )->bootstrapState == -1 && phaseIntegral == 2 ),
318 "CAMPS",
"With this invocation of Bootstrap(), a camp skips a bootstrap phase \n"
319 "Resource category of the target camp: ", ( *campIt )->ResourceCategory )
322 ( *campIt )->shutdown(actualPhase );
323 ( *campIt )->bootstrapState = -UnderlyingIntegral(actualPhase );
325 ALIB_DBG(
if(( *campIt ) == targetCamp )
326 foundThisModuleInList=
true; )
329 if(( *campIt ) == targetCamp )
334 "The target camp of function Shutdown is not included in list alib::Camps "
335 "or was already shutdown for this phase!\n"
341 for(
auto campIt=
Camps.rbegin() ; campIt !=
Camps.rend() ; ++campIt )
343 if ( ( *campIt )->isResourceOwner )
monomem::Destruct(( *campIt )->resourcePool );
344 #if ALIB_CONFIGURATION
345 if ( ( *campIt )->isConfigOwner )
349 if ( im ) { config->
RemovePlugin( Priorities::DefaultValues );
353 if ( e ) { config->
RemovePlugin( Priorities::Environment );
361 if ( im ) { config->
RemovePlugin( Priorities::ProtectedValues );
368 if(( *campIt ) == targetCamp )
void SetCommandLineArgs(int argc=0, const nchar **argv=nullptr)
NCString ResourceCategory
lang::resources::ResourcePool * resourcePool
config::Configuration * config
const String & GetResource(const NString &name)
void InsertPlugin(TPlugin *plugin, TPriorities priority, lang::Responsibility responsibility=lang::Responsibility::KeepWithSender)
bool RemovePlugin(TPlugin *plugIn)
TPluginType * GetPluginTypeSafe(TPriorities priority)
detail::StaticResourceMap & BootstrapGetInternalHashMap()
void BaseLoadFactor(float newBaseLoadFactor)
ALIB_FORCE_INLINE T * Emplace(TArgs &&... args)
#define ALIB_IF_CONFIGURATION(...)
#define ALIB_IF_TIME(...)
#define ALIB_IF_BOXING(...)
#define ALIB_IF_EXPRESSIONS(...)
#define ALIB_IF_CAMP(...)
#define ALIB_IF_SINGLETONS(...)
#define ALIB_IF_THREADS(...)
#define ALIB_IF_ALOX(...)
#define ALIB_IF_ENUMS(...)
#define ALIB_IF_FILES(...)
#define ALIB_ASSERT_ERROR(cond,...)
#define ALIB_CALLER_PRUNED
ALIB_API void Bootstrap()
static ALIB_FORCE_INLINE void Destruct(T *object)
void ReleaseGlobalAllocator()
MonoAllocator GlobalAllocator(8 *1024)
MonoAllocator & AcquireGlobalAllocator(const NCString &dbgFile, int dbgLine, const NCString &dbgFunc)
@ Destruct
The main phase of termination that destructs everything.
ALIB_WARNINGS_ALLOW_UNSAFE_BUFFER_USAGE void AssertALibVersionAndFlags(int alibVersion, int alibRevision, TCompilationFlags compilationFlags)
ALIB_API List< lang::Camp * > Camps
lang::basecamp::BaseCamp BASECAMP
expressions::Expressions EXPRESSIONS
@ PrepareConfig
Initializes up to the creation of a field config .
@ Final
The final initialization phase.
bool NonCampModulesInitialized
void BootstrapAddDefaultCamps()
ALIB_WARNINGS_RESTORE void Bootstrap(int alibVersion, int alibRevision, TCompilationFlags compilationFlags)
lang::integer integer
Type alias in namespace alib.