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

Declaration of the Flyweight_ImageList and Flyweight_Image structures, the latter which wraps the big resource handle and a Flyweight_Context as used in the Flyweight Pattern. More...

Include dependency graph for Flyweight_Image.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  Flyweight_Image
 Represents an image that associates a context with a big resource. More...
 
struct  Flyweight_ImageList
 Represents an expandable list of Flyweight_Image objects. This is managed by the Flyweight_ImageList_Clear() and Flyweight_ImageList_Add() functions. More...
 

Macros

#define __FLYWEIGHT_IMAGE_H__
 

Functions

void Flyweight_ImageList_Clear (Flyweight_ImageList *imageList)
 Clear the given Flyweight_ImageList object by freeing up all allocated Flyweight_image objects and resetting the list to a "new" state so it can be reused.
 
void Flyweight_ImageList_Add (Flyweight_ImageList *imageList, Flyweight_Image *image)
 Add a Flyweight_Image object to the given Flyweight_ImageList object. The list takes ownership of the BigResource object and is responsible for releasing all memory associated with it.
 

Detailed Description

Declaration of the Flyweight_ImageList and Flyweight_Image structures, the latter which wraps the big resource handle and a Flyweight_Context as used in the Flyweight Pattern.

Definition in file Flyweight_Image.h.

Macro Definition Documentation

◆ __FLYWEIGHT_IMAGE_H__

#define __FLYWEIGHT_IMAGE_H__

Definition at line 9 of file Flyweight_Image.h.

Function Documentation

◆ Flyweight_ImageList_Add()

void Flyweight_ImageList_Add ( Flyweight_ImageList imageList,
Flyweight_Image image 
)

Add a Flyweight_Image object to the given Flyweight_ImageList object. The list takes ownership of the BigResource object and is responsible for releasing all memory associated with it.

Parameters
imageListThe Flyweight_ImageList object to add to.
imageThe Flyweight_Image object to be copied to the Flyweight_ImageList.

Definition at line 27 of file Flyweight_Image.c.

References Flyweight_ImageList::images, and Flyweight_ImageList::images_count.

Referenced by _Flyweight_GenerateFlyweightClasses().

◆ Flyweight_ImageList_Clear()

void Flyweight_ImageList_Clear ( Flyweight_ImageList imageList)

Clear the given Flyweight_ImageList object by freeing up all allocated Flyweight_image objects and resetting the list to a "new" state so it can be reused.

Parameters
imageListA pointer to the Flyweight_ImageList to be cleared.

Definition at line 14 of file Flyweight_Image.c.

References Flyweight_ImageList::images, and Flyweight_ImageList::images_count.

Referenced by Flyweight_Exercise().