# Juliet\include\Core\Common\Singleton

## Source Files
- Header: `Juliet\include\Core\Common\Singleton.h`

## AI Description
The `Singleton.h` header file defines a C++ class template named `Singleton` that provides a global instance of a type, ensuring that only one instance exists throughout the program. The class is designed to be used in two ways:

1. **Inheritance**: By inheriting from `Singleton::AutoRegister`, you can automatically register your class with the singleton system when it is instantiated.

2. **Static Methods**: You can use the static methods `Register` and `Unregister` to manually control the registration of your class instance.

The `Singleton` class uses the `NonMovable` and `NonCopyable` classes from the `Core/Common` namespace to prevent instances from being copied or moved, ensuring that only one instance is created. The `AutoRegister` class is a helper class that automatically registers itself with the singleton system when it is instantiated.

The `Register` method checks if an instance already exists and asserts that it does not, preventing multiple registrations. Similarly, the `Unregister` method checks if the instance being unregistered matches the currently registered instance and asserts that they match, preventing incorrect unregistrations.

The `Get` method returns a pointer to the singleton instance, which can be used to access the singleton's methods and properties. The `AutoRegister` class ensures that the singleton instance is properly managed throughout the program, preventing memory leaks or other issues related to singleton usage.

## Symbols

### Namespace `Juliet`

#### Classes, Structs & Unions
- `class Singleton`
- `class Singleton::AutoRegister`

#### Functions & Methods
- `public:
        static void Singleton::Register(NonNullPtr<Type> type)`
- `static void Singleton::Unregister(NonNullPtr<Type> type)`
- `static Type* Singleton::Get()`
- `public: Singleton::AutoRegister::AutoRegister()`
- `virtual Singleton::AutoRegister::~AutoRegister()`

