ADTF
Loading...
Searching...
No Matches
adtf::ucom::class_factory< Classes > Class Template Reference

Alias always bringing the latest version of ant::class_factory into scope. More...

#include <class_factory.h>

Inherits adtf::ucom::catwo::object< IClassFactory >.

Public Member Functions

 class_factory ()
 
virtual ~class_factory ()
 
virtual tResult CreateInstance (const char *strCID, iobject_ptr< IObject > &oObject, const tChar *strNameOfObject="") const
 
tResult GetClasses (iobject_enum< const IClassInfo > &lstOfClasses) const
 Enumerates all classes supported by the class factory and pushes it to lstOfClasses This method should be used for debugging or testing purposes only.
 
- Public Member Functions inherited from adtf::ucom::catwo::object< IClassFactory >
tResult GetInterface (const char *i_strIID, void *&o_pInterface) override
 Query interfaces on an object.
 
tResult GetInterface (const char *i_strIID, const void *&o_pInterface) const override
 Provides const correct interface querying.
 
void Destroy () const override
 Switch from non-virtual destructor to virtual destructor.
 
tResult GetInterface (const char *i_strIID, void *&o_pInterface) override
 Query interfaces on an object.
 
tResult GetInterface (const char *i_strIID, const void *&o_pInterface) const override
 Provides const correct interface querying.
 
void Destroy () const override
 Switch from non-virtual destructor to virtual destructor.
 
tResult GetInterface (const char *i_strIID, void *&o_pInterface) override
 Query interfaces on an object.
 
tResult GetInterface (const char *i_strIID, const void *&o_pInterface) const override
 Provides const correct interface querying.
 
void Destroy () const override
 Switch from non-virtual destructor to virtual destructor.
 
- Public Member Functions inherited from adtf::ucom::ant::IObject
 ADTF_IID (IObject, "object.ant.ucom.adtf.iid")
 

Additional Inherited Members

- Protected Member Functions inherited from adtf::ucom::ant::IObject
 ~IObject ()=default
 Protected destructor --> Only the final implementation can be destroyed!
 

Detailed Description

template<typename ... Classes>
class adtf::ucom::class_factory< Classes >

Alias always bringing the latest version of ant::class_factory into scope.

The class class_factory provides a template based implementation of the IClassFactory interface, that can create exactly one kind of object for the class

Parameters
T.
Template Parameters
TClass of the Object to create.
EXPLICIT_INTERFACEIf the class implementation T has ambiguous conversion to the IObject use EXPLICIT_INTERFACE to define an explicit cast.

Constructor & Destructor Documentation

◆ class_factory()

template<typename ... Classes>
adtf::ucom::ant::class_factory< Classes >::class_factory ( )
inline

The Constructor create the class factory for exactly one object.

◆ ~class_factory()

template<typename ... Classes>
virtual adtf::ucom::ant::class_factory< Classes >::~class_factory ( )
inlinevirtual

standard DTOR for the class factory.

Member Function Documentation

◆ CreateInstance()

template<typename ... Classes>
virtual tResult adtf::ucom::ant::class_factory< Classes >::CreateInstance ( const char * strCID,
iobject_ptr< IObject > & oObject,
const tChar * strNameOfObject = "" ) const
inlinevirtual

Creates a new instance. The CreateInstance method creates a single uninitialized object of the class associated with a specified class identifier.

Parameters
[in]strCIDClass identifier of the object to create!
[in]strNameOfObjectObjectName identifier (will be relevant only if the ClassFactory can handle this).
[in,out]oObjectObject to create to be used to communicate with the object.
Returns
Returns a standard result code.
Return values
ERR_ERR_INVALID_LICENSEno valid license found
ReturnValue of iobject_ptr<IObject>::Reset() Implements the ucom::IClassFactory::CreateInstance. This Function will create an instance for given parameter class
<T>
.
ERR_INVALID_ARGstrCID is empty
ERR_MEMORYthe object will be created on heap. out of memory.
ERR_NO_CLASSGiven strCID is not supported by this class factory.
ERR_INVALID_INTERFACEoObject.Get() is empty after Reseting. This could be possible if the oObject expect another interface.

◆ GetClasses()

template<typename ... Classes>
tResult adtf::ucom::ant::class_factory< Classes >::GetClasses ( iobject_enum< const IClassInfo > & lstOfClasses) const
inline

Enumerates all classes supported by the class factory and pushes it to lstOfClasses This method should be used for debugging or testing purposes only.

Parameters
[in,out]lstOfClassesList to return the class information to. Use object_list or object_vector.
Returns
Returns a standard result code.
See also
object_list, object_vector.

This function will fill the iobject_enum with only one ucom::IClassInfo Object for the class given a template parameter


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