KiCad PCB EDA Suite
Loading...
Searching...
No Matches
utility_registry.h
Go to the documentation of this file.
1
2#ifndef UTILITY_REGISTRY_H
3#define UTILITY_REGISTRY_H
4
6
7#include <map>
8#include <memory>
9#include <string>
10
11
16{
17public:
18 using PLUGIN_MAP = std::map<std::string, KI_TEST::UTILITY_PROGRAM>;
19
28 static bool Register( const KI_TEST::UTILITY_PROGRAM& aProgInfo )
29 {
30 PLUGIN_MAP& map = GetInfoMap();
31
32 if( map.find( aProgInfo.m_name ) == map.end() )
33 {
34 map[aProgInfo.m_name] = aProgInfo;
35 return true;
36 }
37
38 // Already exists in map
39 return false;
40 }
41
48 {
49 static PLUGIN_MAP info_map;
50 return info_map;
51 }
52};
53
54#endif // UTILITY_REGISTRY_H
A class to handle the registration of utility programs.
std::map< std::string, KI_TEST::UTILITY_PROGRAM > PLUGIN_MAP
static bool Register(const KI_TEST::UTILITY_PROGRAM &aProgInfo)
Register a utility program factory function against an ID string.
static PLUGIN_MAP & GetInfoMap()
Accessor for the static registry map.
Description of a "utility program", which is a program that takes some command line and does "somethi...
std::string m_name
The name of the program (this is used to select one)