Audacity  3.0.3
Public Types | Public Member Functions | Static Public Member Functions | List of all members
AttachedVirtualFunction< Tag, Return, This, Arguments >::Override< Subclass, Overridden > Struct Template Reference

For defining overrides of the method. More...

#include <AttachedVirtualFunction.h>

Inheritance diagram for AttachedVirtualFunction< Tag, Return, This, Arguments >::Override< Subclass, Overridden >:
[legend]
Collaboration diagram for AttachedVirtualFunction< Tag, Return, This, Arguments >::Override< Subclass, Overridden >:
[legend]

Public Types

using Object = Subclass
 Shadowing Overridden::Object. More...
 
using Function = std::function< Return(Object &, Arguments...) >
 Shadowing Overridden::Function, giving the first argument a more specific type. More...
 
- Public Types inherited from AttachedVirtualFunction< Tag, Return, This, Arguments >
using Object = This
 This member name is declared in this class template and redeclared in each override. More...
 
using Function = std::function< Return(Object &, Arguments...) >
 This member name is declared in this class template and redeclared in each override. More...
 

Public Member Functions

 Override ()
 At least one static instance must be created; more instances are harmless. More...
 
- Public Member Functions inherited from AttachedVirtualFunction< Tag, Return, This, Arguments >
 AttachedVirtualFunction ()
 At least one static instance must be created; more instances are harmless. More...
 

Static Public Member Functions

static Function Implementation ()
 A function returning a std::function that must be defined so that the program links. More...
 
static Return Callthrough (typename Overridden::Object &object, Arguments &&...arguments)
 May be used in the body of the overriding function, defining it in terms of the overridden one. More...
 
- Static Public Member Functions inherited from AttachedVirtualFunction< Tag, Return, This, Arguments >
static Function Implementation ()
 A function returning a std::function, which you must define so that the program links. More...
 
static Return Call (This &obj, Arguments &&...arguments)
 Invoke the method – but only after static initialization time. More...
 

Detailed Description

template<typename Tag, typename Return, typename This, typename... Arguments>
template<typename Subclass, typename Overridden = AttachedVirtualFunction>
struct AttachedVirtualFunction< Tag, Return, This, Arguments >::Override< Subclass, Overridden >

For defining overrides of the method.

Template Parameters
Subclassthe more specific subclass of This
OverriddenThe immediately overridden version, defaulting to the base version

Definition at line 183 of file AttachedVirtualFunction.h.

Member Typedef Documentation

◆ Function

template<typename Tag , typename Return , typename This , typename... Arguments>
template<typename Subclass , typename Overridden = AttachedVirtualFunction>
using AttachedVirtualFunction< Tag, Return, This, Arguments >::Override< Subclass, Overridden >::Function = std::function< Return( Object&, Arguments... ) >

Shadowing Overridden::Function, giving the first argument a more specific type.

Definition at line 188 of file AttachedVirtualFunction.h.

◆ Object

template<typename Tag , typename Return , typename This , typename... Arguments>
template<typename Subclass , typename Overridden = AttachedVirtualFunction>
using AttachedVirtualFunction< Tag, Return, This, Arguments >::Override< Subclass, Overridden >::Object = Subclass

Shadowing Overridden::Object.

Definition at line 186 of file AttachedVirtualFunction.h.

Constructor & Destructor Documentation

◆ Override()

template<typename Tag , typename Return , typename This , typename... Arguments>
template<typename Subclass , typename Overridden = AttachedVirtualFunction>
AttachedVirtualFunction< Tag, Return, This, Arguments >::Override< Subclass, Overridden >::Override ( )
inline

At least one static instance must be created; more instances are harmless.

(There will be others if there are any further overrides.)

Definition at line 207 of file AttachedVirtualFunction.h.

208  {
209  static std::once_flag flag;
210  std::call_once( flag, []{
211  // Register in the table an adaptor thunk that downcasts the object
212  auto implementation = Implementation();
213  Register< Subclass >( [=]( This &obj, Arguments &&...arguments ){
214  return implementation(
215  static_cast< Subclass& >( obj ),
216  std::forward< Arguments >( arguments )... );
217  });
218  });
219  }

References flag, and AttachedVirtualFunction< Tag, Return, This, Arguments >::Override< Subclass, Overridden >::Implementation().

Here is the call graph for this function:

Member Function Documentation

◆ Callthrough()

template<typename Tag , typename Return , typename This , typename... Arguments>
template<typename Subclass , typename Overridden = AttachedVirtualFunction>
static Return AttachedVirtualFunction< Tag, Return, This, Arguments >::Override< Subclass, Overridden >::Callthrough ( typename Overridden::Object &  object,
Arguments &&...  arguments 
)
inlinestatic

May be used in the body of the overriding function, defining it in terms of the overridden one.

Definition at line 199 of file AttachedVirtualFunction.h.

201  {
202  return Overridden::Implementation()(
203  object, std::forward< Arguments >( arguments )... );
204  }

◆ Implementation()

template<typename Tag , typename Return , typename This , typename... Arguments>
template<typename Subclass , typename Overridden = AttachedVirtualFunction>
static Function AttachedVirtualFunction< Tag, Return, This, Arguments >::Override< Subclass, Overridden >::Implementation ( )
static

A function returning a std::function that must be defined so that the program links.

Referenced by AttachedVirtualFunction< Tag, Return, This, Arguments >::Override< Subclass, Overridden >::Override().

Here is the caller graph for this function:

The documentation for this struct was generated from the following file:
flag
static std::once_flag flag
Definition: WaveformView.cpp:1119
AttachedVirtualFunction::Override::Implementation
static Function Implementation()
A function returning a std::function that must be defined so that the program links.