Thrill  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
singleton< InstanceType, destroy_on_exit > Class Template Reference

Detailed Description

template<typename InstanceType, bool destroy_on_exit = true>
class foxxll::singleton< InstanceType, destroy_on_exit >

Definition at line 25 of file singleton.hpp.

+ Inheritance diagram for singleton< InstanceType, destroy_on_exit >:

#include <singleton.hpp>

Public Types

using instance_pointer = instance_type *
 
using instance_type = InstanceType
 
using volatile_instance_pointer = volatile instance_pointer
 

Public Member Functions

 singleton ()=default
 
 singleton (const singleton &)=delete
 non-copyable: delete copy-constructor More...
 
template<typename SubInstanceType >
singleton< InstanceType,
destroy_on_exit >
::instance_pointer 
create_instance ()
 
singletonoperator= (const singleton &)=delete
 non-copyable: delete assignment operator More...
 

Static Public Member Functions

template<typename SubInstanceType >
static instance_pointer create_instance ()
 create instance of SubInstanceType and move into singleton More...
 
static void destroy_instance ()
 destroy singleton and mark as invalid More...
 
static instance_pointer get_instance ()
 return instance or create base instance if empty More...
 
static instance_typeget_ref ()
 

Static Private Attributes

static volatile_instance_pointer instance_ = nullptr
 singleton object instance More...
 
static std::mutex singleton_mutex_
 mutex to protect instance_ More...
 

Member Typedef Documentation

Definition at line 29 of file singleton.hpp.

using instance_type = InstanceType

Definition at line 28 of file singleton.hpp.

Definition at line 30 of file singleton.hpp.

Constructor & Destructor Documentation

singleton ( )
default
singleton ( const singleton< InstanceType, destroy_on_exit > &  )
delete

non-copyable: delete copy-constructor

Member Function Documentation

static instance_pointer create_instance ( )
static

create instance of SubInstanceType and move into singleton

singleton<InstanceType, destroy_on_exit>::instance_pointer create_instance ( )

Definition at line 75 of file singleton.hpp.

References foxxll::register_exit_handler().

void destroy_instance ( )
static

destroy singleton and mark as invalid

Definition at line 87 of file singleton.hpp.

static instance_pointer get_instance ( )
inlinestatic

return instance or create base instance if empty

Definition at line 41 of file singleton.hpp.

static instance_type& get_ref ( )
inlinestatic

Definition at line 49 of file singleton.hpp.

singleton& operator= ( const singleton< InstanceType, destroy_on_exit > &  )
delete

non-copyable: delete assignment operator

Member Data Documentation

singleton< InstanceType, destroy_on_exit >::volatile_instance_pointer instance_ = nullptr
staticprivate

singleton object instance

Definition at line 66 of file singleton.hpp.

Referenced by singleton< disk_queues >::get_instance(), and singleton< disk_queues >::get_ref().

std::mutex singleton_mutex_
staticprivate

mutex to protect instance_

Definition at line 69 of file singleton.hpp.


The documentation for this class was generated from the following file: