OGS
ProcessLib::Assembly::CumulativeStats< Data > Class Template Reference

Detailed Description

template<typename Data>
class ProcessLib::Assembly::CumulativeStats< Data >

Definition at line 69 of file MatrixAssemblyStats.h.

#include <MatrixAssemblyStats.h>

Inheritance diagram for ProcessLib::Assembly::CumulativeStats< Data >:
[legend]
Collaboration diagram for ProcessLib::Assembly::CumulativeStats< Data >:
[legend]

Public Member Functions

std::shared_ptr< CumulativeStats< Data > > clone ()
 
 CumulativeStats (CumulativeStats< Data > const &other)=delete
 
 CumulativeStats (CumulativeStats< Data > &other)
 
 CumulativeStats (CumulativeStats< Data > &&other)
 
 ~CumulativeStats ()
 
void print () const
 

Static Public Member Functions

static std::shared_ptr< CumulativeStats< Data > > create ()
 

Public Attributes

Data data
 

Private Types

using Base = std::enable_shared_from_this<CumulativeStats<Data>>
 

Private Member Functions

 CumulativeStats ()
 

Private Attributes

std::shared_ptr< CumulativeStats< Data > > parent_
 
std::shared_ptr< std::mutex > parent_mutex_
 

Member Typedef Documentation

◆ Base

template<typename Data >
using ProcessLib::Assembly::CumulativeStats< Data >::Base = std::enable_shared_from_this<CumulativeStats<Data>>
private

Definition at line 72 of file MatrixAssemblyStats.h.

Constructor & Destructor Documentation

◆ CumulativeStats() [1/4]

template<typename Data >
ProcessLib::Assembly::CumulativeStats< Data >::CumulativeStats ( CumulativeStats< Data > const & other)
delete

◆ CumulativeStats() [2/4]

template<typename Data >
ProcessLib::Assembly::CumulativeStats< Data >::CumulativeStats ( CumulativeStats< Data > & other)
inline

Definition at line 92 of file MatrixAssemblyStats.h.

93 : Base{other},
94 data{},
95 parent_{other.parent_ ? other.parent_ : other.shared_from_this()},
96 parent_mutex_{other.parent_mutex_}
97 {
98 }
std::shared_ptr< std::mutex > parent_mutex_
std::enable_shared_from_this< CumulativeStats< Data > > Base
std::shared_ptr< CumulativeStats< Data > > parent_

◆ CumulativeStats() [3/4]

template<typename Data >
ProcessLib::Assembly::CumulativeStats< Data >::CumulativeStats ( CumulativeStats< Data > && other)
inline

Definition at line 100 of file MatrixAssemblyStats.h.

101 : parent_{std::move(other.parent_)},
102 parent_mutex_{std::move(other.parent_mutex_)}
103 {
104 std::swap(data, other.data);
105 }

References ProcessLib::Assembly::CumulativeStats< Data >::data.

◆ ~CumulativeStats()

template<typename Data >
ProcessLib::Assembly::CumulativeStats< Data >::~CumulativeStats ( )
inline

Definition at line 107 of file MatrixAssemblyStats.h.

108 {
109 if (!parent_)
110 {
111 return;
112 }
113
114 std::lock_guard<std::mutex> const lock(*parent_mutex_);
115
116 DBUG("Adding cumulative stats to parent.");
117
118 parent_->data += data;
119 }
void DBUG(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:30

References ProcessLib::Assembly::CumulativeStats< Data >::data, DBUG(), ProcessLib::Assembly::CumulativeStats< Data >::parent_, and ProcessLib::Assembly::CumulativeStats< Data >::parent_mutex_.

◆ CumulativeStats() [4/4]

template<typename Data >
ProcessLib::Assembly::CumulativeStats< Data >::CumulativeStats ( )
inlineprivate

Definition at line 124 of file MatrixAssemblyStats.h.

124: parent_mutex_{std::make_shared<std::mutex>()} {}

Referenced by ProcessLib::Assembly::CumulativeStats< Data >::create().

Member Function Documentation

◆ clone()

template<typename Data >
std::shared_ptr< CumulativeStats< Data > > ProcessLib::Assembly::CumulativeStats< Data >::clone ( )
inline

Definition at line 85 of file MatrixAssemblyStats.h.

86 {
87 return std::make_shared<CumulativeStats<Data>>(*this);
88 }

◆ create()

template<typename Data >
static std::shared_ptr< CumulativeStats< Data > > ProcessLib::Assembly::CumulativeStats< Data >::create ( )
inlinestatic

◆ print()

template<typename Data >
void ProcessLib::Assembly::CumulativeStats< Data >::print ( ) const
inline

Definition at line 121 of file MatrixAssemblyStats.h.

121{ data.print(); }

References ProcessLib::Assembly::CumulativeStats< Data >::data.

Member Data Documentation

◆ data

◆ parent_

template<typename Data >
std::shared_ptr<CumulativeStats<Data> > ProcessLib::Assembly::CumulativeStats< Data >::parent_
private

◆ parent_mutex_

template<typename Data >
std::shared_ptr<std::mutex> ProcessLib::Assembly::CumulativeStats< Data >::parent_mutex_
private

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