Nameless Engine
Loading...
Searching...
No Matches
ne::PipelineSharedPtr Class Reference

#include <PipelineSharedPtr.h>

Public Member Functions

 PipelineSharedPtr (std::shared_ptr< Pipeline > pPipeline, Material *pMaterialThatUsesPipeline)
 
 PipelineSharedPtr (std::shared_ptr< Pipeline > pPipeline, ComputeShaderInterface *pComputeShaderThatUsesPipeline)
 
 PipelineSharedPtr ()=default
 
 PipelineSharedPtr (const PipelineSharedPtr &)=delete
 
PipelineSharedPtroperator= (const PipelineSharedPtr &)=delete
 
 PipelineSharedPtr (PipelineSharedPtr &&other) noexcept
 
PipelineSharedPtroperator= (PipelineSharedPtr &&other) noexcept
 
bool isInitialized () const
 
void clear ()
 
void set (std::shared_ptr< Pipeline > pPipeline, Material *pMaterialThatUsesPipeline)
 
PipelinegetPipeline () const
 
Pipelineoperator-> () const
 

Private Member Functions

void clearPointerAndNotifyPipeline ()
 
void initialize (std::shared_ptr< Pipeline > pPipeline, Material *pMaterialThatUsesPipeline)
 
void initialize (std::shared_ptr< Pipeline > pPipeline, ComputeShaderInterface *pComputeShaderThatUsesPipeline)
 

Private Attributes

std::shared_ptr< PipelinepPipeline = nullptr
 
MaterialpMaterialThatUsesPipeline = nullptr
 
ComputeShaderInterfacepComputeShaderThatUsesPipeline = nullptr
 

Detailed Description

Small wrapper class for std::shared_ptr<Pipeline> to do some extra work when started/stopped referencing a pipeline.

Constructor & Destructor Documentation

◆ PipelineSharedPtr() [1/4]

ne::PipelineSharedPtr::PipelineSharedPtr ( std::shared_ptr< Pipeline pPipeline,
Material pMaterialThatUsesPipeline 
)
explicit

Constructs a new pointer for a material that uses a pipeline.

Parameters
pPipelinePipeline to store.
pMaterialThatUsesPipelineMaterial that stores this pointer.

◆ PipelineSharedPtr() [2/4]

ne::PipelineSharedPtr::PipelineSharedPtr ( std::shared_ptr< Pipeline pPipeline,
ComputeShaderInterface pComputeShaderThatUsesPipeline 
)
explicit

Constructs a new pointer for a compute shader interface that uses a pipeline.

Parameters
pPipelinePipeline to store.
pComputeShaderThatUsesPipelineCompute interface that stores this pointer.

◆ PipelineSharedPtr() [3/4]

ne::PipelineSharedPtr::PipelineSharedPtr ( )
default

Leaves the internal pointers initialized as nullptr.

◆ PipelineSharedPtr() [4/4]

ne::PipelineSharedPtr::PipelineSharedPtr ( PipelineSharedPtr &&  other)
noexcept

Move constructor.

Parameters
otherother object.

Member Function Documentation

◆ clear()

void ne::PipelineSharedPtr::clear ( )

Clears the pointer (sets to nullptr).

◆ clearPointerAndNotifyPipeline()

void ne::PipelineSharedPtr::clearPointerAndNotifyPipeline ( )
private

Clears stored shared pointer and notifies the Pipeline that we no longer reference it.

◆ getPipeline()

Pipeline * ne::PipelineSharedPtr::getPipeline ( ) const
inline

Returns pointer to underlying pipeline.

Warning
Do not delete returned pointer.
Returns
Raw pointer to the underlying pipeline.

◆ initialize() [1/2]

void ne::PipelineSharedPtr::initialize ( std::shared_ptr< Pipeline pPipeline,
ComputeShaderInterface pComputeShaderThatUsesPipeline 
)
private

Initializes internal state.

Parameters
pPipelinePipeline to store.
pComputeShaderThatUsesPipelineCompute interface that stores this pointer.

◆ initialize() [2/2]

void ne::PipelineSharedPtr::initialize ( std::shared_ptr< Pipeline pPipeline,
Material pMaterialThatUsesPipeline 
)
private

Initializes internal state.

Parameters
pPipelinePipeline to store.
pMaterialThatUsesPipelineMaterial that stores this pointer.

◆ isInitialized()

bool ne::PipelineSharedPtr::isInitialized ( ) const

Tells whether the internal pipeline was set or not.

Returns
Whether the internal pipeline was set or not.

◆ operator->()

Pipeline * ne::PipelineSharedPtr::operator-> ( ) const

Access operator.

Returns
Raw pointer to the underlying pipeline.

◆ operator=()

PipelineSharedPtr & ne::PipelineSharedPtr::operator= ( PipelineSharedPtr &&  other)
noexcept

Move assignment.

Parameters
otherother object.
Returns
Result of move assignment.

◆ set()

void ne::PipelineSharedPtr::set ( std::shared_ptr< Pipeline pPipeline,
Material pMaterialThatUsesPipeline 
)

Changes stored pipeline to the specified one.

Parameters
pPipelinePipeline to use.
pMaterialThatUsesPipelineMaterial that stores this pointer.

Member Data Documentation

◆ pComputeShaderThatUsesPipeline

ComputeShaderInterface* ne::PipelineSharedPtr::pComputeShaderThatUsesPipeline = nullptr
private

Compute shader interface that stores this pointer.

Remarks
If nullptr then pMaterialThatUsesPipeline is valid.

◆ pMaterialThatUsesPipeline

Material* ne::PipelineSharedPtr::pMaterialThatUsesPipeline = nullptr
private

Material that stores this pointer.

Remarks
If nullptr then pComputeShaderThatUsesPipeline is valid.

◆ pPipeline

std::shared_ptr<Pipeline> ne::PipelineSharedPtr::pPipeline = nullptr
private

Internally stored pipeline


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