libdoip  0.1.0
DoIP (Diagnostics over Internet Protocol) ISO 13400 C++17 Library
DoIPDownstreamResult.h
Go to the documentation of this file.
1 #ifndef DOIPDOWNSTREAMRESULT_H
2 #define DOIPDOWNSTREAMRESULT_H
3 
4 #include "AnsiColors.h"
5 
6 namespace doip {
7 
8 /**
9  * @brief Result of a downstream request initiation
10  */
12  Pending, ///< Request was sent, waiting for async response
13  Handled, ///< Request was handled synchronously (no downstream needed)
14  Error ///< Failed to initiate downstream request
15 };
16 
17 inline std::ostream &operator<<(std::ostream &os, DoIPDownstreamResult result) {
18  switch(result) {
20  os << ansi::yellow << "Pending" << ansi::reset;
21  break;
23  os << ansi::green << "Handled" << ansi::reset;
24  break;
26  os << ansi::red << "Error" << ansi::reset;
27  break;
28  }
29  return os;
30 }
31 
32 } // namespace doip
33 
34 #endif /* DOIPDOWNSTREAMRESULT_H */
constexpr const char * red
Definition: AnsiColors.h:11
constexpr const char * reset
Definition: AnsiColors.h:7
constexpr const char * yellow
Definition: AnsiColors.h:13
constexpr const char * green
Definition: AnsiColors.h:12
Definition: AnsiColors.h:3
std::ostream & operator<<(std::ostream &os, const ByteArray &arr)
Stream operator for ByteArray.
Definition: ByteArray.h:303
DoIPDownstreamResult
Result of a downstream request initiation.
@ Pending
Request was sent, waiting for async response.
@ Handled
Request was handled synchronously (no downstream needed)
@ Error
Failed to initiate downstream request.