KiCad PCB EDA Suite
IO_MGR::PLUGIN_REGISTRY Class Reference

Class PLUGIN_REGISTRY Holds a list of available plugins, created using a singleton REGISTER_PLUGIN object. More...

#include <io_mgr.h>

Classes

struct  ENTRY
 

Public Member Functions

void Register (PCB_FILE_T aType, const wxString &aName, std::function< PLUGIN *(void)> aCreateFunc)
 
PLUGINCreate (PCB_FILE_T aFileType) const
 
const std::vector< ENTRY > & AllPlugins () const
 

Static Public Member Functions

static PLUGIN_REGISTRYInstance ()
 

Private Attributes

std::vector< ENTRYm_plugins
 

Detailed Description

Class PLUGIN_REGISTRY Holds a list of available plugins, created using a singleton REGISTER_PLUGIN object.

This way, plugins can be added link-time.

Definition at line 74 of file io_mgr.h.

Member Function Documentation

const std::vector<ENTRY>& IO_MGR::PLUGIN_REGISTRY::AllPlugins ( ) const
inline

Definition at line 116 of file io_mgr.h.

References m_plugins.

Referenced by IO_MGR::EnumFromStr(), and IO_MGR::ShowType().

117  {
118  return m_plugins;
119  }
std::vector< ENTRY > m_plugins
Definition: io_mgr.h:122
PLUGIN* IO_MGR::PLUGIN_REGISTRY::Create ( PCB_FILE_T  aFileType) const
inline

Definition at line 104 of file io_mgr.h.

References m_plugins.

Referenced by IO_MGR::PluginFind().

105  {
106  for( auto& ent : m_plugins )
107  {
108  if ( ent.m_type == aFileType )
109  {
110  return ent.m_createFunc();
111  }
112  }
113  return nullptr;
114  }
std::vector< ENTRY > m_plugins
Definition: io_mgr.h:122
static PLUGIN_REGISTRY* IO_MGR::PLUGIN_REGISTRY::Instance ( )
inlinestatic

Definition at line 84 of file io_mgr.h.

Referenced by IO_MGR::EnumFromStr(), IO_MGR::PluginFind(), and IO_MGR::ShowType().

85  {
86  static PLUGIN_REGISTRY *self = nullptr;
87 
88  if( !self )
89  {
90  self = new PLUGIN_REGISTRY;
91  }
92  return self;
93  }
void IO_MGR::PLUGIN_REGISTRY::Register ( PCB_FILE_T  aType,
const wxString &  aName,
std::function< PLUGIN *(void)>  aCreateFunc 
)
inline

Definition at line 95 of file io_mgr.h.

References IO_MGR::PLUGIN_REGISTRY::ENTRY::m_createFunc, IO_MGR::PLUGIN_REGISTRY::ENTRY::m_name, m_plugins, and IO_MGR::PLUGIN_REGISTRY::ENTRY::m_type.

96  {
97  ENTRY ent;
98  ent.m_type = aType;
99  ent.m_createFunc = aCreateFunc;
100  ent.m_name = aName;
101  m_plugins.push_back( ent );
102  }
std::vector< ENTRY > m_plugins
Definition: io_mgr.h:122

Member Data Documentation

std::vector<ENTRY> IO_MGR::PLUGIN_REGISTRY::m_plugins
private

Definition at line 122 of file io_mgr.h.

Referenced by AllPlugins(), Create(), and Register().


The documentation for this class was generated from the following file: