// // forward.h // reflection // // Created by Sam Jaffe on 7/3/22. // Copyright © 2022 Sam Jaffe. All rights reserved. // #pragma once #include #include #include #include #include #include namespace reflection { class Context; class Object; template class Reflection; template class Proxy; template class TypeCast; template using Cache = std::map; template using TypeMap = std::unordered_map; template using Accessor = std::function; template using Getter = std::function; } #define reflect(object) reflection::Object(object, #object) #define INSTANTIATE_REFLECTION(T) \ template Cache> Reflection::members_; \ template Cache> Reflection::const_members_ #define INSTANTIATE_REFLECTION_TYPECAST(T) \ template TypeMap> TypeCast::get_; \ template TypeMap> TypeCast::set_ #if !defined(CONCAT) #define CONCAT_IMPL(A, B) A##B #define CONCAT(A, B) CONCAT_IMPL(A, B) #endif #define REFLECTION(T) \ bool const CONCAT(reflection_, __LINE__) = ::reflection::Reflection() #define REFLECTION_TYPE_CAST(T) \ bool const CONCAT(type_cast_, __LINE__) = ::reflection::TypeCast()