KiCad PCB EDA Suite
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
29 static bool Register( const KI_TEST::UTILITY_PROGRAM& aProgInfo )
30 {
31 PLUGIN_MAP& map = GetInfoMap();
32
33 if( map.find( aProgInfo.m_name ) == map.end() )
34 {
35 map[aProgInfo.m_name] = aProgInfo;
36 return true;
37 }
38
39 // Already exists in map
40 return false;
41 }
42
49 {
50 static PLUGIN_MAP info_map;
51 return info_map;
52 }
53};
54
55#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)