1 /**
2 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 * SPDX-License-Identifier: Apache-2.0.
4 */
5
6 #include <aws/cloudsearchdomain/model/FieldStats.h>
7 #include <aws/core/utils/json/JsonSerializer.h>
8
9 #include <utility>
10
11 using namespace Aws::Utils::Json;
12 using namespace Aws::Utils;
13
14 namespace Aws
15 {
16 namespace CloudSearchDomain
17 {
18 namespace Model
19 {
20
FieldStats()21 FieldStats::FieldStats() :
22 m_minHasBeenSet(false),
23 m_maxHasBeenSet(false),
24 m_count(0),
25 m_countHasBeenSet(false),
26 m_missing(0),
27 m_missingHasBeenSet(false),
28 m_sum(0.0),
29 m_sumHasBeenSet(false),
30 m_sumOfSquares(0.0),
31 m_sumOfSquaresHasBeenSet(false),
32 m_meanHasBeenSet(false),
33 m_stddev(0.0),
34 m_stddevHasBeenSet(false)
35 {
36 }
37
FieldStats(JsonView jsonValue)38 FieldStats::FieldStats(JsonView jsonValue) :
39 m_minHasBeenSet(false),
40 m_maxHasBeenSet(false),
41 m_count(0),
42 m_countHasBeenSet(false),
43 m_missing(0),
44 m_missingHasBeenSet(false),
45 m_sum(0.0),
46 m_sumHasBeenSet(false),
47 m_sumOfSquares(0.0),
48 m_sumOfSquaresHasBeenSet(false),
49 m_meanHasBeenSet(false),
50 m_stddev(0.0),
51 m_stddevHasBeenSet(false)
52 {
53 *this = jsonValue;
54 }
55
operator =(JsonView jsonValue)56 FieldStats& FieldStats::operator =(JsonView jsonValue)
57 {
58 if(jsonValue.ValueExists("min"))
59 {
60 m_min = jsonValue.GetString("min");
61
62 m_minHasBeenSet = true;
63 }
64
65 if(jsonValue.ValueExists("max"))
66 {
67 m_max = jsonValue.GetString("max");
68
69 m_maxHasBeenSet = true;
70 }
71
72 if(jsonValue.ValueExists("count"))
73 {
74 m_count = jsonValue.GetInt64("count");
75
76 m_countHasBeenSet = true;
77 }
78
79 if(jsonValue.ValueExists("missing"))
80 {
81 m_missing = jsonValue.GetInt64("missing");
82
83 m_missingHasBeenSet = true;
84 }
85
86 if(jsonValue.ValueExists("sum"))
87 {
88 m_sum = jsonValue.GetDouble("sum");
89
90 m_sumHasBeenSet = true;
91 }
92
93 if(jsonValue.ValueExists("sumOfSquares"))
94 {
95 m_sumOfSquares = jsonValue.GetDouble("sumOfSquares");
96
97 m_sumOfSquaresHasBeenSet = true;
98 }
99
100 if(jsonValue.ValueExists("mean"))
101 {
102 m_mean = jsonValue.GetString("mean");
103
104 m_meanHasBeenSet = true;
105 }
106
107 if(jsonValue.ValueExists("stddev"))
108 {
109 m_stddev = jsonValue.GetDouble("stddev");
110
111 m_stddevHasBeenSet = true;
112 }
113
114 return *this;
115 }
116
Jsonize() const117 JsonValue FieldStats::Jsonize() const
118 {
119 JsonValue payload;
120
121 if(m_minHasBeenSet)
122 {
123 payload.WithString("min", m_min);
124
125 }
126
127 if(m_maxHasBeenSet)
128 {
129 payload.WithString("max", m_max);
130
131 }
132
133 if(m_countHasBeenSet)
134 {
135 payload.WithInt64("count", m_count);
136
137 }
138
139 if(m_missingHasBeenSet)
140 {
141 payload.WithInt64("missing", m_missing);
142
143 }
144
145 if(m_sumHasBeenSet)
146 {
147 payload.WithDouble("sum", m_sum);
148
149 }
150
151 if(m_sumOfSquaresHasBeenSet)
152 {
153 payload.WithDouble("sumOfSquares", m_sumOfSquares);
154
155 }
156
157 if(m_meanHasBeenSet)
158 {
159 payload.WithString("mean", m_mean);
160
161 }
162
163 if(m_stddevHasBeenSet)
164 {
165 payload.WithDouble("stddev", m_stddev);
166
167 }
168
169 return payload;
170 }
171
172 } // namespace Model
173 } // namespace CloudSearchDomain
174 } // namespace Aws
175