OnixS ICE iMpact Multicast Price Feed Handler C++ library 8.18.0
API documentation
Loading...
Searching...
No Matches
Warning.h
Go to the documentation of this file.
1/*
2 * Copyright (c) Onix Solutions Limited. All rights reserved.
3 *
4 * This software owned by Onix Solutions Limited and is protected by copyright law
5 * and international copyright treaties.
6 *
7 * Access to and use of the software is governed by the terms of the applicable ONIXS Software
8 * Services Agreement (the Agreement) and Customer end user license agreements granting
9 * a non-assignable, non-transferable and non-exclusive license to use the software
10 * for it's own data processing purposes under the terms defined in the Agreement.
11 *
12 * Except as otherwise granted within the terms of the Agreement, copying or reproduction of any part
13 * of this source code or associated reference material to any other location for further reproduction
14 * or redistribution, and any amendments to this copyright notice, are expressly prohibited.
15 *
16 * Any reproduction or redistribution for sale or hiring of the Software not in accordance with
17 * the terms of the Agreement is a violation of copyright law.
18 */
19
20#pragma once
21
22#include "Export.h"
23#include "Optional.h"
24#include "Types.h"
25
26#include <iosfwd>
27#include <string>
28
29namespace OnixS { namespace ICE { namespace iMpact { namespace MarketData {
30
32struct ONIXS_ICEMDH_EXPORT KnownWarnings
33{
73
75 static Enum deserialize(const char* value);
76
78 static const char* toString(Enum value);
79};
80
83
85class ONIXS_ICEMDH_EXPORT Warning
86{
87public:
89 Warning(const std::string& source, WarningCode code);
90
92 Warning(const std::string& source, WarningCode code, const std::string& description);
93
95 Warning(const std::string& source, WarningCode code, const std::string& description, FeedId feedId);
96
98 Warning(const Warning& other);
99
102
104 const Optional<FeedId>& feedId() const;
105
107 WarningCode code() const;
108
110 const char* description() const;
111
113 const char* source() const;
114
116 std::string toString() const;
117
119 void toString(std::string&) const;
120
122 Warning& operator=(const Warning& other);
123
124private:
125 enum Traits
126 {
127 SourceMaxLength = 128,
128 DescriptionMaxLength = 1024
129 };
130
131 WarningCode code_;
132 char source_[SourceMaxLength];
133 char description_[DescriptionMaxLength];
134 Optional<FeedId> feedId_;
135};
136
138ONIXS_ICEMDH_EXPORT std::ostream& operator<<(std::ostream&, const Warning&);
139
141{
142 return feedId_;
143}
144
146{
147 return code_;
148}
149
150inline const char* Warning::description() const
151{
152 return description_;
153}
154
155inline const char* Warning::source() const
156{
157 return source_;
158}
159
160inline std::string Warning::toString() const
161{
162 std::string str;
163 toString(str);
164 return str;
165}
166
167}}}} // namespace OnixS::ICE::iMpact::MarketData
std::string toString() const
String presentation of an warning.
Definition Warning.h:160
Warning(const std::string &source, WarningCode code)
Initializes instance with just a code.
Warning & operator=(const Warning &other)
Copies warning attributes from another instance.
Warning(const std::string &source, WarningCode code, const std::string &description, FeedId feedId)
Initializes instance with code, description and feed ID.
const char * source() const
Origin of the warning.
Definition Warning.h:155
void toString(std::string &) const
Appends presentation of an warning to the string.
WarningCode code() const
Code of warning.
Definition Warning.h:145
Warning(const Warning &other)
Initializes as clone of another warning.
const char * description() const
Human readable description.
Definition Warning.h:150
~Warning()
Cleans internal resources.
const Optional< FeedId > & feedId() const
Feed ID (if available).
Definition Warning.h:140
Warning(const std::string &source, WarningCode code, const std::string &description)
Initializes instance with code and description.
KnownWarnings::Enum WarningCode
Code of warning.
Definition Warning.h:82
int FeedId
Alias for market types.
Definition Types.h:33
std::ostream & operator<<(std::ostream &, const Error &)
Make it printable to formatted C++ I/O streams.
@ NoUdsForMarketType
Indicates there are no UDS for requested market type.
Definition Warning.h:71
@ Generic
General-purpose warning.
Definition Warning.h:38
static const char * toString(Enum value)
Returns description of a particular warning.
static Enum deserialize(const char *value)
Returns constant from its text presentation.