Web Analytics Made Easy - Statcounter
Skip to content

Class SBCClassFactory#

ClassList > SBCClassFactory

This class describes a class factory in a class proxy. More...

  • #include <SBCClassFactory.hpp>

Public Functions#

Type Name
SBCClassFactory ()
Constructs a class factory.
void addConstructor (SBCClassConstructor * constructor)
Adds a constructor to the factory.
SBCClassConstructor * getConstructor (const SBValue & t0=SBValue(), const SBValue & t1=SBValue(), const SBValue & t2=SBValue(), const SBValue & t3=SBValue(), const SBValue & t4=SBValue(), const SBValue & t5=SBValue(), const SBValue & t6=SBValue(), const SBValue & t7=SBValue(), const SBValue & t8=SBValue(), const SBValue & t9=SBValue(), const SBValue & t10=SBValue(), const SBValue & t11=SBValue(), const SBValue & t12=SBValue(), const SBValue & t13=SBValue(), const SBValue & t14=SBValue(), const SBValue & t15=SBValue()) const
Returns the constructor with arguments t0 ,t1 , ...,t15 .
SBHashMap< std::string, SBCClassConstructor * > const & getConstructorMap () const
Returns the constructor map.
unsigned int getNumberOfConstructors () noexcept const
Returns the number of registered constructors.
void print (unsigned int offset=0) const
Prints the factory.
virtual ~SBCClassFactory ()
Destructs the factory.

Detailed Description#

Short name: SBFactory

Public Functions Documentation#

function SBCClassFactory#

Constructs a class factory.

SBCClassFactory::SBCClassFactory () 

Constructs a new SBCClassFactory instance.

Initializes the internal map that stores constructors.


function addConstructor#

Adds a constructor to the factory.

void SBCClassFactory::addConstructor (
    SBCClassConstructor * constructor
) 

Registers the provided constructor in the internal map. If the pointer is null, an error is logged.

Parameters:


function getConstructor#

Returns the constructor with arguments t0 ,t1 , ...,t15 .

SBCClassConstructor * SBCClassFactory::getConstructor (
    const SBValue & t0=SBValue (),
    const SBValue & t1=SBValue (),
    const SBValue & t2=SBValue (),
    const SBValue & t3=SBValue (),
    const SBValue & t4=SBValue (),
    const SBValue & t5=SBValue (),
    const SBValue & t6=SBValue (),
    const SBValue & t7=SBValue (),
    const SBValue & t8=SBValue (),
    const SBValue & t9=SBValue (),
    const SBValue & t10=SBValue (),
    const SBValue & t11=SBValue (),
    const SBValue & t12=SBValue (),
    const SBValue & t13=SBValue (),
    const SBValue & t14=SBValue (),
    const SBValue & t15=SBValue ()
) const

Retrieves a constructor matching the provided arguments.

Searches the registered constructors and returns the one that can create an instance with the given arguments. If multiple constructors match, an error is logged and the first match is returned. If none match, nullptr is returned.

Parameters:

  • t0 First argument value (default constructed if not provided).
  • t1 Second argument value.
  • t2 Third argument value.
  • t3 Fourth argument value.
  • t4 Fifth argument value.
  • t5 Sixth argument value.
  • t6 Seventh argument value.
  • t7 Eighth argument value.
  • t8 Ninth argument value.
  • t9 Tenth argument value.
  • t10 Eleventh argument value.
  • t11 Twelfth argument value.
  • t12 Thirteenth argument value.
  • t13 Fourteenth argument value.
  • t14 Fifteenth argument value.
  • t15 Sixteenth argument value.

Returns:

Pointer to a matching SBCClassConstructor, or nullptr if none found.


function getConstructorMap#

Returns the constructor map.

SBHashMap< std::string, SBCClassConstructor * > const & SBCClassFactory::getConstructorMap () const

Returns the map of registered constructors.

Provides read-only access to the internal map that associates constructor signatures with their instances.

Returns:

Constant reference to the map of constructors.


function getNumberOfConstructors#

Returns the number of registered constructors.

unsigned int SBCClassFactory::getNumberOfConstructors () noexcept const

Retrieves the count of constructors currently stored in the factory.

Returns:

Number of constructors.


function print#

Prints the factory.

void SBCClassFactory::print (
    unsigned int offset=0
) const

Prints information about the factory and its constructors.

Outputs the factory details and a list of registered constructor signatures, indented by the specified offset.

Parameters:

  • offset Number of tab characters to indent the output.

function ~SBCClassFactory#

Destructs the factory.

virtual SBCClassFactory::~SBCClassFactory () 

Destroys the SBCClassFactory instance.

Releases the internal constructor map.