libjmmcg  build_2783
A C++ library containing an eclectic mix of useful, advanced components.
jmmcg::factory::clone< ID_, Obj_, Except_, Ret_, NotFound_, CreatFn_, Cont_ > Class Template Reference

A factory that manufactures a clone of an instance of the specified return-type for a specified key that has been registered with the factory. More...

#include <factory.hpp>

Inheritance diagram for jmmcg::factory::clone< ID_, Obj_, Except_, Ret_, NotFound_, CreatFn_, Cont_ >:
[legend]
Collaboration diagram for jmmcg::factory::clone< ID_, Obj_, Except_, Ret_, NotFound_, CreatFn_, Cont_ >:
[legend]

Public Types

typedef base< ID_, Obj_, Except_, Ret_, NotFound_, CreatFn_, Cont_ > base_t
 
typedef base_t::id_type id_type
 
typedef base_t::createable_type createable_type
 
typedef base_t::created_type created_type
 
typedef Cont_::mapped_type::first_type::value_type::lock_traits lock_traits
 
- Public Types inherited from jmmcg::factory::base< ID_, Obj_, Except_, Ret_, NotFound_, CreatFn_, Cont_ >
typedef Cont_ container_type
 
typedef container_type::key_type id_type
 
typedef container_type::value_type value_type
 
typedef container_type::mapped_type createable_type
 
typedef container_type::mapped_type mapped_type
 
typedef container_type::size_type size_type
 
typedef Ret_ created_type
 

Public Member Functions

constexpr __stdcall clone ()
 
virtual __stdcall ~clone ()
 
virtual created_type __fastcall make (const id_type &) const
 Returns a clone of an instance of the specified return-type for a specified key that has been registered with the factory. More...
 
- Public Member Functions inherited from jmmcg::factory::base< ID_, Obj_, Except_, Ret_, NotFound_, CreatFn_, Cont_ >
 base (base const &)=delete
 
virtual __stdcall ~base ()
 
bool __fastcall insert (const value_type &)
 Register a specific key & manufacturing method with the factory. More...
 
bool __fastcall insert (const id_type &, const createable_type &)
 Register a specific key & manufacturing method with the factory. More...
 
const container_type::size_type __fastcall erase (const id_type &id)
 Unregister a specific key from the factory. More...
 
bool __fastcall find (const id_type &) const
 Return true if that key has been registered with the factory. More...
 
bool __fastcall empty (void) const noexcept(true)
 Return true if any key has been registered with the factory. More...
 
const size_type __fastcall size (void) const noexcept(true)
 Return the total number of unique keys registered with the factory. More...
 
void __fastcall reserve (const size_type)
 Reserve capacity for a specified number of keys with the factory. More...
 
const container_type &__fastcall createables (void) const noexcept(true)
 Access the internal associative collection used to store the keys and methods for creating the return items. More...
 
container_type &__fastcall createables (void) noexcept(true)
 Access the internal associative collection used to store the keys and methods for creating the return items. More...
 

Additional Inherited Members

- Protected Member Functions inherited from jmmcg::factory::base< ID_, Obj_, Except_, Ret_, NotFound_, CreatFn_, Cont_ >
__stdcall base (void)
 
- Protected Attributes inherited from jmmcg::factory::base< ID_, Obj_, Except_, Ret_, NotFound_, CreatFn_, Cont_ >
container_type createables_
 

Detailed Description

template<typename ID_, class Obj_, class Except_, class Ret_ = std::unique_ptr<Obj_>, class NotFound_ = not_found<ID_, Ret_, Except_>, typename CreatFn_ = Ret_ (__fastcall *)(const Obj_ &), class Cont_ = jmmcg::rapid_insert_lookup::multimap<ID_, std::pair<jmmcg::shared_ptr<Obj_, jmmcg::ppd::api_lock_traits<jmmcg::ppd::platform_api, jmmcg::ppd::sequential_mode>>, CreatFn_> >>
class jmmcg::factory::clone< ID_, Obj_, Except_, Ret_, NotFound_, CreatFn_, Cont_ >

A factory that manufactures a clone of an instance of the specified return-type for a specified key that has been registered with the factory.

Note that this class is not thread-safe by default, at a minimum the container and shared pointer-type would need to be thread-safe.

Definition at line 171 of file factory.hpp.

Member Typedef Documentation

◆ base_t

template<typename ID_, class Obj_, class Except_, class Ret_ = std::unique_ptr<Obj_>, class NotFound_ = not_found<ID_, Ret_, Except_>, typename CreatFn_ = Ret_ (__fastcall *)(const Obj_ &), class Cont_ = jmmcg::rapid_insert_lookup::multimap<ID_, std::pair<jmmcg::shared_ptr<Obj_, jmmcg::ppd::api_lock_traits<jmmcg::ppd::platform_api, jmmcg::ppd::sequential_mode>>, CreatFn_> >>
typedef base<ID_, Obj_, Except_, Ret_, NotFound_, CreatFn_, Cont_> jmmcg::factory::clone< ID_, Obj_, Except_, Ret_, NotFound_, CreatFn_, Cont_ >::base_t

