Mirror reflection library 0.5.13
|
Registering/Reflection of free variables. More...
#include <mirror/mirror_fwd.hpp>
#include <mirror/meta_object_tags.hpp>
#include <mirror/meta_namespace.hpp>
#include <mirror/auxiliary/default_spec_tags.hpp>
#include <mirror/meta_prog/only_if.hpp>
#include <type_traits>
Go to the source code of this file.
Namespaces | |
namespace | mirror |
All Mirror's types, classes, functions, etc. are defined in this namespace. | |
Defines | |
#define | MIRROR_REG_FREE_VARIABLE_COMMON_HLPR_CTS(STORAGE_CLASS, VARIABLE, SPELLED) |
#define | MIRROR_REG_GLOBAL_SCOPE_VARIABLE_CTS(STORAGE_CLASS, VARIABLE, SPELLED) |
#define | MIRROR_REG_GLOBAL_SCOPE_VARIABLE(STORAGE_CLASS, VARIABLE) |
This macro registers a variable from the global scope with Mirror. | |
#define | MIRROR_REG_FREE_VARIABLE_CTS(STORAGE_CLASS, NAMESPACE, VARIABLE, SPELLED) |
#define | MIRROR_REG_FREE_VARIABLE(STORAGE_CLASS, NAMESPACE, VARIABLE) |
This macro registers a variable from the a namespace with Mirror. | |
#define | MIRRORED_FREE_VARIABLE(NAMESPACE, VARIABLE) mirror::MetaFreeVariable |
Reflects the variable VARIABLE defined in the NAMESPACE namespace. | |
#define | MIRRORED_GLOBAL_SCOPE_VARIABLE(VARIABLE) mirror::MetaFreeVariable |
Reflects the variable VARIABLE defined in the global scope. | |
#define | MIRRORED_SIMPLE_VARIABLE(STORAGE_CLASS, VARIABLE) mirror::MetaVariable |
Reflects the meta_object passed as the META_OBJECT argument. |
Registering/Reflection of free variables.
Copyright 2008-2011 Matus Chochlik. Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#define MIRROR_REG_FREE_VARIABLE_COMMON_HLPR_CTS | ( | STORAGE_CLASS, | |
VARIABLE, | |||
SPELLED | |||
) |
typedef mirror::spec_ ## STORAGE_CLASS ## _tag storage_class; \ MIRROR_IMPLEMENT_META_OBJECT_NAME_FUNCTIONS(#VARIABLE) \ typedef typename mirror::cts::string< \ MIRROR_PP_EXPAND_ARGS SPELLED \ >::type ct_name; \ template <typename X> \ struct by_name_typ \ { \ typedef X VARIABLE; \ }; \ template <typename X> \ struct by_name_val \ { \ X VARIABLE; \ by_name_val(void) = default; \ template <class Parent, typename Param> \ by_name_val(Parent& parent, Param param) \ : VARIABLE(parent, param) \ { } \ };
#define MIRROR_REG_FREE_VARIABLE_CTS | ( | STORAGE_CLASS, | |
NAMESPACE, | |||
VARIABLE, | |||
SPELLED | |||
) |
namespace _variable { \ template <typename Namespace> struct _ ## VARIABLE ; \ template <> struct _ ## VARIABLE< mirror::_namespace:: NAMESPACE ::_ >\ { \ MIRROR_REG_FREE_VARIABLE_COMMON_HLPR_CTS( \ STORAGE_CLASS, \ VARIABLE, \ SPELLED \ ) \ typedef decltype(NAMESPACE :: VARIABLE) type; \ typedef mirror::_namespace:: NAMESPACE ::_ scope; \ static inline const type& get(void) { return :: NAMESPACE :: VARIABLE; } \ static inline void set(type val) { :: NAMESPACE :: VARIABLE = val; } \ static inline type* address(void) { return & :: NAMESPACE :: VARIABLE;}\ static std::true_type has_address(void); \ }; \ } MIRROR_ADD_TO_GLOBAL_LIST( \ mirror::_namespace:: NAMESPACE ::_, \ mirror::meta_free_variable< \ mirror::_variable::_ ## VARIABLE< \ mirror::_namespace:: NAMESPACE ::_ \ > > \ )
#define MIRROR_REG_GLOBAL_SCOPE_VARIABLE_CTS | ( | STORAGE_CLASS, | |
VARIABLE, | |||
SPELLED | |||
) |
namespace _variable { \ template <typename Namespace> struct _ ## VARIABLE ; \ template <> struct _ ## VARIABLE< mirror::_namespace::_ >\ { \ MIRROR_REG_FREE_VARIABLE_COMMON_HLPR_CTS( \ STORAGE_CLASS, \ VARIABLE, \ SPELLED \ ) \ typedef decltype(VARIABLE) type; \ typedef mirror::_namespace::_ scope; \ static inline const type& get(void) { return :: VARIABLE; } \ static inline void set(type val) { :: VARIABLE = val; } \ static inline type* address(void) { return & :: VARIABLE; } \ static std::true_type has_address(void); \ }; \ } MIRROR_ADD_TO_GLOBAL_LIST( \ mirror::_namespace::_, \ mirror::meta_free_variable< \ mirror::_variable::_ ## VARIABLE< \ mirror::_namespace::_ \ > > \ )