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 189 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 194 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 192 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 213 of file AttachedVirtualFunction.h.

214  {
215  static std::once_flag flag;
216  std::call_once( flag, []{
217  // Register in the table an adaptor thunk that downcasts the object
218  auto implementation = Implementation();
219  Register< Subclass >( [=]( This &obj, Arguments &&...arguments ){
220  return implementation(
221  static_cast< Subclass& >( obj ),
222  std::forward< Arguments >( arguments )... );
223  });
224  });
225  }

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 205 of file AttachedVirtualFunction.h.

207  {
208  return Overridden::Implementation()(
209  object, std::forward< Arguments >( arguments )... );
210  }

◆ Implementation()

auto DoGetTimeTrackView::Implementation
static

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

Definition at line 182 of file LabelTrackControls.cpp.

182  {
183  return [](LabelTrack &track) {
184  return std::make_shared<LabelTrackControls>( track.SharedPointer() );
185  };
186 }

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 files:
flag
static std::once_flag flag
Definition: WaveformView.cpp:1113
LabelTrack
A LabelTrack is a Track that holds labels (LabelStruct).
Definition: LabelTrack.h:88
AttachedVirtualFunction::Override::Implementation
static Function Implementation()
A function returning a std::function that must be defined so that the program links.
Definition: LabelTrackControls.cpp:182