EventAnalysis  1.0.0
InsertionResult.h
Go to the documentation of this file.
1 /*
2  * InsertionResult.h
3  *
4  * Created on: 22 Ago 2017
5  * Author: Nicola Mori
6  */
7 
8 #ifndef INSERTIONRESULT_H_
9 #define INSERTIONRESULT_H_
10 
11 #include <array>
12 #include <ostream>
13 
14 namespace EA {
15 
16 enum class InsertionResult {
17  SUCCESS,
18  DUPLICATE,
22  ALIASOFALIAS,
23  ERROR
24 
25 };
26 
27 namespace _Private {
28 const std::array<std::string, 7> irNames{
29  "SUCCESS", "DUPLICATE", "NAMEALIASCLASH", "BADALIASEDTYPE", "MISSINGALIASEDOBJECT", "ALIASOFALIAS", "ERROR"};
30 }
31 
33 inline const std::string &ToString(InsertionResult ir) { return _Private::irNames[static_cast<int>(ir)]; }
34 
36 inline std::ostream &operator<<(std::ostream &out, InsertionResult ir) { return out << ToString(ir); }
37 
38 } // namespace EA
39 
40 #endif /* INSERTIONRESULT_H_ */
const std::string & ToString(InsertionResult ir)
Convert an InsertionResult to a string.
Definition: InsertionResult.h:33
Bad type of aliased object when re-assigning the alias.
Clash between object name and already inserted alias, or vice-versa.
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
const std::array< std::string, 7 > irNames
Definition: InsertionResult.h:28
InsertionResult
Definition: InsertionResult.h:16
Object already present.
Aliased object is not present.
Aliased objet is an alias.