chore: flat out the file structure
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
#ifndef FURVM_DETAIL_HANDLE_HPP
|
||||
#define FURVM_DETAIL_HANDLE_HPP
|
||||
|
||||
#include <functional>
|
||||
#include <type_traits>
|
||||
|
||||
namespace furvm {
|
||||
namespace detail {
|
||||
|
||||
/**
|
||||
* @brief Default specialization for header_has_refcount type trait.
|
||||
*/
|
||||
template <typename Header, typename = void>
|
||||
struct header_has_refcount : std::false_type {};
|
||||
|
||||
/**
|
||||
* @brief Specialization for header_has_refcount type trait.
|
||||
*/
|
||||
template <typename Header>
|
||||
struct header_has_refcount<Header,
|
||||
std::void_t<decltype(std::declval<Header&>().acquire()),
|
||||
decltype(std::declval<Header&>().release()),
|
||||
decltype(std::declval<Header&>().reference_count())>> : std::true_type {};
|
||||
|
||||
/**
|
||||
* @brief An alias for header_has_refcount's value.
|
||||
*/
|
||||
template <typename Header>
|
||||
static constexpr auto header_has_refcount_v = header_has_refcount<Header>::value;
|
||||
|
||||
template <typename Handle, typename IdHash = std::hash<typename Handle::id_type>>
|
||||
struct handle_hash {
|
||||
std::size_t operator()(const Handle& handle) const { return IdHash{}(handle.id()); }
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace furvm
|
||||
|
||||
#endif // FURVM_DETAIL_HANDLE_HPP
|
||||
@@ -0,0 +1,176 @@
|
||||
#ifndef FURVM_DETAIL_SERIALIZATION_HPP
|
||||
#define FURVM_DETAIL_SERIALIZATION_HPP
|
||||
|
||||
#include <cstdint>
|
||||
#include <ostream>
|
||||
#include <string>
|
||||
|
||||
namespace furvm {
|
||||
namespace detail {
|
||||
|
||||
/**
|
||||
* @brief Serializes an integer.
|
||||
*
|
||||
* @param os Output stream.
|
||||
* @param value Integer.
|
||||
* @return The output stream.
|
||||
*/
|
||||
std::ostream& serialize(std::ostream& os, std::int8_t value);
|
||||
|
||||
/**
|
||||
* @brief Serializes an integer.
|
||||
*
|
||||
* @param os Output stream.
|
||||
* @param value Integer.
|
||||
* @return The output stream.
|
||||
*/
|
||||
std::ostream& serialize(std::ostream& os, std::int16_t value);
|
||||
|
||||
/**
|
||||
* @brief Serializes an integer.
|
||||
*
|
||||
* @param os Output stream.
|
||||
* @param value Integer.
|
||||
* @return The output stream.
|
||||
*/
|
||||
std::ostream& serialize(std::ostream& os, std::int32_t value);
|
||||
|
||||
/**
|
||||
* @brief Serializes an integer.
|
||||
*
|
||||
* @param os Output stream.
|
||||
* @param value Integer.
|
||||
* @return The output stream.
|
||||
*/
|
||||
std::ostream& serialize(std::ostream& os, std::int64_t value);
|
||||
|
||||
/**
|
||||
* @brief Serializes an integer.
|
||||
*
|
||||
* @param os Output stream.
|
||||
* @param value Integer.
|
||||
* @return The output stream.
|
||||
*/
|
||||
std::ostream& serialize(std::ostream& os, std::uint8_t value);
|
||||
|
||||
/**
|
||||
* @brief Serializes an integer.
|
||||
*
|
||||
* @param os Output stream.
|
||||
* @param value Integer.
|
||||
* @return The output stream.
|
||||
*/
|
||||
std::ostream& serialize(std::ostream& os, std::uint16_t value);
|
||||
|
||||
/**
|
||||
* @brief Serializes an integer.
|
||||
*
|
||||
* @param os Output stream.
|
||||
* @param value Integer.
|
||||
* @return The output stream.
|
||||
*/
|
||||
std::ostream& serialize(std::ostream& os, std::uint32_t value);
|
||||
|
||||
/**
|
||||
* @brief Serializes an integer.
|
||||
*
|
||||
* @param os Output stream.
|
||||
* @param value Integer.
|
||||
* @return The output stream.
|
||||
*/
|
||||
std::ostream& serialize(std::ostream& os, std::uint64_t value);
|
||||
|
||||
/**
|
||||
* @brief Serializes a string.
|
||||
*
|
||||
* @param os Output stream.
|
||||
* @param value String.
|
||||
* @return The output stream.
|
||||
*/
|
||||
std::ostream& serialize(std::ostream& os, const std::string& value);
|
||||
|
||||
/**
|
||||
* @brief Deserializes an integer.
|
||||
*
|
||||
* @param is Input stream.
|
||||
* @param value Integer.
|
||||
* @return The input stream.
|
||||
*/
|
||||
std::istream& load(std::istream& is, std::int8_t& value);
|
||||
|
||||
/**
|
||||
* @brief Deserializes an integer.
|
||||
*
|
||||
* @param is Input stream.
|
||||
* @param value Integer.
|
||||
* @return The input stream.
|
||||
*/
|
||||
std::istream& load(std::istream& is, std::int16_t& value);
|
||||
|
||||
/**
|
||||
* @brief Deserializes an integer.
|
||||
*
|
||||
* @param is Input stream.
|
||||
* @param value Integer.
|
||||
* @return The input stream.
|
||||
*/
|
||||
std::istream& load(std::istream& is, std::int32_t& value);
|
||||
|
||||
/**
|
||||
* @brief Deserializes an integer.
|
||||
*
|
||||
* @param is Input stream.
|
||||
* @param value Integer.
|
||||
* @return The input stream.
|
||||
*/
|
||||
std::istream& load(std::istream& is, std::int64_t& value);
|
||||
|
||||
/**
|
||||
* @brief Deserializes an integer.
|
||||
*
|
||||
* @param is Input stream.
|
||||
* @param value Integer.
|
||||
* @return The input stream.
|
||||
*/
|
||||
std::istream& load(std::istream& is, std::uint8_t& value);
|
||||
|
||||
/**
|
||||
* @brief Deserializes an integer.
|
||||
*
|
||||
* @param is Input stream.
|
||||
* @param value Integer.
|
||||
* @return The input stream.
|
||||
*/
|
||||
std::istream& load(std::istream& is, std::uint16_t& value);
|
||||
|
||||
/**
|
||||
* @brief Deserializes an integer.
|
||||
*
|
||||
* @param is Input stream.
|
||||
* @param value Integer.
|
||||
* @return The input stream.
|
||||
*/
|
||||
std::istream& load(std::istream& is, std::uint32_t& value);
|
||||
|
||||
/**
|
||||
* @brief Deserializes an integer.
|
||||
*
|
||||
* @param is Input stream.
|
||||
* @param value Integer.
|
||||
* @return The input stream.
|
||||
*/
|
||||
std::istream& load(std::istream& is, std::uint64_t& value);
|
||||
|
||||
/**
|
||||
* @brief Deserializes a string.
|
||||
*
|
||||
* @param is Input stream.
|
||||
* @param value String.
|
||||
* @return The input stream.
|
||||
*/
|
||||
std::istream& load(std::istream& is, std::string& value);
|
||||
|
||||
} // namespace detail
|
||||
} // namespace furvm
|
||||
|
||||
#endif // FURVM_DETAIL_SERIALIZATION_HPP
|
||||
Reference in New Issue
Block a user