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

Member Function Documentation

◆ AllPlugins()

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

Definition at line 119 of file io_mgr.h.

120  {
121  return m_plugins;
122  }
std::vector< ENTRY > m_plugins
Definition: io_mgr.h:125

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

108  {
109  for( auto& ent : m_plugins )
110  {
111  if ( ent.m_type == aFileType )
112  {
113  return ent.m_createFunc();
114  }
115  }
116  return nullptr;
117  }
std::vector< ENTRY > m_plugins
Definition: io_mgr.h:125

References m_plugins.

Referenced by IO_MGR::PluginFind().

◆ Instance()

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

Definition at line 87 of file io_mgr.h.

88  {
89  static PLUGIN_REGISTRY *self = nullptr;
90 
91  if( !self )
92  {
93  self = new PLUGIN_REGISTRY;
94  }
95  return self;
96  }

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

99  {
100  ENTRY ent;
101  ent.m_type = aType;
102  ent.m_createFunc = aCreateFunc;
103  ent.m_name = aName;
104  m_plugins.push_back( ent );
105  }
std::vector< ENTRY > m_plugins
Definition: io_mgr.h:125

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

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


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