class nbla::SingletonManager

class SingletonManager

API for getting or creating and deleting any singleton classes.

In NNabla, all Singleton should be instantiated via static function `get<SINGLETON>()`. This enables you to manage all singleton instance in one place, and also to delete them by your hand.

Public Static Functions

template<typename SINGLETON>
static SINGLETON *get()

Get or create an singleton instance of a class specified by the template argument.

This will create an instance, and schedule to delete the instance at the end of process, or let you delete by hand through erase function.

Returns:

A pointer to a singleton instance.

template<typename SINGLETON>
static int get_id()

Get an integer ID of a Singleton class.

This can be used as an argument of `erase_by_id` function.

static void clear()

Delete all singleton instance previously created via `get<SINGLETON>()`.

template<typename SINGLETON>
static void erase()

Delete a singleton instance specified by a template argument.

static void erase_by_id(int id)

Delete a singleton instance specified by an ID which can be gotten by `get_id<SINGLETON>()` function.