EHS/include/ehs/BaseObj.h

74 lines
1.8 KiB
C
Raw Normal View History

2024-01-31 22:28:19 -08:00
#pragma once
#include "Types.h"
#include "Type.h"
namespace ehs
{
class BaseObj
{
private:
Type* hierarchy;
UInt_64 hierarchySize;
public:
virtual ~BaseObj();
BaseObj();
BaseObj(BaseObj&& base) noexcept;
BaseObj(const BaseObj& base);
BaseObj& operator=(BaseObj&& base) noexcept;
BaseObj& operator=(const BaseObj& base);
bool operator==(const BaseObj& base) const;
bool operator!=(const BaseObj& base) const;
/// Retrieves the class hierarchy.
/// @returns The hierarchy array.
2024-01-31 22:28:19 -08:00
const Type* GetHierarchy() const;
/// Retrieves the class hierarchy size.
/// @returns The hierarchy size.
2024-01-31 22:28:19 -08:00
UInt_64 GetHierarchySize() const;
/// Checks if this class derives from another.
/// @param [in] typeHashId The type hash id to look for.
/// @returns True if found.
2024-01-31 22:28:19 -08:00
bool HasType(UInt_64 typeHashId) const;
/// Checks if this class derives from another.
/// @param [in] typeId The type id to look for.
/// @returns True if found.
2024-01-31 22:28:19 -08:00
bool HasType(const Char_8* typeId) const;
/// Retrieves the top class' information.
/// @returns The Type object containing the class information.
2024-01-31 22:28:19 -08:00
Type GetType() const;
/// Retrieves the top class' string name, size.
/// @returns The name size.
2024-01-31 22:28:19 -08:00
UInt_64 GetTypeIdSize() const;
/// Retrieves the top class' string name.
/// @returns The name.
2024-01-31 22:28:19 -08:00
const Char_8* GetTypeId() const;
/// Retrieves the top class' hashed name.
/// @returns The hashed name.
2024-01-31 22:28:19 -08:00
UInt_64 GetTypeHashId() const;
/// Clones the object onto the heap.
/// @returns The cloned object.
2024-01-31 22:28:19 -08:00
virtual BaseObj* Clone() const;
protected:
/// Adds the class name to the class hierarchy.
/// @param [in] id The name of the class to add.
2024-01-31 22:28:19 -08:00
void AddType(const Char_8* id);
};
}