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

Member Function Documentation

◆ AllPlugins()

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

Definition at line 121 of file io_mgr.h.

122  {
123  return m_plugins;
124  }
std::vector< ENTRY > m_plugins
Definition: io_mgr.h:127

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

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

References m_plugins.

Referenced by IO_MGR::PluginFind().

◆ Instance()

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

Definition at line 89 of file io_mgr.h.

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

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

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

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

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


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