Definition at line 173 of file factory.hpp.

◆ createable_type

template<typename ID_, class Obj_, class Except_, class Ret_ = std::unique_ptr<Obj_>, class NotFound_ = not_found<ID_, Ret_, Except_>, typename CreatFn_ = Ret_ (__fastcall *)(const Obj_ &), class Cont_ = jmmcg::rapid_insert_lookup::multimap<ID_, std::pair<jmmcg::shared_ptr<Obj_, jmmcg::ppd::api_lock_traits<jmmcg::ppd::platform_api, jmmcg::ppd::sequential_mode>>, CreatFn_> >>
typedef base_t::createable_type jmmcg::factory::clone< ID_, Obj_, Except_, Ret_, NotFound_, CreatFn_, Cont_ >::createable_type

Definition at line 175 of file factory.hpp.

◆ created_type

template<typename ID_, class Obj_, class Except_, class Ret_ = std::unique_ptr<Obj_>, class NotFound_ = not_found<ID_, Ret_, Except_>, typename CreatFn_ = Ret_ (__fastcall *)(const Obj_ &), class Cont_ = jmmcg::rapid_insert_lookup::multimap<ID_, std::pair<jmmcg::shared_ptr<Obj_, jmmcg::ppd::api_lock_traits<jmmcg::ppd::platform_api, jmmcg::ppd::sequential_mode>>, CreatFn_> >>
typedef base_t::created_type jmmcg::factory::clone< ID_, Obj_, Except_, Ret_, NotFound_, CreatFn_, Cont_ >::created_type

Definition at line 176 of file factory.hpp.

◆ id_type

template<typename ID_, class Obj_, class Except_, class Ret_ = std::unique_ptr<Obj_>, class NotFound_ = not_found<ID_, Ret_, Except_>, typename CreatFn_ = Ret_ (__fastcall *)(const Obj_ &), class Cont_ = jmmcg::rapid_insert_lookup::multimap<ID_, std::pair<jmmcg::shared_ptr<Obj_, jmmcg::ppd::api_lock_traits<jmmcg::ppd::platform_api, jmmcg::ppd::sequential_mode>>, CreatFn_> >>
typedef base_t::id_type jmmcg::factory::clone< ID_, Obj_, Except_, Ret_, NotFound_, CreatFn_, Cont_ >::id_type

Definition at line 174 of file factory.hpp.

◆ lock_traits

template<typename ID_, class Obj_, class Except_, class Ret_ = std::unique_ptr<Obj_>, class NotFound_ = not_found<ID_, Ret_, Except_>, typename CreatFn_ = Ret_ (__fastcall *)(const Obj_ &), class Cont_ = jmmcg::rapid_insert_lookup::multimap<ID_, std::pair<jmmcg::shared_ptr<Obj_, jmmcg::ppd::api_lock_traits<jmmcg::ppd::platform_api, jmmcg::ppd::sequential_mode>>, CreatFn_> >>
typedef Cont_::mapped_type::first_type::value_type::lock_traits jmmcg::factory::clone< ID_, Obj_, Except_, Ret_, NotFound_, CreatFn_, Cont_ >::lock_traits

Definition at line 177 of file factory.hpp.

Constructor & Destructor Documentation

◆ clone()

template<typename ID_ , class Obj_ , class Except_ , class Ret_ , class NotFound_ , typename CreatFn_ , class Cont_ >
constexpr jmmcg::factory::clone< ID_, Obj_, Except_, Ret_, NotFound_, CreatFn_, Cont_ >::clone ( void  )
inlineconstexpr

Definition at line 128 of file factory_impl.hpp.

◆ ~clone()

template<typename ID_ , class Obj_ , class Except_ , class Ret_ , class NotFound_ , typename CreatFn_ , class Cont_ >
jmmcg::factory::clone< ID_, Obj_, Except_, Ret_, NotFound_, CreatFn_, Cont_ >::~clone ( void  )
inlinevirtual

Definition at line 133 of file factory_impl.hpp.

Member Function Documentation

◆ make()

template<typename ID_ , class Obj_ , class Except_ , class Ret_ , class NotFound_ , typename CreatFn_ , class Cont_ >
clone< ID_, Obj_, Except_, Ret_, NotFound_, CreatFn_, Cont_ >::created_type jmmcg::factory::clone< ID_, Obj_, Except_, Ret_, NotFound_, CreatFn_, Cont_ >::make ( const id_type id) const
inlinevirtual

Returns a clone of an instance of the specified return-type for a specified key that has been registered with the factory.

Definition at line 137 of file factory_impl.hpp.


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