diff --git a/libsrc/core/archive.hpp b/libsrc/core/archive.hpp index 1d3809b7..c69fa293 100644 --- a/libsrc/core/archive.hpp +++ b/libsrc/core/archive.hpp @@ -21,11 +21,11 @@ namespace ngcore { // Libraries using this archive can store their version here to implement backwards compatibility - const VersionInfo& GetLibraryVersion(const std::string& library); - void SetLibraryVersion(const std::string& library, const VersionInfo& version); + NGCORE_API const VersionInfo& GetLibraryVersion(const std::string& library); + NGCORE_API void SetLibraryVersion(const std::string& library, const VersionInfo& version); + NGCORE_API std::string Demangle(const char* typeinfo); class NGCORE_API Archive; - NGCORE_API std::string Demangle(const char* typeinfo); namespace detail { @@ -99,22 +99,6 @@ namespace ngcore std::vector> nr2shared_ptr; std::vector nr2ptr; - // Helper class for up-/downcasting - template - struct Caster - { - static void* tryUpcast(const std::type_info& ti, T* p); - static void* tryDowncast(const std::type_info& ti, void* p); - }; - template - friend class RegisterClassForArchive; - - // Returns ClassArchiveInfo of Demangled typeid - static const detail::ClassArchiveInfo& GetArchiveRegister(const std::string& classname); - // Set ClassArchiveInfo for Demangled typeid, this is done by creating an instance of - // RegisterClassForArchive - static void SetArchiveRegister(const std::string& classname, const detail::ClassArchiveInfo& info); - static bool IsRegistered(const std::string& classname); public: Archive() = delete; Archive(const Archive&) = delete; @@ -455,7 +439,22 @@ namespace ngcore protected: static std::map& GetLibraryVersions(); + private: + template + friend class RegisterClassForArchive; + + // Returns ClassArchiveInfo of Demangled typeid + static const detail::ClassArchiveInfo& GetArchiveRegister(const std::string& classname); + // Set ClassArchiveInfo for Demangled typeid, this is done by creating an instance of + // RegisterClassForArchive + static void SetArchiveRegister(const std::string& classname, const detail::ClassArchiveInfo& info); + static bool IsRegistered(const std::string& classname); + + // Helper class for up-/downcasting + template + struct Caster{}; + template struct Caster { @@ -504,7 +503,7 @@ namespace ngcore public: RegisterClassForArchive() { - static_assert(all_of_tmpl::value...>, + static_assert(detail::all_of_tmpl::value...>, "Variadic template arguments must be base classes of T"); detail::ClassArchiveInfo info; info.creator = [this,&info](const std::type_info& ti) -> void* diff --git a/libsrc/core/type_traits.hpp b/libsrc/core/type_traits.hpp index 36315e7a..0d558b05 100644 --- a/libsrc/core/type_traits.hpp +++ b/libsrc/core/type_traits.hpp @@ -5,9 +5,13 @@ namespace ngcore { - template struct _BoolArray{}; - template - constexpr bool all_of_tmpl = std::is_same<_BoolArray, _BoolArray<(vals || true)...>>::value; // NOLINT + namespace detail + { + template struct _BoolArray{}; + + template + constexpr bool all_of_tmpl = std::is_same<_BoolArray, _BoolArray<(vals || true)...>>::value; // NOLINT + } // namespace detail } // namespace ngcore #endif // NETGEN_LIBSRC_CORE_TYPE_TRAITS_HPP