Stride Reference Manual  - generated for commit 9643b11
Id.h
Go to the documentation of this file.
1 /*
2  * This is free software: you can redistribute it and/or modify it
3  * under the terms of the GNU General Public License as published by
4  * the Free Software Foundation, either version 3 of the License, or
5  * any later version.
6  * The software is distributed in the hope that it will be useful,
7  * but WITHOUT ANY WARRANTY; without even the implied warranty of
8  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9  * GNU General Public License for more details.
10  * You should have received a copy of the GNU General Public License
11  * along with the software. If not, see <http://www.gnu.org/licenses/>.
12  *
13  * Copyright 2017, Kuylen E, Willem L, Broeckhove J
14  */
15 
21 #pragma once
22 
23 #include <cstddef>
24 #include <string>
25 
26 namespace stride {
27 namespace sim_event {
28 
30 enum class Id
31 {
32  AtStart,
33  Stepped,
34  Finished,
35  SetupBegin,
36  SetupEnd
37 };
38 
40 inline constexpr unsigned int NumOfTypes() { return 5U; }
41 
43 bool IsType(const std::string& s);
44 
46 inline std::size_t ToSizeT(Id id) { return static_cast<std::size_t>(id); }
47 
49 std::string ToString(Id w);
50 
52 Id ToType(const std::string& s);
53 
54 } // namespace sim_event
55 } // namespace stride
std::size_t ToSizeT(Id id)
Cast to size_t for indexing.
Definition: Id.h:46
Id ToType(const string &s)
Converts a string with name to Id.
Definition: Id.cpp:50
Id
Enumerates the event.
Definition: Id.h:30
string ToString(Id c)
Converts a ContactPoolType::Id value to corresponding name.
Definition: Id.cpp:42
bool IsType(const string &s)
Check whether string is name of a ContactPoolType::Id.
Definition: Id.cpp:32
constexpr unsigned int NumOfTypes()
Number of ContactPool types.
Definition: Id.h:40
Namespace for the simulator and related classes.
Definition: Calendar.cpp:28