Geant4 11.2.2
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4BuffercoutDestination Class Reference

#include <G4BuffercoutDestination.hh>

+ Inheritance diagram for G4BuffercoutDestination:

Classes

class  BufferImpl
 

Public Member Functions

 G4BuffercoutDestination (std::size_t maxSize=0)
 
 ~G4BuffercoutDestination () override
 
G4int ReceiveG4debug (const G4String &msg) override
 
G4int ReceiveG4cout (const G4String &msg) override
 
G4int ReceiveG4cerr (const G4String &msg) override
 
virtual G4int FlushG4debug ()
 
virtual G4int FlushG4cout ()
 
virtual G4int FlushG4cerr ()
 
virtual void Finalize ()
 
void SetMaxSize (std::size_t max)
 
std::size_t GetMaxSize () const
 
- Public Member Functions inherited from G4coutDestination
 G4coutDestination ()=default
 
virtual ~G4coutDestination ()=default
 
void AddDebugTransformer (const Transformer &t)
 
void AddDebugTransformer (Transformer &&t)
 
void AddCoutTransformer (const Transformer &t)
 
void AddCoutTransformer (Transformer &&t)
 
void AddCerrTransformer (const Transformer &t)
 
void AddCerrTransformer (Transformer &&t)
 
virtual void ResetTransformers ()
 
G4int ReceiveG4debug_ (const G4String &msg)
 
G4int ReceiveG4cout_ (const G4String &msg)
 
G4int ReceiveG4cerr_ (const G4String &msg)
 

Protected Attributes

std::size_t m_maxSize = 0
 
std::unique_ptr< BufferImplm_buffer_dbg
 
std::unique_ptr< BufferImplm_buffer_out
 
std::unique_ptr< BufferImplm_buffer_err
 
- Protected Attributes inherited from G4coutDestination
std::vector< TransformertransformersDebug
 
std::vector< TransformertransformersCout
 
std::vector< TransformertransformersCerr
 

Additional Inherited Members

- Public Types inherited from G4coutDestination
using Transformer = std::function<G4bool(G4String&)>
 
- Static Protected Attributes inherited from G4coutDestination
static G4MTGLOB_DLL G4coutDestinationmasterG4coutDestination = nullptr
 

Detailed Description

Definition at line 46 of file G4BuffercoutDestination.hh.

Constructor & Destructor Documentation

◆ G4BuffercoutDestination()

G4BuffercoutDestination::G4BuffercoutDestination ( std::size_t maxSize = 0)
explicit

Definition at line 88 of file G4BuffercoutDestination.cc.

89 : m_maxSize(max),
90 m_buffer_dbg(std::make_unique<BufferImpl>(max)),
91 m_buffer_out(std::make_unique<BufferImpl>(max)),
92 m_buffer_err(std::make_unique<BufferImpl>(max, [](auto& s) { std::cerr << s << std::flush; }))
93{}
std::unique_ptr< BufferImpl > m_buffer_err
std::unique_ptr< BufferImpl > m_buffer_out
std::unique_ptr< BufferImpl > m_buffer_dbg

◆ ~G4BuffercoutDestination()

G4BuffercoutDestination::~G4BuffercoutDestination ( )
override

Definition at line 96 of file G4BuffercoutDestination.cc.

Member Function Documentation

◆ Finalize()

void G4BuffercoutDestination::Finalize ( )
virtual

Definition at line 99 of file G4BuffercoutDestination.cc.

Referenced by ~G4BuffercoutDestination().

◆ FlushG4cerr()

G4int G4BuffercoutDestination::FlushG4cerr ( )
virtual

Definition at line 137 of file G4BuffercoutDestination.cc.

138{
139 return m_buffer_err->Flush();
140}

Referenced by Finalize().

◆ FlushG4cout()

G4int G4BuffercoutDestination::FlushG4cout ( )
virtual

Definition at line 131 of file G4BuffercoutDestination.cc.

132{
133 return m_buffer_out->Flush();
134}

Referenced by Finalize().

◆ FlushG4debug()

G4int G4BuffercoutDestination::FlushG4debug ( )
virtual

Definition at line 125 of file G4BuffercoutDestination.cc.

126{
127 return m_buffer_dbg->Flush();
128}

Referenced by Finalize().

◆ GetMaxSize()

std::size_t G4BuffercoutDestination::GetMaxSize ( ) const
inline

Definition at line 69 of file G4BuffercoutDestination.hh.

69{ return m_maxSize; }

◆ ReceiveG4cerr()

G4int G4BuffercoutDestination::ReceiveG4cerr ( const G4String & msg)
overridevirtual

Reimplemented from G4coutDestination.

Definition at line 119 of file G4BuffercoutDestination.cc.

120{
121 return m_buffer_err->Receive(msg);
122}

◆ ReceiveG4cout()

G4int G4BuffercoutDestination::ReceiveG4cout ( const G4String & msg)
overridevirtual

Reimplemented from G4coutDestination.

Definition at line 113 of file G4BuffercoutDestination.cc.

114{
115 return m_buffer_out->Receive(msg);
116}

◆ ReceiveG4debug()

G4int G4BuffercoutDestination::ReceiveG4debug ( const G4String & msg)
overridevirtual

Reimplemented from G4coutDestination.

Definition at line 107 of file G4BuffercoutDestination.cc.

108{
109 return m_buffer_dbg->Receive(msg);
110}

◆ SetMaxSize()

void G4BuffercoutDestination::SetMaxSize ( std::size_t max)

Definition at line 143 of file G4BuffercoutDestination.cc.

144{
145 m_maxSize = max;
146 m_buffer_dbg->SetMaxSize(m_maxSize);
147 m_buffer_out->SetMaxSize(m_maxSize);
148 m_buffer_err->SetMaxSize(m_maxSize);
149}
T max(const T t1, const T t2)
brief Return the largest of the two arguments

Member Data Documentation

◆ m_buffer_dbg

std::unique_ptr<BufferImpl> G4BuffercoutDestination::m_buffer_dbg
protected

Definition at line 75 of file G4BuffercoutDestination.hh.

Referenced by FlushG4debug(), ReceiveG4debug(), and SetMaxSize().

◆ m_buffer_err

std::unique_ptr<BufferImpl> G4BuffercoutDestination::m_buffer_err
protected

Definition at line 77 of file G4BuffercoutDestination.hh.

Referenced by FlushG4cerr(), ReceiveG4cerr(), and SetMaxSize().

◆ m_buffer_out

std::unique_ptr<BufferImpl> G4BuffercoutDestination::m_buffer_out
protected

Definition at line 76 of file G4BuffercoutDestination.hh.

Referenced by FlushG4cout(), ReceiveG4cout(), and SetMaxSize().

◆ m_maxSize

std::size_t G4BuffercoutDestination::m_maxSize = 0
protected

Definition at line 72 of file G4BuffercoutDestination.hh.

Referenced by GetMaxSize(), and SetMaxSize().


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