Design Pattern Examples
Overview of object-oriented design patterns
c/Adapter_Exercise.h File Reference

Declaration of the Adapter_Exercise() function as used in the Adapter Pattern. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define __ADAPTER_EXERCISE_H__
 

Functions

void Adapter_Exercise (void)
 Example of using the Adapter design pattern in C.
 

Detailed Description

Declaration of the Adapter_Exercise() function as used in the Adapter Pattern.

Definition in file c/Adapter_Exercise.h.

Macro Definition Documentation

◆ __ADAPTER_EXERCISE_H__

#define __ADAPTER_EXERCISE_H__

Definition at line 8 of file c/Adapter_Exercise.h.

Function Documentation

◆ Adapter_Exercise()

void Adapter_Exercise ( void  )

Example of using the Adapter design pattern in C.

This example adapts functions that:

  1. Accesses memory in 32-bit chunks instead of bytes
  2. Returns error codes but no human-readable error messages

The Adapter functions translate the 32-bit chunk access into arrays of bytes. The Adapter functions also provide human-readable messages for error codes.

Definition at line 25 of file Adapter_Exercise.c.

References _countof, Adapter_BufferToString(), Adapter_CloseMemory(), Adapter_GetLastErrorMessage(), Adapter_GetMemorySize(), Adapter_OpenMemory(), Adapter_ReadMemory(), Adapter_WriteMemory(), and Memory_Block_0.