yast2-core
|
Can create certain YaST2 components As documented in Y2Component, there are many ways how to realize a component. A Y2ComponentCreator is and object, that creates a component or at least creates a communication handle to an existing component. The Y2ComponentBroker keeps a list of all known Y2ComponentCreators. If it is asked to create or find a certain component, it scans this list and looks for a matching creator. More...
#include <Y2ComponentCreator.h>
Public Member Functions | |
Y2ComponentCreator (Y2ComponentBroker::order_t order) | |
Y2ComponentCreator (Y2ComponentBroker::order_t order, bool force_register) | |
virtual | ~Y2ComponentCreator () |
virtual Y2Component * | create (const char *name) const |
virtual Y2Component * | createInLevel (const char *name, int level, int current_level) const |
virtual Y2Component * | provideNamespace (const char *name) |
virtual bool | isServerCreator () const =0 |
bool | isClientCreator () const |
Can create certain YaST2 components As documented in Y2Component, there are many ways how to realize a component. A Y2ComponentCreator is and object, that creates a component or at least creates a communication handle to an existing component. The Y2ComponentBroker keeps a list of all known Y2ComponentCreators. If it is asked to create or find a certain component, it scans this list and looks for a matching creator.
If you want to implement a component creator, subclass Y2ComponentCreator, override the create method such that it returns a newly created component of your type and create a global variable of type of your component creator. Its constructor will be called before the execution goes into the main() function and it will be added to the Y2ComponentBrokers list of creators.
Y2ComponentCreator::Y2ComponentCreator | ( | Y2ComponentBroker::order_t | order | ) |
Enters this component creator into the global list of component creators.
order | the order in which the creators are scanned. See Y2ComponentBroker::order_t |
force_register | force registration of this creator even if the component broker's 'stop_register' flag is already set. |
References Y2ComponentBroker::registerComponentCreator().
Y2ComponentCreator::Y2ComponentCreator | ( | Y2ComponentBroker::order_t | order, |
bool | force_register | ||
) |
References Y2ComponentBroker::registerComponentCreator().
|
virtual |
Base class must have virtual destructor
|
virtual |
Override this method to implement the actual creating of the component. You must use the symbol and the signature of the term to decide, which component is to be created. If you are not able to create a matching component, return 0. Instance of component is still owned by component creator and can be shared between calls.
Reimplemented in Y2CCWFM, Y2CCSerial, Y2CCAgentComp< AgentComp >, and Y2CCStdio.
References y2warning.
Referenced by createInLevel(), and Y2PluginComponent::loadPlugin().
|
virtual |
Override this method to implement component creation for non-builtin components such as share library plugins, scripts and external programs that must be searched for in different directories. The default implementation is to call create in case level == current_level.
Reimplemented in Y2CCPlugin, Y2CCProgram, and Y2CCWFM.
References create().
Referenced by Y2ComponentBroker::createComponent().
bool Y2ComponentCreator::isClientCreator | ( | ) | const |
Specifies, whether this creator creates Y2Clients.
References isServerCreator().
Referenced by Y2ComponentBroker::createComponent().
|
pure virtual |
Specifies, whether this creator creates Y2Servers.
Implemented in Y2CCWFM, Y2CCPlugin, Y2CCProgram, TestY2CC, TestY2CC, TestY2CC, Y2CCSerial, Y2CCStdio, and Y2CCAgentComp< AgentComp >.
Referenced by Y2ComponentBroker::createComponent(), isClientCreator(), and Y2PluginComponent::loadPlugin().
|
virtual |
Override this method to implement providing a component for a given namespace. If you are not able to create a matching component, return 0.
Reimplemented in Y2CCPlugin, Y2CCProgram, Y2CCWFM, Y2CCSerial, Y2CCAgentComp< AgentComp >, Y2CCStdio, TestY2CC, TestY2CC, and TestY2CC.
References y2warning.
Referenced by Y2ComponentBroker::getNamespaceComponent(), and Y2PluginComponent::loadPlugin().