Design Pattern Examples
Overview of object-oriented design patterns
Proxy_RealService.c File Reference

Implementation of the real service, accessed through the GetRealService() function, as used in the Proxy Pattern. More...

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "helpers/formatstring.h"
#include "Proxy_RealService.h"
Include dependency graph for Proxy_RealService.c:

Go to the source code of this file.

Functions

static bool _Real_DoWork (DynamicString *someArgument)
 The real function that does all the work in the real service.
 
IWorkByProxyGetRealService (void)
 Return a pointer to the real service expressed as an IWorkByProxy service.
 

Variables

static IWorkByProxy _real_service
 The real service that does all the work.
 

Detailed Description

Implementation of the real service, accessed through the GetRealService() function, as used in the Proxy Pattern.

Definition in file Proxy_RealService.c.

Function Documentation

◆ _Real_DoWork()

static bool _Real_DoWork ( DynamicString someArgument)
static

The real function that does all the work in the real service.

Definition at line 20 of file Proxy_RealService.c.

References DynamicString_Set(), formatstring(), and DynamicString::string.

◆ GetRealService()

IWorkByProxy * GetRealService ( void  )

Return a pointer to the real service expressed as an IWorkByProxy service.

Returns
Returns an IWorkByProxy object representing the real service.

Definition at line 53 of file Proxy_RealService.c.

References _real_service.

Referenced by Proxy_GetRealService().

Variable Documentation

◆ _real_service

IWorkByProxy _real_service
static
Initial value:
= {
}
static bool _Real_DoWork(DynamicString *someArgument)
The real function that does all the work in the real service.

The real service that does all the work.

This would normally be a very expensive to create because it might be running on the server end of a remoting channel.

Definition at line 43 of file Proxy_RealService.c.

Referenced by GetRealService().