Design Pattern Examples
Overview of object-oriented design patterns
Flyweight_Display.h File Reference

Declaration of the Display_Create() and Display_Destroy() functions for managing the Display structure that represents a "display" windows as used in the Flyweight Pattern. More...

#include <stdbool.h>
Include dependency graph for Flyweight_Display.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  Display
 Represents a "display" window, in which to render Flyweight images. This "display" window is then printed to the console window at a specified coordinate to render a "frame" of motion in the "display". More...
 

Macros

#define __FLYWEIGHT_DISPLAY_H__
 

Functions

bool Display_Create (Display *display, int width, int height)
 Create a "display" window in the given Display object, with the given width and height.
 
void Display_Destroy (Display *display)
 Destroy the "display" window in the given Display object by releasing the memory associated with it. After this function returns, the Display object is no longer usable without calling Display_Create() again.
 

Detailed Description

Declaration of the Display_Create() and Display_Destroy() functions for managing the Display structure that represents a "display" windows as used in the Flyweight Pattern.

Definition in file Flyweight_Display.h.

Macro Definition Documentation

◆ __FLYWEIGHT_DISPLAY_H__

#define __FLYWEIGHT_DISPLAY_H__

Definition at line 9 of file Flyweight_Display.h.

Function Documentation

◆ Display_Create()

bool Display_Create ( Display display,
int  width,
int  height 
)

Create a "display" window in the given Display object, with the given width and height.

Parameters
displayThe Display object in which to construct the "display" window.
widthThe width of the window, in characters.
heightThe height of the window, in character.

Definition at line 14 of file Flyweight_Display.c.

References Display::area, Display_Destroy(), Display::height, and Display::width.

Referenced by _Flyweight_GenerateDisplay().

◆ Display_Destroy()

void Display_Destroy ( Display display)

Destroy the "display" window in the given Display object by releasing the memory associated with it. After this function returns, the Display object is no longer usable without calling Display_Create() again.

Parameters
displayThe Display object to free.

Definition at line 50 of file Flyweight_Display.c.

References Display::area, Display::height, and Display::width.

Referenced by Display_Create(), and Flyweight_Exercise().