suanPan
Toggle main menu visibility
Main Page
Related Pages
Topics
Namespaces
Namespace List
Namespace Members
All
a
b
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
u
v
w
Functions
a
b
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
u
w
Variables
Typedefs
Concepts
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
y
z
~
Variables
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
Enumerations
Related Symbols
c
g
o
p
s
t
Files
File List
File Members
All
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
u
v
w
Functions
a
b
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
u
v
w
Variables
s
Typedefs
a
b
c
d
e
g
i
l
m
n
o
r
s
t
Enumerations
Enumerator
Macros
▼
suanPan
Changelog
Contributor Covenant Code of Conduct
Contribution
►
Topics
►
Namespaces
►
Concepts
►
Classes
▼
Files
▼
File List
►
Checker
►
Constraint
►
Converger
►
Database
►
Developer
►
Domain
►
Element
►
Enhancement
►
Load
►
Material
►
MPI
►
Recorder
►
Resource
►
Section
►
Solver
►
Step
▼
Toolbox
►
argument.cpp
►
argument.h
►
arpack.cpp
►
arpack.h
►
command.cpp
►
command.h
►
container.h
Converter.cpp
►
Converter.h
Expression.cpp
Expression.h
►
ExpressionParser.cpp
►
ExpressionParser.h
►
IntegrationPlan.cpp
►
IntegrationPlan.h
LBFGS.hpp
►
misc.cpp
►
misc.h
Quaternion.hpp
►
resampling.cpp
►
resampling.h
ResourceHolder.h
►
response_spectrum.h
►
revision.h
►
ridders.hpp
►
shape.h
►
sort_color.hpp
►
sort_rcm.cpp
►
sort_rcm.h
sync_ostream.cpp
►
sync_ostream.h
tensor.cpp
►
tensor.h
►
thread_pool.hpp
►
utility.cpp
►
utility.h
►
UnitTest
►
suanPan.cpp
►
suanPan.h
►
File Members
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Modules
Pages
Concepts
Loading...
Searching...
No Matches
sync_ostream.h
Go to the documentation of this file.
1
/*******************************************************************************
2
* Copyright (C) 2017-2024 Theodore Chang
3
*
4
* This program is free software: you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation, either version 3 of the License, or
7
* (at your option) any later version.
8
*
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
13
*
14
* You should have received a copy of the GNU General Public License
15
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16
******************************************************************************/
17
18
#ifndef SYNC_OSTREAM_H
19
#define SYNC_OSTREAM_H
20
21
#include <mutex>
22
#include <ostream>
23
24
class
sync_ostream
{
25
std::unique_lock<std::mutex> print_lock;
26
std::ostream* ostream;
27
28
public
:
29
explicit
sync_ostream
(std::ostream&);
30
sync_ostream
(
const
sync_ostream
&) =
delete
;
31
sync_ostream
(
sync_ostream
&&) noexcept;
32
sync_ostream
& operator=(const
sync_ostream
&) = delete;
33
sync_ostream
& operator=(
sync_ostream
&&) noexcept;
34
~
sync_ostream
() = default;
35
36
template<typename
T
>
sync_ostream
& operator<<(
T
&& item) {
37
*ostream << std::forward<T>(item);
38
return
*
this
;
39
}
36
template<typename
T
>
sync_ostream
& operator<<(
T
&& item) {
…
}
40
};
24
class
sync_ostream
{
…
};
41
42
#endif
// SYNC_OSTREAM_H
sync_ostream
Definition
sync_ostream.h:24
sync_ostream::sync_ostream
sync_ostream(std::ostream &)
Definition
sync_ostream.cpp:25
sync_ostream::sync_ostream
sync_ostream(const sync_ostream &)=delete
DOF::T
@ T
Toolbox
sync_ostream.h
Generated by
1.10.0