CoreSet.h
1 /*
2  * qb - C++ Actor Framework
3  * Copyright (C) 2011-2019 isndev (www.qbaf.io). All rights reserved.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 #ifndef QB_CORESET_H
19 # define QB_CORESET_H
20 # include <cstdint>
21 # include <vector>
22 # include <unordered_set>
23 
24 namespace qb {
25 
31  class CoreSet {
32  friend class Main;
33 
34  const std::unordered_set<uint8_t> _raw_set;
35  const std::size_t _nb_core;
36  std::vector<uint8_t> _set;
37  std::size_t _size;
38 
39  uint8_t resolve(std::size_t const id) const;
40  std::size_t getSize() const;
41  std::size_t getNbCore() const;
42 
43  public:
44  CoreSet() = delete;
45  CoreSet(CoreSet const &) = default;
46  explicit CoreSet(std::unordered_set<uint8_t> const &set);
47 
48  static CoreSet build(uint32_t const nb_core = std::thread::hardware_concurrency());
49  };
50 
51 } // namespace qb
52 
53 #endif //QB_CORESET_H
Core main class.
Definition: Main.h:39
Main initializer.
Definition: CoreSet.h:31