Implementation of the proxy service, accessed through the GetProxyService() function, as used in the Proxy Pattern. More...
#include <stdlib.h>
#include <stdio.h>
#include "Proxy_RealService.h"
#include "Proxy_ProxyService.h"
Go to the source code of this file.
Functions | |
static IWorkByProxy * | Proxy_GetRealService (void) |
Helper function to retrieve the one and only instance of the real service. This hides the details of instantiating the real service. | |
bool | Proxy_DoWork (DynamicString *someArgument) |
Do some work on a dynamic string. | |
IWorkByProxy * | GetProxyService (void) |
Obtain the proxy service. | |
Variables | |
static IWorkByProxy * | _realService = NULL |
The one and only instance of the real service associated with this proxy service instance. | |
IWorkByProxy | proxy_service |
The proxy service. | |
Implementation of the proxy service, accessed through the GetProxyService() function, as used in the Proxy Pattern.
Definition in file Proxy_ProxyService.c.
IWorkByProxy * GetProxyService | ( | void | ) |
Obtain the proxy service.
Note that the real service will not be obtained until the first call into the proxy service.
Definition at line 75 of file Proxy_ProxyService.c.
References proxy_service.
Referenced by Proxy_Exercise().
bool Proxy_DoWork | ( | DynamicString * | someArgument | ) |
Do some work on a dynamic string.
someArgument | A DynamicString object to alter. |
The real service this proxy represents is not instantiated until this function is called, even though the proxy service has been obtained. When this function is called for the first time, /// the real service is obtained, incurring a performance penalty only on the first call.
Definition at line 47 of file Proxy_ProxyService.c.
References IWorkByProxy::DoWork, and Proxy_GetRealService().
|
static |
Helper function to retrieve the one and only instance of the real service. This hides the details of instantiating the real service.
Definition at line 26 of file Proxy_ProxyService.c.
References _realService, and GetRealService().
Referenced by Proxy_DoWork().
|
static |
The one and only instance of the real service associated with this proxy service instance.
Definition at line 17 of file Proxy_ProxyService.c.
Referenced by Proxy_GetRealService().
IWorkByProxy proxy_service |
The proxy service.
Definition at line 65 of file Proxy_ProxyService.c.
Referenced by GetProxyService().