Craig's Utility Library  4.0 Beta
Utilities.DataTypes.Patterns.Factory< Key, T > Class Template Reference

Factory class More...

Public Member Functions

 Factory ()
 Constructor More...
 
virtual T Create (Key Key)
 Creates an instance associated with the key More...
 
virtual bool Exists (Key Key)
 Determines if a key has been registered More...
 
virtual void Register (Key Key, T Result)
 Registers an item More...
 
virtual void Register (Key Key, Func< T > Constructor)
 Registers an item More...
 

Properties

Dictionary< Key, Func< T > > Constructors [get]
 List of constructors/initializers More...
 

Detailed Description

Factory class

Template Parameters
KeyThe "message" type
TThe class type that you want created

Definition at line 32 of file Factory.cs.

Constructor & Destructor Documentation

Constructor

Definition at line 37 of file Factory.cs.

Member Function Documentation

virtual T Utilities.DataTypes.Patterns.Factory< Key, T >.Create ( Key  Key)
virtual

Creates an instance associated with the key

Parameters
KeyRegistered item
Returns
The type returned by the initializer

Definition at line 52 of file Factory.cs.

virtual bool Utilities.DataTypes.Patterns.Factory< Key, T >.Exists ( Key  Key)
virtual

Determines if a key has been registered

Parameters
KeyKey to check
Returns
True if it exists, false otherwise

Definition at line 62 of file Factory.cs.

virtual void Utilities.DataTypes.Patterns.Factory< Key, T >.Register ( Key  Key,
Result 
)
virtual

Registers an item

Parameters
KeyItem to register
ResultThe object to be returned

Definition at line 72 of file Factory.cs.

virtual void Utilities.DataTypes.Patterns.Factory< Key, T >.Register ( Key  Key,
Func< T >  Constructor 
)
virtual

Registers an item

Parameters
KeyItem to register
ConstructorThe function to call when creating the item

Definition at line 82 of file Factory.cs.

Property Documentation

Dictionary<Key, Func<T> > Utilities.DataTypes.Patterns.Factory< Key, T >.Constructors
getprotected

List of constructors/initializers

Definition at line 45 of file Factory.cs.


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