SMTK  @SMTK_VERSION@
Simulation Modeling Tool Kit
Public Member Functions | Static Protected Member Functions | Friends | List of all members
smtk::common::Generator< Input, Output, Base > Class Template Reference

Interface generator class. More...

#include <Generator.h>

Inheritance diagram for smtk::common::Generator< Input, Output, Base >:
[legend]
Collaboration diagram for smtk::common::Generator< Input, Output, Base >:
[legend]

Public Member Functions

template<typename... T>
 Generator (T &&... all)
 
bool valid (const Input &) const override
 Loop over registered generators and return true if any of the generators' valid() calls return true; otherwise, return false.
 
Output operator() (const Input &) override
 Loop over registered generators and return an Output instance from the first generator (a) whose valid() call returns true, and (b) that successfully creates an instance of Output (without throwing).
 
- Public Member Functions inherited from smtk::common::GeneratorBase< Input, Output, detail::NullGeneratorBase >
 GeneratorBase (T &&... all)
 

Static Protected Member Functions

static std::weak_ptr< std::set< GeneratorBase< Input, Output, Base > * > > generators ()
 Even though the set of generators is static, we cannot guarantee its existence across compilation units due to our plugin-based architecture. More...
 

Friends

template<class U , class V , class W , class X >
class GeneratorType
 

Detailed Description

template<class Input, class Output, class Base = detail::NullGeneratorBase>
class smtk::common::Generator< Input, Output, Base >

Interface generator class.

Implements the base methods valid() and the function call operator as a loop over the registered GeneratorTypes. Also contains the static set of generator types.

Member Function Documentation

◆ generators()

template<class Input , class Output , class Base >
std::weak_ptr< std::set< GeneratorBase< Input, Output, Base > * > > smtk::common::Generator< Input, Output, Base >::generators
staticprotected

Even though the set of generators is static, we cannot guarantee its existence across compilation units due to our plugin-based architecture.

We therefore use a weak pointer to guard ourselves against the unlikely event of a generator implementation outliving its base generator class.


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