ECCE @ EIC Software
Reference for
ECCE @ EIC
simulation and reconstruction software on GitHub
Home page
Related Pages
Modules
Namespaces
Classes
Files
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
G4MulticoutDestination.hh
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file G4MulticoutDestination.hh
1
// ********************************************************************
2
// * License and Disclaimer *
3
// * *
4
// * The Geant4 software is copyright of the Copyright Holders of *
5
// * the Geant4 Collaboration. It is provided under the terms and *
6
// * conditions of the Geant4 Software License, included in the file *
7
// * LICENSE and available at http://cern.ch/geant4/license . These *
8
// * include a list of copyright holders. *
9
// * *
10
// * Neither the authors of this software system, nor their employing *
11
// * institutes,nor the agencies providing financial support for this *
12
// * work make any representation or warranty, express or implied, *
13
// * regarding this software system or assume any liability for its *
14
// * use. Please see the license in the file LICENSE and URL above *
15
// * for the full disclaimer and the limitation of liability. *
16
// * *
17
// * This code implementation is the result of the scientific and *
18
// * technical work of the GEANT4 collaboration. *
19
// * By using, copying, modifying or distributing the software (or *
20
// * any work based on the software) you agree to acknowledge its *
21
// * use in resulting scientific publications, and indicate your *
22
// * acceptance of all terms of the Geant4 Software license. *
23
// ********************************************************************
24
//
25
//
26
//
27
//
28
// --------------------------------------------------------------------
29
// GEANT 4 class header file
30
//
31
// G4MulticoutDestination.hh
32
//
33
// Class description:
34
//
35
// Extends G4coutDestination and allows multiple G4coutDestination objects
36
// to be chained in the same job.
37
// Note that formatters can be attached to this destination that will apply
38
// them before passing over the message to the child destination.
39
//
40
// Usage:
41
// User should create and set-up G4coutDestination objects the usual way
42
// these should then be added to an instance of this container class
43
// this class should then be added to the streaming. E.g.
44
// class MyCout1 : public G4coutDestination {};
45
// class MyCout2 : public G4coutDestination {};
46
// auto multi = new G4MulticoutDestination();
47
// multi->push_back( G4coutDestinationUPtr( new MyCout1 ) );
48
// multi->push_back( G4coutDestinationUPtr( new MyCout2 ) );
49
// G4coutbuf.SetDestination( multi ); // or G4cerrbuf
50
51
// ---------------- G4MulticoutDestination ----------------
52
//
53
// Author: A.Dotti (SLAC), April 2017
54
// --------------------------------------------------------------------
55
#ifndef G4MULTICOUTDESTINATION_HH_
56
#define G4MULTICOUTDESTINATION_HH_
57
58
#include <memory>
59
#include <vector>
60
61
#include "
G4coutDestination.hh
"
62
63
using
G4coutDestinationUPtr
= std::unique_ptr<G4coutDestination>;
64
using
G4coutDestinationVector
= std::vector<G4coutDestinationUPtr>;
65
66
class
G4MulticoutDestination
:
public
G4coutDestination
,
67
public
G4coutDestinationVector
68
{
69
public
:
70
71
G4MulticoutDestination
() =
default
;
72
virtual
~G4MulticoutDestination
() {}
73
74
// Forward call to contained destination. Note that the message may have
75
// been modified by formatters attached to this
76
virtual
G4int
ReceiveG4cout
(
const
G4String
& msg)
override
77
{
78
G4bool
result =
true
;
79
std::for_each( begin(), end(),
80
[&](
G4coutDestinationUPtr
&
e
) { result &= (e->ReceiveG4cout_(msg)==0); }
81
);
82
return
( result ? 0 : -1);
83
}
84
85
virtual
G4int
ReceiveG4cerr
(
const
G4String
& msg)
override
86
{
87
G4bool
result =
true
;
88
std::for_each( begin(), end(),
89
[&](
G4coutDestinationUPtr
&
e
) { result &= (e->ReceiveG4cerr_(msg)==0); }
90
);
91
return
( result ? 0 : -1);
92
}
93
};
94
95
#endif
/* G4MULTICOUTDESTINATION_HH_ */
geant4
tree
geant4-10.6-release
source
global
management
include
G4MulticoutDestination.hh
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:25:21
using
1.8.2 with
ECCE GitHub integration