bactria  0.0.1
The bactria library is a header-only C++14 library for profiling and tracing.
Category.hpp
Go to the documentation of this file.
1 /* Copyright 2021 Jan Stephan
2  *
3  * Licensed under the EUPL, Version 1.2 or - as soon they will be approved by
4  * the European Commission - subsequent versions of the EUPL (the “Licence”).
5  * You may not use this work except in compliance with the Licence.
6  * You may obtain a copy of the Licence at:
7  *
8  * http://ec.europa.eu/idabc/eupl.html
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the Licence is distributed on an “AS IS” basis, WITHOUT
12  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13  * Licence permissions and limitations under the Licence.
14  */
15 
23 #pragma once
24 
25 #include <cstdint>
26 #include <string>
27 
28 namespace bactria
29 {
30  namespace ranges
31  {
39  class Category
40  {
41  public:
47  Category() = default;
48 
54  Category(std::uint32_t id, std::string name) : m_id{id}, m_name{std::move(name)}
55  {
56  }
57 
66  Category(Category const& other) = default;
67 
76  auto operator=(Category const& rhs) -> Category& = default;
77 
86  Category(Category&& other) = default;
87 
96  auto operator=(Category&& rhs) -> Category& = default;
97 
103  ~Category() = default;
104 
110  auto get_id() const noexcept -> std::uint32_t
111  {
112  return m_id;
113  }
114 
120  auto get_name() const noexcept -> std::string const&
121  {
122  return m_name;
123  }
124 
130  auto get_c_name() const noexcept -> char const*
131  {
132  return m_name.c_str();
133  }
134 
135  private:
136  std::uint32_t m_id{0u};
137  std::string m_name{"BACTRIA_GENERIC_CATEGORY"};
138  };
139  } // namespace ranges
140 
141 } // namespace bactria
bactria::ranges::Category::get_id
auto get_id() const noexcept -> std::uint32_t
The ID getter method.
Definition: Category.hpp:110
bactria::ranges::Category::operator=
auto operator=(Category const &rhs) -> Category &=default
The copy assignment operator.
bactria::ranges::Category::get_name
auto get_name() const noexcept -> std::string const &
The name getter method.
Definition: Category.hpp:120
bactria::ranges::Category
Defines a category.
Definition: Category.hpp:39
bactria::ranges::Category::Category
Category()=default
The default constructor.
bactria::ranges::Category::Category
Category(std::uint32_t id, std::string name)
The constructor.
Definition: Category.hpp:54
bactria::ranges::Category::~Category
~Category()=default
The destructor.
bactria::ranges::Category::get_c_name
auto get_c_name() const noexcept -> char const *
The C string name getter method.
Definition: Category.hpp:130