SPH
Public Member Functions | List of all members
JobContext Class Reference

Data exchanged by jobs. More...

#include <Job.h>

Inheritance diagram for JobContext:
Polymorphic

Public Member Functions

 JobContext ()=default
 
template<typename TValue >
 JobContext (SharedPtr< TValue > value)
 
template<typename TValue >
SharedPtr< TValue > getValue () const
 Returns the stored value. More...
 
template<typename TValue >
SharedPtr< TValue > tryGetValue () const
 Returns the stored value or nullptr if the provided type TValue does not match the type of the stored value. More...
 
JobContext clone () const
 Duplicates the stored data. More...
 
void release ()
 Releases all allocated data. More...
 
- Public Member Functions inherited from Polymorphic
virtual ~Polymorphic ()
 

Detailed Description

Data exchanged by jobs.

The context is a variant, containing either particle data, material or geometry. Each job receives a number of contexts as inputs, performs its operation and returns contexts as a result. The returned context can be the same as the input context; this is mostly used by jobs than perform a minor modification of the input.

Definition at line 52 of file Job.h.

Constructor & Destructor Documentation

◆ JobContext() [1/2]

JobContext::JobContext ( )
default

◆ JobContext() [2/2]

template<typename TValue >
JobContext::JobContext ( SharedPtr< TValue >  value)

Definition at line 20 of file Job.inl.h.

Member Function Documentation

◆ clone()

NAMESPACE_SPH_BEGIN JobContext JobContext::clone ( ) const

Duplicates the stored data.

Note that JobContext has a pointer semantics, a copy will thus reference the same object as the original. Use this function to perform a deep copy and return an independent instance.

Definition at line 11 of file Job.cpp.

◆ getValue()

template<typename TValue >
SharedPtr< TValue > JobContext::getValue

Returns the stored value.

Type TValue can be either ParticleData, IMaterial or IDomain. If the type of the stored value is different or no value is stored, InvalidSetup exception is thrown.

Definition at line 25 of file Job.inl.h.

◆ release()

void JobContext::release ( )

Releases all allocated data.

Definition at line 24 of file Job.cpp.

◆ tryGetValue()

template<typename TValue >
SharedPtr< TValue > JobContext::tryGetValue

Returns the stored value or nullptr if the provided type TValue does not match the type of the stored value.

Type TValue can be either ParticleData, IMaterial or IDomain.

Definition at line 35 of file Job.inl.h.


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