Workspace 6.21.5
Classes | Namespaces | Macros
typedshaderimplementationfactory.h File Reference
#include "Rendering/SceneComponents/scenerenderer.h"
#include "Rendering/rendering_api.h"
#include "shaderimplementationfactory.h"
#include "shaderimplementationfactorytraits.h"
Include dependency graph for typedshaderimplementationfactory.h:
This graph shows which files directly or indirectly include this file:

Classes

class  TypedShaderImplementationFactory< T >
 

Namespaces

namespace  CSIRO
 Top level namespace for all Workspace code.
 
namespace  CSIRO::Rendering
 Rendering of meshed models.
 

Macros

#define DEFINE_SHADERIMPLEMENTATION_FACTORY(T, P)    DEFINE_SHADERIMPLEMENTATION_FACTORY_NAMED(T, P, #T)
 
#define DEFINE_SHADERIMPLEMENTATION_FACTORY_NAMED(T, P, N)
 

Macro Definition Documentation

◆ DEFINE_SHADERIMPLEMENTATION_FACTORY

#define DEFINE_SHADERIMPLEMENTATION_FACTORY (   T,
 
)     DEFINE_SHADERIMPLEMENTATION_FACTORY_NAMED(T, P, #T)
Parameters
TThe ShaderImplementation to define a factory for. It can have scope qualification if required, but that will show up as part of the name. Either employ a using declaration to make the scoping unnecessary or else use the DEFINE_SHADERIMPLEMENTATION_NAMED macro.
PA reference to the WorkspacePlugin instance this ShaderImplementation belongs to. See ShaderImplementationFactory::getPlugin() for more details.

Simply forwards to DEFINE_SHADERIMPLEMENTATION_FACTORY_NAMED with the N parameter set to T in string form and the Im parameter set to an empty string.

See also
DECLARE_WORKSPACE_OPERATION_FACTORY

◆ DEFINE_SHADERIMPLEMENTATION_FACTORY_NAMED

#define DEFINE_SHADERIMPLEMENTATION_FACTORY_NAMED (   T,
  P,
 
)
Parameters
TThe ShaderImplementation to define a factory for. It can have scope qualification if required.
PA reference to the WorkspacePlugin instance this ShaderImplementation belongs to. See ShaderImplementationFactory::getPlugin() for more details.
NThe name to use for the ShaderImplementation T. This will be seen by users and will also be used to uniquely identify the ShaderImplementation within the specified plugin, P. See ShaderImplementationFactory::getType() for more details.
Note
Normally, this macro would not be used directly unless T was not a suitable name for the ShaderImplementation. In most instances, N will be the same as T and the DEFINE_SHADERIMPLEMENTATION_NAMED macro would be easier to use.

This macro defines the explicit specializations of the functions in ShaderImplementationFactoryTraits for the type T. They are defined as forwarding functions to their corresponding equivalents in TypedShaderImplementationFactory<T>. This technique ensures that the function implementations for ShaderImplementationFactoryTraits are only ever defined in the one place. Specifically, it ensures that T shaderimpls are always allocated and deleted in the same file when performed through the ShaderImplementationFactoryTraits class.

The macro also takes care of explicitly instantiating TypedShaderImplementationFactory<T>.

Warning
Never use this macro in a header. It should only ever be used in an implementation file so that other compilation units do not see the implementation of each of the TypedShaderImplementationFactory member functions. This prevents compilers from inlining the creation and deletion of ShaderImplementation's, which is the whole point of the macro. The normal usage of this macro is to put it at the end of the implementation file defining the implementation of T, outside of any namespace(s).
See also
DECLARE_SHADERIMPLEMENTATION_FACTORY