ALib C++ Framework
by
Library Version: 2511 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
variables.prepro.hpp File Reference

Description:

This header-file is part of the ALib C++ Framework.

© 2013-2025 A-Worx GmbH, Germany. Published under Boost Software License.

Definition in file variables.prepro.hpp.

#include "alib/alib.inl"

Go to the source code of this file.

Namespaces

namespace  alib
namespace  alib::variables

Macros

#define ALIB_VARIABLES_DEFINE_TYPE(Namespace, CPPName, CfgTypeString)
#define ALIB_VARIABLES_DEFINE_TYPE_WITH_POOL_CONSTRUCTOR(Namespace, CPPName, CfgTypeString)
#define ALIB_VARIABLES_REGISTER_TYPE(CPPName)

Enumerations

enum class  alib::variables::Priority : uint16_t {
  alib::variables::NONE = 0 , alib::variables::AutoDetected = 1000 , alib::variables::DefaultValues = 2000 , alib::variables::Standard = 4000 ,
  alib::variables::ConfigFile = 6000 , alib::variables::Environment = 8000 , alib::variables::SessionFile = 10000 , alib::variables::CLI = 12000 ,
  alib::variables::Session = 14000 , alib::variables::Protected = (std::numeric_limits<uint16_t>::max)()
}

Macro Definition Documentation

◆ ALIB_VARIABLES_DEFINE_TYPE

#define ALIB_VARIABLES_DEFINE_TYPE ( Namespace,
CPPName,
CfgTypeString )
Value:
struct VMeta_ # CPPName : public VMeta \
{ \
ALIB_DLL String typeName () const override { return CfgTypeString; } \
ALIB_DBG(ALIB_DLL const std::type_info& dbgTypeID() override { return typeid(Namespace CPPName); } ) \
ALIB_DLL void construct(VDATA* obj, PoolAllocator&) override { new (obj) Namespace CPPName(); } \
ALIB_DLL void destruct (VDATA* obj, PoolAllocator&) override { reinterpret_cast<Namespace CPPName*>(obj)->~CPPName(); } \
ALIB_DLL size_t size () override { static_assert(alignof(Namespace CPPName) <= alib::PoolAllocator::MAX_ALIGNMENT); return (std::max)( sizeof(Namespace CPPName), sizeof(void*) ); } \
ALIB_DLL void imPort (VDATA*, Configuration&, const StringEscaper&, const String&) override;\
ALIB_DLL void exPort (VDATA*, Configuration&, const StringEscaper&, AString&) override;\
};}
#define ALIB_DLL
Definition alib.inl:573
#define ALIB_EXPORT
Definition alib.inl:562

Defines a struct named alib::variables::detail::VMeta_<<CPPName>>, which is derived from struct VMeta and which declares all abstract virtual methods and implements most of them already. The methods are:

Method Status
typeName defined
dbgTypeID defined (in debug-compilations only)
construct defined
destruct defined
size defined
imPort declared only
exPort declared only

This is the first step on the way to create an ALib variable of a custom storage type.

See also
Parameters
NamespaceThe namespace of the type to enable as an ALib variable.
CPPNameThe name of the type to enable as an ALib variable.
CfgTypeStringThe type string used to declare variables of this type.

Definition at line 105 of file variables.prepro.hpp.

◆ ALIB_VARIABLES_DEFINE_TYPE_WITH_POOL_CONSTRUCTOR

#define ALIB_VARIABLES_DEFINE_TYPE_WITH_POOL_CONSTRUCTOR ( Namespace,
CPPName,
CfgTypeString )
Value:
struct VMeta_ # CPPName : public VMeta \
{ \
ALIB_DLL String typeName () const override { return CfgTypeString; } \
ALIB_DBG(ALIB_DLL const std::type_info& dbgTypeID() override { return typeid(Namespace CPPName); } ) \
ALIB_DLL void construct(VDATA* obj, PoolAllocator& pool) override { new (obj) Namespace CPPName(pool); } \
ALIB_DLL void destruct (VDATA* obj, PoolAllocator&) override { reinterpret_cast<Namespace CPPName*>(obj)->~CPPName(); } \
ALIB_DLL size_t size () override { static_assert(alignof(Namespace CPPName) <= alib::PoolAllocator::MAX_ALIGNMENT); return (std::max)( sizeof(Namespace CPPName), sizeof(void*) ); } \
ALIB_DLL void imPort (VDATA*, Configuration&, const StringEscaper&, const String&) override;\
ALIB_DLL void exPort (VDATA*, Configuration&, const StringEscaper&, AString&) override;\
};}

Same as ALIB_VARIABLES_DEFINE_TYPE with the only difference that virtual override construct passes the pool allocator of the configuration instance to the constructor of the custom type.

Parameters
NamespaceThe namespace of the type to enable as an ALib variable.
CPPNameThe name of the type to enable as an ALib variable.
CfgTypeStringThe type string used to declare variables of this type.

Definition at line 118 of file variables.prepro.hpp.

◆ ALIB_VARIABLES_REGISTER_TYPE

#define ALIB_VARIABLES_REGISTER_TYPE ( CPPName)
Value:
GetConfig()->RegisterType<alib::variables::detail::VMeta_ # CPPName>();

Registers a custom implementation of abstract class VMeta, which has been previously defined with macro ALIB_VARIABLES_DEFINE_TYPE with the configuration object received by a call to GetConfig(). This macro is to be placed in virtual void Bootstrap() =0 in the section of phase PrepareConfig. The macro invokes the method void RegisterType() , which has to be called 'manually' if for some reason the placement of registration can't be done as proposed.

Parameters
CPPNameThe name of the type to enable as an ALib variable (excluding the namespace).

Definition at line 132 of file variables.prepro.hpp.