PLCnext API Documentation 23.6.0.37
Public Types | Public Member Functions | List of all members
Arp::System::Acf::ComponentFactory Class Reference

This class is used by Acf libraries to provide a component factory of the library specific components. More...

#include <ComponentFactory.hpp>

Inheritance diagram for Arp::System::Acf::ComponentFactory:
Inheritance graph

Public Types

typedef IComponent::Ptr(* FactoryMethod) (IApplication &application, const String &componentName)
 The prototype of the component factory method, which might be registered to create components.
 

Public Member Functions

bool HasComponentType (const String &typeName) override
 Determines if this factory provides components of the given typename. More...
 
IComponent::Ptr CreateComponent (IApplication &application, const String &componentType, const String &componentName) override
 Creates a component of the given typename. More...
 
bool AddFactoryMethod (const String &componentType, FactoryMethod factoryMethod)
 Adds a component specific factory method to this factory. More...
 
- Public Member Functions inherited from Arp::System::Acf::IComponentFactory
 IComponentFactory (void)=default
 Constructs an IComponentFactory instance.
 
virtual ~IComponentFactory (void)=default
 Destructs this instance and frees all resouces.
 
virtual bool HasComponentType (const String &typeName)=0
 Determines if this factory provides components of the given typename. More...
 
virtual IComponent::Ptr CreateComponent (IApplication &application, const String &componentTypeName, const String &componentName)=0
 Creates a component of the given typename. More...
 

Detailed Description

This class is used by Acf libraries to provide a component factory of the library specific components.

This default implementation of the component factory should suffice in almost all cases.

Member Function Documentation

◆ AddFactoryMethod()

bool Arp::System::Acf::ComponentFactory::AddFactoryMethod ( const String componentType,
FactoryMethod  factoryMethod 
)
inline

Adds a component specific factory method to this factory.

Parameters
componentTypeThe typename of the component to create.
factoryMethodThe component factory method to create an new instance.
Returns
true if the factory method could be added, otherwise false, when the factory method of the given component type yet exists.

◆ CreateComponent()

IComponent::Ptr Arp::System::Acf::ComponentFactory::CreateComponent ( IApplication application,
const String componentTypeName,
const String componentName 
)
overridevirtual

Creates a component of the given typename.

Parameters
applicationThe application passed to the new created component.
componentTypeNameThe typename of the component to create.
componentNameThe name of the new created component.
Returns
The new component instance, if the specified type could be provided, otherwise nullptr.

Implements Arp::System::Acf::IComponentFactory.

◆ HasComponentType()

bool Arp::System::Acf::ComponentFactory::HasComponentType ( const String typeName)
inlineoverridevirtual

Determines if this factory provides components of the given typename.

Parameters
typeNameThe name of the component type to search for.
Returns
true if the specifeid type could be provided, otherwise false.

Implements Arp::System::Acf::IComponentFactory.


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