VerifyInfo.cpp 9.48 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/*
 * The CERN Tape Archive (CTA) project
 * Copyright (C) 2015  CERN
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#include "common/dataStructures/VerifyInfo.hpp"
#include "common/exception/Exception.hpp"

//------------------------------------------------------------------------------
// constructor
//------------------------------------------------------------------------------
25
cta::common::dataStructures::VerifyInfo::VerifyInfo() {  
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
  m_creationLogSet = false;
  m_filesFailedSet = false;
  m_filesToVerifySet = false;
  m_filesVerifiedSet = false;
  m_tagSet = false;
  m_totalFilesSet = false;
  m_totalSizeSet = false;
  m_verifyStatusSet = false;
  m_verifyTypeSet = false;
  m_vidSet = false;
}

//------------------------------------------------------------------------------
// destructor
//------------------------------------------------------------------------------
41
cta::common::dataStructures::VerifyInfo::~VerifyInfo() throw() {
42
43
44
45
46
}

//------------------------------------------------------------------------------
// allFieldsSet
//------------------------------------------------------------------------------
47
bool cta::common::dataStructures::VerifyInfo::allFieldsSet() const {
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
  return m_creationLogSet
      && m_filesFailedSet
      && m_filesToVerifySet
      && m_filesVerifiedSet
      && m_tagSet
      && m_totalFilesSet
      && m_totalSizeSet
      && m_verifyStatusSet
      && m_verifyTypeSet
      && m_vidSet;
}

//------------------------------------------------------------------------------
// setCreationLog
//------------------------------------------------------------------------------
63
void cta::common::dataStructures::VerifyInfo::setCreationLog(const cta::common::dataStructures::EntryLog &creationLog) {
64
65
66
67
68
69
70
  m_creationLog = creationLog;
  m_creationLogSet = true;
}

//------------------------------------------------------------------------------
// getCreationLog
//------------------------------------------------------------------------------
71
cta::common::dataStructures::EntryLog cta::common::dataStructures::VerifyInfo::getCreationLog() const {
72
73
74
75
76
77
78
79
80
  if(!allFieldsSet()) {
    throw cta::exception::Exception(std::string(__FUNCTION__)+" Error: not all fields of the VerifyInfo have been set!");
  }
  return m_creationLog;
}

//------------------------------------------------------------------------------
// setFilesFailed
//------------------------------------------------------------------------------
81
void cta::common::dataStructures::VerifyInfo::setFilesFailed(const uint64_t filesFailed) {
82
83
84
85
86
87
88
  m_filesFailed = filesFailed;
  m_filesFailedSet = true;
}

//------------------------------------------------------------------------------
// getFilesFailed
//------------------------------------------------------------------------------
89
uint64_t cta::common::dataStructures::VerifyInfo::getFilesFailed() const {
90
91
92
93
94
95
96
97
98
  if(!allFieldsSet()) {
    throw cta::exception::Exception(std::string(__FUNCTION__)+" Error: not all fields of the VerifyInfo have been set!");
  }
  return m_filesFailed;
}

//------------------------------------------------------------------------------
// setFilesToVerify
//------------------------------------------------------------------------------
99
void cta::common::dataStructures::VerifyInfo::setFilesToVerify(const uint64_t filesToVerify) {
100
101
102
103
104
105
106
  m_filesToVerify = filesToVerify;
  m_filesToVerifySet = true;
}

//------------------------------------------------------------------------------
// getFilesToVerify
//------------------------------------------------------------------------------
107
uint64_t cta::common::dataStructures::VerifyInfo::getFilesToVerify() const {
108
109
110
111
112
113
114
115
116
  if(!allFieldsSet()) {
    throw cta::exception::Exception(std::string(__FUNCTION__)+" Error: not all fields of the VerifyInfo have been set!");
  }
  return m_filesToVerify;
}

//------------------------------------------------------------------------------
// setFilesVerified
//------------------------------------------------------------------------------
117
void cta::common::dataStructures::VerifyInfo::setFilesVerified(const uint64_t filesVerified) {
118
119
120
121
122
123
124
  m_filesVerified = filesVerified;
  m_filesVerifiedSet = true;
}

//------------------------------------------------------------------------------
// getFilesVerified
//------------------------------------------------------------------------------
125
uint64_t cta::common::dataStructures::VerifyInfo::getFilesVerified() const {
126
127
128
129
130
131
132
133
134
  if(!allFieldsSet()) {
    throw cta::exception::Exception(std::string(__FUNCTION__)+" Error: not all fields of the VerifyInfo have been set!");
  }
  return m_filesVerified;
}

//------------------------------------------------------------------------------
// setTag
//------------------------------------------------------------------------------
135
void cta::common::dataStructures::VerifyInfo::setTag(const std::string &tag) {
136
137
138
139
140
141
142
  m_tag = tag;
  m_tagSet = true;
}

//------------------------------------------------------------------------------
// getTag
//------------------------------------------------------------------------------
143
std::string cta::common::dataStructures::VerifyInfo::getTag() const {
144
145
146
147
148
149
150
151
152
  if(!allFieldsSet()) {
    throw cta::exception::Exception(std::string(__FUNCTION__)+" Error: not all fields of the VerifyInfo have been set!");
  }
  return m_tag;
}

//------------------------------------------------------------------------------
// setTotalFiles
//------------------------------------------------------------------------------
153
void cta::common::dataStructures::VerifyInfo::setTotalFiles(const uint64_t totalFiles) {
154
155
156
157
158
159
160
  m_totalFiles = totalFiles;
  m_totalFilesSet = true;
}

//------------------------------------------------------------------------------
// getTotalFiles
//------------------------------------------------------------------------------
161
uint64_t cta::common::dataStructures::VerifyInfo::getTotalFiles() const {
162
163
164
165
166
167
168
169
170
  if(!allFieldsSet()) {
    throw cta::exception::Exception(std::string(__FUNCTION__)+" Error: not all fields of the VerifyInfo have been set!");
  }
  return m_totalFiles;
}

//------------------------------------------------------------------------------
// setTotalSize
//------------------------------------------------------------------------------
171
void cta::common::dataStructures::VerifyInfo::setTotalSize(const uint64_t totalSize) {
172
173
174
175
176
177
178
  m_totalSize = totalSize;
  m_totalSizeSet = true;
}

//------------------------------------------------------------------------------
// getTotalSize
//------------------------------------------------------------------------------
179
uint64_t cta::common::dataStructures::VerifyInfo::getTotalSize() const {
180
181
182
183
184
185
186
187
188
  if(!allFieldsSet()) {
    throw cta::exception::Exception(std::string(__FUNCTION__)+" Error: not all fields of the VerifyInfo have been set!");
  }
  return m_totalSize;
}

//------------------------------------------------------------------------------
// setVerifyStatus
//------------------------------------------------------------------------------
189
void cta::common::dataStructures::VerifyInfo::setVerifyStatus(const std::string &verifyStatus) {
190
191
192
193
194
195
196
  m_verifyStatus = verifyStatus;
  m_verifyStatusSet = true;
}

//------------------------------------------------------------------------------
// getVerifyStatus
//------------------------------------------------------------------------------
197
std::string cta::common::dataStructures::VerifyInfo::getVerifyStatus() const {
198
199
200
201
202
203
204
205
206
  if(!allFieldsSet()) {
    throw cta::exception::Exception(std::string(__FUNCTION__)+" Error: not all fields of the VerifyInfo have been set!");
  }
  return m_verifyStatus;
}

//------------------------------------------------------------------------------
// setVerifyType
//------------------------------------------------------------------------------
207
void cta::common::dataStructures::VerifyInfo::setVerifyType(const cta::common::dataStructures::VerifyType &verifyType) {
208
209
210
211
212
213
214
  m_verifyType = verifyType;
  m_verifyTypeSet = true;
}

//------------------------------------------------------------------------------
// getVerifyType
//------------------------------------------------------------------------------
215
cta::common::dataStructures::VerifyType cta::common::dataStructures::VerifyInfo::getVerifyType() const {
216
217
218
219
220
221
222
223
224
  if(!allFieldsSet()) {
    throw cta::exception::Exception(std::string(__FUNCTION__)+" Error: not all fields of the VerifyInfo have been set!");
  }
  return m_verifyType;
}

//------------------------------------------------------------------------------
// setVid
//------------------------------------------------------------------------------
225
void cta::common::dataStructures::VerifyInfo::setVid(const std::string &vid) {
226
227
228
229
230
231
232
  m_vid = vid;
  m_vidSet = true;
}

//------------------------------------------------------------------------------
// getVid
//------------------------------------------------------------------------------
233
std::string cta::common::dataStructures::VerifyInfo::getVid() const {
234
235
236
237
238
  if(!allFieldsSet()) {
    throw cta::exception::Exception(std::string(__FUNCTION__)+" Error: not all fields of the VerifyInfo have been set!");
  }
  return m_vid;
}