age_group.h Source File

CPP API: age_group.h Source File
age_group.h
Go to the documentation of this file.
1 /*
2 * Copyright (C) 2020-2026 MEmilio
3 *
4 * Authors: Jan Kleinert, Daniel Abele
5 *
6 * Contact: Martin J. Kuehn <Martin.Kuehn@DLR.de>
7 *
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 */
20 #ifndef AGEGROUP_H
21 #define AGEGROUP_H
22 
23 #include "memilio/utils/index.h"
24 
25 namespace mio
26 {
27 
40 struct AgeGroup : public Index<AgeGroup> {
41  AgeGroup(size_t val)
42  : Index<AgeGroup>(val)
43  {
44  }
45 
50  template <class IOContext>
51  static IOResult<AgeGroup> deserialize(IOContext& io)
52  {
53  BOOST_OUTCOME_TRY(auto&& i, mio::deserialize(io, Tag<size_t>{}));
54  return success(AgeGroup(i));
55  }
56 };
57 
58 } // namespace mio
59 
60 #endif
An Index with more than one template parameter combines several Index objects.
Definition: index.h:191
A collection of classes to simplify handling of matrix shapes in meta programming.
Definition: models/abm/analyze_result.h:30
IOResult< T > deserialize(IOContext &io, Tag< T > tag)
Restores an object from the data stored in an IO context.
Definition: io.h:861
boost::outcome_v2::in_place_type_t< T > Tag
Type that is used for overload resolution.
Definition: io.h:408
auto i
Definition: io.h:810
auto success()
Create an object that is implicitly convertible to a succesful IOResult<void>.
Definition: io.h:360
boost::outcome_v2::unchecked< T, IOStatus > IOResult
Value-or-error type for operations that return a value but can fail.
Definition: io.h:354
Typesafe index representing an age group.
Definition: age_group.h:40
static IOResult< AgeGroup > deserialize(IOContext &io)
Override deserialize of base class.
Definition: age_group.h:51
AgeGroup(size_t val)
Definition: age_group.h:41