KiCad PCB EDA Suite
IO_MGR::PLUGIN_REGISTRY Class Reference

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

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 81 of file io_mgr.h.

Member Function Documentation

◆ AllPlugins()

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

Definition at line 123 of file io_mgr.h.

124  {
125  return m_plugins;
126  }
std::vector< ENTRY > m_plugins
Definition: io_mgr.h:129

References m_plugins.

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

◆ Create()

PLUGIN* IO_MGR::PLUGIN_REGISTRY::Create ( PCB_FILE_T  aFileType) const
inline

Definition at line 111 of file io_mgr.h.

112  {
113  for( auto& ent : m_plugins )
114  {
115  if ( ent.m_type == aFileType )
116  {
117  return ent.m_createFunc();
118  }
119  }
120  return nullptr;
121  }
std::vector< ENTRY > m_plugins
Definition: io_mgr.h:129

References m_plugins.

Referenced by IO_MGR::PluginFind().

◆ Instance()

static PLUGIN_REGISTRY* IO_MGR::PLUGIN_REGISTRY::Instance ( )
inlinestatic

Definition at line 91 of file io_mgr.h.

92  {
93  static PLUGIN_REGISTRY *self = nullptr;
94 
95  if( !self )
96  {
97  self = new PLUGIN_REGISTRY;
98  }
99  return self;
100  }

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

◆ Register()

void IO_MGR::PLUGIN_REGISTRY::Register ( PCB_FILE_T  aType,
const wxString &  aName,
std::function< PLUGIN *(void)>  aCreateFunc 
)
inline

Definition at line 102 of file io_mgr.h.

103  {
104  ENTRY ent;
105  ent.m_type = aType;
106  ent.m_createFunc = aCreateFunc;
107  ent.m_name = aName;
108  m_plugins.push_back( ent );
109  }
std::vector< ENTRY > m_plugins
Definition: io_mgr.h:129

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.

Member Data Documentation

◆ m_plugins

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

Definition at line 129 of file io_mgr.h.

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


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