EventAnalysis  1.3.0
RetrievalResult.h
Go to the documentation of this file.
1 /*
2  * RetrievalResult.h
3  *
4  * Created on: 22 Ago 2017
5  * Author: Nicola Mori
6  */
7 
8 #ifndef RETRIEVALRESULT_H_
9 #define RETRIEVALRESULT_H_
10 
11 #include <array>
12 #include <ostream>
13 
14 namespace EA {
15 
16 enum class RetrievalResult {
17  SUCCESS,
18  NOTAVAILABLE,
19  BADCLASS,
20  NOTFOUND,
21  ERROR
22 
23 };
24 
33 inline bool operator<(const RetrievalResult lhs, const RetrievalResult rhs) { return ((int)lhs > (int)rhs); }
34 
35 namespace _Private {
36 const std::array<std::string, 5> rrNames{"SUCCESS", "NOTAVAILABLE", "BADCLASS", "NOTFOUND", "ERROR"};
37 }
38 
40 inline const std::string &ToString(RetrievalResult rr) { return _Private::rrNames[static_cast<int>(rr)]; }
41 
43 inline std::ostream &operator<<(std::ostream &out, RetrievalResult rr) { return out << ToString(rr); }
44 
45 } // namespace EA
46 
47 #endif /* RETRIEVALRESULT_H_ */
const std::array< std::string, 5 > rrNames
Definition: RetrievalResult.h:36
const std::string & ToString(InsertionResult ir)
Convert an InsertionResult to a string.
Definition: InsertionResult.h:33
bool operator<(const RetrievalResult lhs, const RetrievalResult rhs)
Comparison operator for retrieval results.
Definition: RetrievalResult.h:33
Known object but not available at the moment.
RetrievalResult
Definition: RetrievalResult.h:16
IncludeFileExc.h IncludeFileExc class declaration.
Definition: Algorithm.h:21
std::ostream & operator<<(std::ostream &out, InsertionResult ir)
Insertion operator for InsertionResult.
Definition: InsertionResult.h:36
Object found but class does not match with requested.