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
5//
6// Distributed under the Boost Software License, Version 1.0.
7// (See accompanying file LICENSE_1_0.txt or copy at
8// http://www.boost.org/LICENSE_1_0.txt)
9
10// Please feel free to contact me (krumnack@iastate.edu) for bug
11// reports, feature suggestions, praise and complaints.
12
13
14//
15// includes
16//
17
19
20#include <EventLoop/Algorithm.h>
23
24//
25// method implementations
26//
27
29
30namespace EL
31{
32 const std::string OutputStream::optType = "EventLoop_OutputStreamType";
33 const std::string OutputStream::optMergeCmd = "EventLoop_MergeCmd";
34 const std::string OutputStream::optContainerSuffix = "EventLoop_DSSuffix";
35
36 void OutputStream ::
37 testInvariant () const
38 {
39 RCU_INVARIANT (this);
40 RCU_INVARIANT (!m_label.empty());
41 }
42
43
44
45 OutputStream ::
46 OutputStream ()
47 : m_label ("out"), m_output (0)
48 {
49 RCU_NEW_INVARIANT (this);
50 }
51
52
53
54 OutputStream ::
55 OutputStream (const std::string& val_label)
56 : m_label (val_label), m_output (0)
57 {
58 RCU_REQUIRE_SOFT (!val_label.empty());
59
60 RCU_NEW_INVARIANT (this);
61 }
62
63
64
65 OutputStream ::
66 OutputStream (const std::string& val_label, const std::string& val_type)
67 : m_label (val_label), m_output (0)
68 {
69 RCU_REQUIRE_SOFT (!val_label.empty());
70
71 m_options.setString(optType, val_type);
72
73 RCU_NEW_INVARIANT (this);
74 }
75
76
77
78 OutputStream ::
79 OutputStream (const OutputStream& that)
80 : TObject (that), m_label (that.m_label),
81 m_options (that.m_options), m_output (0)
82 {
83 RCU_READ_INVARIANT (&that);
84
85 if (that.m_output != 0)
86 {
87 m_output = dynamic_cast<SH::DiskOutput*>(that.m_output->Clone ());
88 RCU_ASSERT (m_output != 0);
89 }
90 }
91
92
93
94 OutputStream ::
95 ~OutputStream ()
96 {
98
99 delete m_output;
100 }
101
102
103
104 OutputStream& OutputStream ::
105 operator = (OutputStream that)
106 {
107 // no invariant used
108 that.swap (*this);
109 return *this;
110 }
111
112
113
114 void OutputStream ::
115 swap (OutputStream& that)
116 {
118 RCU_CHANGE_INVARIANT (&that);
119
120 m_label.swap (that.m_label);
121 m_options.swap (that.m_options);
122
123 SH::DiskOutput *tmp_output = m_output;
124 m_output = that.m_output;
125 that.m_output = tmp_output;
126 }
127
128
129
130 const std::string& OutputStream ::
131 label () const
132 {
133 RCU_READ_INVARIANT (this);
134 return m_label;
135 }
136
137
138
139 void OutputStream ::
140 label (const std::string& val_label)
141 {
143 RCU_REQUIRE_SOFT (!val_label.empty());
144 m_label = val_label;
145 }
146
147
148
149 SH::MetaObject *OutputStream ::
150 options ()
151 {
152 RCU_READ_INVARIANT (this);
153 return &m_options;
154 }
155
156
157
158 const SH::MetaObject *OutputStream ::
159 options () const
160 {
161 RCU_READ_INVARIANT (this);
162 return &m_options;
163 }
164
165
166
167 const SH::DiskOutput *OutputStream ::
168 output() const
169 {
170 RCU_READ_INVARIANT (this);
171 return m_output;
172 }
173
174
175
176 void OutputStream ::
177 output (SH::DiskOutput *output_swallow)
178 {
180 delete m_output;
181 m_output = output_swallow;
182 }
183}
#define RCU_INVARIANT(x)
Definition Assert.h:201
#define RCU_ASSERT(x)
Definition Assert.h:222
#define RCU_DESTROY_INVARIANT(x)
Definition Assert.h:235
#define RCU_CHANGE_INVARIANT(x)
Definition Assert.h:231
#define RCU_NEW_INVARIANT(x)
Definition Assert.h:233
#define RCU_REQUIRE_SOFT(x)
Definition Assert.h:153
#define RCU_READ_INVARIANT(x)
Definition Assert.h:229
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:56
This module defines the arguments passed from the BATCH driver to the BATCH worker.