[#BloombergLP-bdlma-Factory]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdlma.adoc[bdlma]::Factory
:relfileprefix: ../../
:mrdocs:

This `class` provides a protocol (or pure interface) for a thread&hyphen;safe object creator and deleter&period; It extends the `Deleter` protocol with the addition of a `createObject` method&period;

== Synopsis

Declared in `&lt;bdlma&lowbar;factory&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class TYPE&gt;
class Factory
    : public xref:BloombergLP/bdlma/Deleter.adoc[Deleter&lt;TYPE&gt;]
----

== Base Classes

[cols="1,4"]
|===
| Name| Description
| `xref:BloombergLP/bdlma/Deleter.adoc[Deleter&lt;TYPE&gt;]`
| Provide a protocol (or pure interface) for a thread&hyphen;safe object deleter&period;
|===

== Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bdlma/Factory/2destructor.adoc[`&#126;Factory`] [.small]#[destructor]# [.small]#[virtual]#
| Destroy this object factory&period;
| xref:BloombergLP/bdlma/Factory/createObject.adoc[`createObject`]  [.small]#[virtual]#
| Create an instance of the specified `TYPE` using default arguments&period; Return the address of the newly&hyphen;created object on success, and 0 otherwise&period; The instance must be destroyed using the `deleteObject` method of this object factory&period;
| xref:BloombergLP/bdlma/Factory/deleteObject.adoc[`deleteObject`]  [.small]#[virtual]#
| Destroy the specified `instance` based on its static type and return its memory footprint to the appropriate memory manager&period; The behavior is undefined unless `instance` was obtained from a call to `createObject` on this object factory and has not yet been deleted&period;
|===


== Derived Classes

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bdlcc/ObjectPool.adoc[`ObjectPool`] 
| This class provides a thread&hyphen;safe pool of reusable objects&period; It also implements the `bdlma&colon;&colon;Factory` protocol&colon; &quot;creating&quot; objects gets them from the pool and &quot;deleting&quot; objects returns them to the pool&period;
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
