#ifndef ComponentInfo_h__ #define ComponentInfo_h__ #include "../Common.h" #include "Entity.h" #include struct ComponentInfo { typedef int EnumType; struct Meta_t { std::string Annotation; unsigned int Allocation = 0; std::map FieldAnnotations; std::map> FieldEnumDefinitions; bool NetworkReplicated = true; }; struct Field_t { std::string Name; std::string Type; unsigned char Index; unsigned int Offset; unsigned int Stride; }; std::string Name; std::unordered_map Fields; std::vector FieldsInOrder; std::vector StringFields; unsigned int Stride = 0; boost::shared_array Defaults = nullptr; std::shared_ptr Meta = nullptr; std::size_t GetHeaderSize() const { std::size_t size = 0; // A component block starts with an entity ID size += sizeof(EntityID); return size; } }; template<> struct std::hash { inline std::size_t operator()(const ComponentInfo& v) const { return std::hash()(v.Name); } }; #endif