builder_pattern::Director

class Director

Orchestrates the construction process.

The Director class uses a Builder to construct a product in a predefined sequence. It ensures that the construction process is consistent and follows a specific order.

Public Functions

explicit Director(Builder *builder)

Constructor accepts a builder.

Initializes the Director with a specific builder to use for the construction process.

Parameters:

builder – A pointer to the Builder instance.

void construct()

Constructs the product by invoking the builder’s methods in order.

Constructs the product by invoking the builder’s methods in sequence.

Executes the sequence of steps to construct the product using the builder.

Orchestrates the construction process by calling the builder’s methods in a predefined order.

std::shared_ptr<Product> getProduct()

Retrieves the constructed product.

Retrieves the constructed product from the builder.

After the construction process is complete, this method retrieves the fully constructed product from the builder.

After the construction process is complete, this method retrieves the final constructed product from the builder.

Returns:

A shared pointer to the constructed Product.

Returns:

A shared pointer to the constructed Product.