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 
32 struct AgeGroup : public Index<AgeGroup> {
33  AgeGroup(size_t val)
34  : Index<AgeGroup>(val)
35  {
36  }
37 
42  template <class IOContext>
43  static IOResult<AgeGroup> deserialize(IOContext& io)
44  {
45  BOOST_OUTCOME_TRY(auto&& i, mio::deserialize(io, Tag<size_t>{}));
46  return success(AgeGroup(i));
47  }
48 };
49 
50 } // namespace mio
51 
52 #endif
An Index with more than one template parameter combines several Index objects.
Definition: index.h:181
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:860
boost::outcome_v2::in_place_type_t< T > Tag
Type that is used for overload resolution.
Definition: io.h:407
auto i
Definition: io.h:809
auto success()
Create an object that is implicitly convertible to a succesful IOResult<void>.
Definition: io.h:359
boost::outcome_v2::unchecked< T, IOStatus > IOResult
Value-or-error type for operations that return a value but can fail.
Definition: io.h:353
The AgeGroup struct is used as a dynamically sized tag for all age dependent categories.
Definition: age_group.h:32
static IOResult< AgeGroup > deserialize(IOContext &io)
Override deserialize of base class.
Definition: age_group.h:43
AgeGroup(size_t val)
Definition: age_group.h:33