PicoScenes API Docs
 
Loading...
Searching...
No Matches
NICPortal.hxx
Go to the documentation of this file.
1//
2// Created by Zhiping Jiang on 2020/1/15.
3//
4
5#ifndef PICOSCENES_PLATFORM_NICPORTAL_HXX
6#define PICOSCENES_PLATFORM_NICPORTAL_HXX
7
8#include "AbstractNIC.hxx"
9
10class NICPortal {
11public:
12 static std::shared_ptr<NICPortal> getInstance();
13
14 std::vector<std::shared_ptr<AbstractNIC>> getAllNICs();
15
16 std::shared_ptr<AbstractNIC> getNIC(const std::string &referredName);
17
18 template<typename T, class = std::enable_if_t<std::is_base_of_v<AbstractNIC, T>>>
19 std::shared_ptr<T> getTypedNIC(const std::string &referredName) {
20 return std::dynamic_pointer_cast<T>(getNIC(referredName));
21 }
22
23 std::vector<std::shared_ptr<po::options_description>> getAllHALOptions();
24
25private:
26 static std::map<std::string, std::shared_ptr<AbstractNIC>> nicNameMap;
27
28 NICPortal() = default;
29};
30
31
32#endif //PICOSCENES_PLATFORM_NICPORTAL_HXX
std::vector< std::shared_ptr< po::options_description > > getAllHALOptions()
std::vector< std::shared_ptr< AbstractNIC > > getAllNICs()
std::shared_ptr< AbstractNIC > getNIC(const std::string &referredName)
std::shared_ptr< T > getTypedNIC(const std::string &referredName)
Definition NICPortal.hxx:19
static std::shared_ptr< NICPortal > getInstance()