ATLAS Offline Software
Loading...
Searching...
No Matches
OutputStream.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3*/
4
6
7//
8// includes
9//
10
12
13#include <EventLoop/Algorithm.h>
16
17//
18// method implementations
19//
20
22
23namespace EL
24{
25 const std::string OutputStream::optType = "EventLoop_OutputStreamType";
26 const std::string OutputStream::optMergeCmd = "EventLoop_MergeCmd";
27 const std::string OutputStream::optContainerSuffix = "EventLoop_DSSuffix";
28
29 void OutputStream ::
30 testInvariant () const
31 {
32 RCU_INVARIANT (!m_label.empty());
33 }
34
35
36
37 OutputStream ::
38 OutputStream ()
39 : m_label ("out"), m_output (nullptr)
40 {
41 RCU_NEW_INVARIANT (this);
42 }
43
44
45
46 OutputStream ::
47 OutputStream (const std::string& val_label)
48 : m_label (val_label), m_output (nullptr)
49 {
50 RCU_REQUIRE_SOFT (!val_label.empty());
51
52 RCU_NEW_INVARIANT (this);
53 }
54
55
56
57 OutputStream ::
58 OutputStream (const std::string& val_label, const std::string& val_type)
59 : m_label (val_label), m_output (nullptr)
60 {
61 RCU_REQUIRE_SOFT (!val_label.empty());
62
63 m_options.setString(optType, val_type);
64
65 RCU_NEW_INVARIANT (this);
66 }
67
68
69
70 OutputStream ::
71 OutputStream (const OutputStream& that)
72 : TObject (that), m_label (that.m_label),
73 m_options (that.m_options), m_output (nullptr)
74 {
75 RCU_READ_INVARIANT (&that);
76
77 if (that.m_output != nullptr)
78 {
79 m_output = dynamic_cast<SH::DiskOutput*>(that.m_output->Clone ());
80 RCU_ASSERT (m_output != nullptr);
81 }
82 }
83
84
85
86 OutputStream ::
87 ~OutputStream ()
88 {
90
91 delete m_output;
92 }
93
94
95
96 OutputStream& OutputStream ::
97 operator = (OutputStream that)
98 {
99 // no invariant used
100 that.swap (*this);
101 return *this;
102 }
103
104
105
106 void OutputStream ::
107 swap (OutputStream& that)
108 {
110 RCU_CHANGE_INVARIANT (&that);
111
112 m_label.swap (that.m_label);
113 m_options.swap (that.m_options);
114
115 SH::DiskOutput *tmp_output = m_output;
116 m_output = that.m_output;
117 that.m_output = tmp_output;
118 }
119
120
121
122 const std::string& OutputStream ::
123 label () const
124 {
125 RCU_READ_INVARIANT (this);
126 return m_label;
127 }
128
129
130
131 void OutputStream ::
132 label (const std::string& val_label)
133 {
135 RCU_REQUIRE_SOFT (!val_label.empty());
136 m_label = val_label;
137 }
138
139
140
141 SH::MetaObject *OutputStream ::
142 options ()
143 {
144 RCU_READ_INVARIANT (this);
145 return &m_options;
146 }
147
148
149
150 const SH::MetaObject *OutputStream ::
151 options () const
152 {
153 RCU_READ_INVARIANT (this);
154 return &m_options;
155 }
156
157
158
159 const SH::DiskOutput *OutputStream ::
160 output() const
161 {
162 RCU_READ_INVARIANT (this);
163 return m_output;
164 }
165
166
167
168 void OutputStream ::
169 output (SH::DiskOutput *output_swallow)
170 {
172 delete m_output;
173 m_output = output_swallow;
174 }
175}
#define RCU_INVARIANT(x)
Definition Assert.h:187
#define RCU_ASSERT(x)
Definition Assert.h:210
#define RCU_DESTROY_INVARIANT(x)
Definition Assert.h:223
#define RCU_CHANGE_INVARIANT(x)
Definition Assert.h:219
#define RCU_NEW_INVARIANT(x)
Definition Assert.h:221
#define RCU_REQUIRE_SOFT(x)
Definition Assert.h:141
#define RCU_READ_INVARIANT(x)
Definition Assert.h:217
ClassImp(EL::OutputStream) namespace EL
static const std::string optContainerSuffix
static const std::string optType
static const std::string optMergeCmd
a class/interface representing an output location for files
Definition DiskOutput.h:46
A class that manages meta-data to be associated with an object.
Definition MetaObject.h:48
This module defines the arguments passed from the BATCH driver to the BATCH worker.