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
19class NICPortal {
20public:
25 static std::shared_ptr<NICPortal> getInstance();
26
31 std::vector<std::shared_ptr<AbstractNIC>> getAllNICs();
32
41 std::shared_ptr<AbstractNIC> getNIC(const std::string &referredName);
42
50 template<typename T, class = std::enable_if_t<std::is_base_of_v<AbstractNIC, T>>>
51 std::shared_ptr<T> getTypedNIC(const std::string &referredName) {
52 return std::dynamic_pointer_cast<T>(getNIC(referredName));
53 }
54
60 std::vector<std::shared_ptr<po::options_description>> getAllHALOptions();
61
62private:
64 static std::map<std::string, std::shared_ptr<AbstractNIC>> nicNameMap;
65
69 NICPortal() = default;
70};
71
72
73
74#endif //PICOSCENES_PLATFORM_NICPORTAL_HXX
Portal class for managing Network Interface Cards.
Definition NICPortal.hxx:19
std::vector< std::shared_ptr< po::options_description > > getAllHALOptions()
Get all HAL (Hardware Abstraction Layer) options.
std::vector< std::shared_ptr< AbstractNIC > > getAllNICs()
Get all registered NICs.
std::shared_ptr< AbstractNIC > getNIC(const std::string &referredName)
Get NIC by interface name.
std::shared_ptr< T > getTypedNIC(const std::string &referredName)
Get typed NIC by interface name.
Definition NICPortal.hxx:51
static std::shared_ptr< NICPortal > getInstance()
Get singleton instance of NICPortal.