DUNE-FEM (unstable)

Dune::Fem::SingletonList< Key, Object, Factory > Class Template Reference

Singleton list for key/object pairs. More...

#include <dune/fem/storage/singletonlist.hh>

Static Public Member Functions

static ListType & singletonList ()
 
template<class... Args>
static auto getObject (const KeyType &key, Args &&... args) -> std::enable_if_t< std::is_same< decltype(FactoryType::createObject(key, std::forward< Args >(args)...)), ObjectType * >::value, ObjectType & >
 
static void removeObject (const ObjectType &object)
 

Detailed Description

template<class Key, class Object, class Factory = DefaultSingletonFactory< Key, Object >>
class Dune::Fem::SingletonList< Key, Object, Factory >

Singleton list for key/object pairs.

A singleton list guarantees that for any valid key at most one object is created.

Parameters
Keytype of keys
Objecttype of objects
Factoryfactory class creating objects from keys. The default just passes the key to the object's constructor.

Member Function Documentation

◆ getObject()

template<class Key , class Object , class Factory = DefaultSingletonFactory< Key, Object >>
template<class... Args>
static auto Dune::Fem::SingletonList< Key, Object, Factory >::getObject ( const KeyType &  key,
Args &&...  args 
) -> std::enable_if_t< std::is_same< decltype( FactoryType::createObject( key, std::forward< Args >( args )... ) ), ObjectType * >::value, ObjectType & >
inlinestatic

return reference to the object for given key. If the object does not exist, then it is created first, otherwise the reference counter is increased.

References DUNE_THROW, and Dune::Fem::SingletonList< Key, Object, Factory >::singletonList().

Referenced by Dune::Fem::DiscreteFunctionSpaceDefault< FunctionSpaceTraits >::auxiliaryDofs(), and Dune::Fem::DofManagerFactory< DofManagerImp >::instance().

◆ removeObject()

template<class Key , class Object , class Factory = DefaultSingletonFactory< Key, Object >>
static void Dune::Fem::SingletonList< Key, Object, Factory >::removeObject ( const ObjectType &  object)
inlinestatic

decrease ref counter for this object, if ref counter is zero, object is deleted

References DUNE_THROW, and Dune::Fem::SingletonList< Key, Object, Factory >::singletonList().

Referenced by Dune::Fem::DofManagerFactory< DofManagerImp >::deleteDofManager().

◆ singletonList()

template<class Key , class Object , class Factory = DefaultSingletonFactory< Key, Object >>
static ListType& Dune::Fem::SingletonList< Key, Object, Factory >::singletonList ( )
inlinestatic

list that store pairs of key/object pointers singleton list

list that store pairs of key/object pointers

References Dune::Fem::Singleton< Object >::instance().

Referenced by Dune::Fem::SingletonList< Key, Object, Factory >::getObject(), and Dune::Fem::SingletonList< Key, Object, Factory >::removeObject().


The documentation for this class was generated from the following file:
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.80.0 (Apr 27, 22:29, 2024)