design_pattern_for_c  V 1.00
prototype_factory.c File Reference

Implement of prototype_factory API, defined in prototype_factory.h. More...

#include <stdlib.h>
#include "dp_util.h"
#include "prototype_factory.h"
Include dependency graph for prototype_factory.c:

Go to the source code of this file.

Data Structures

struct  prototype_factory_instance_t
 prototype_factory_instance, PrototypeFactory class instance definition More...
 

Macros

#define PROT_FACT_DEFAULT_METHOD(key)   prototype_default_ ## key
 define to set default More...
 
#define PROT_FACT_SET_METHOD(this, factory_method, key)
 define to set method More...
 

Functions

static void * prototype_default_clone (void *base, size_t base_length)
 clone More...
 
static void prototype_default_free (void *clone_base)
 free More...
 
static void prototype_default_free_base (void *base)
 free base More...
 
PrototypeFactoryInstance prototype_factory_instance_new (void *base, size_t base_length, prototype_factory_method_t *factory_method)
 new More...
 
void prototype_factory_instance_free (PrototypeFactoryInstance this)
 free More...
 
void * prototype_factory_instance_clone_data (PrototypeFactoryInstance this)
 clone data More...
 
void prototype_factory_instance_free_data (PrototypeFactoryInstance this, void *data)
 free data More...
 

Detailed Description

Implement of prototype_factory API, defined in prototype_factory.h.

Definition in file prototype_factory.c.

Macro Definition Documentation

◆ PROT_FACT_DEFAULT_METHOD

#define PROT_FACT_DEFAULT_METHOD (   key)    prototype_default_ ## key

define to set default

Definition at line 27 of file prototype_factory.c.

◆ PROT_FACT_SET_METHOD

#define PROT_FACT_SET_METHOD (   this,
  factory_method,
  key 
)
Value:
if(factory_method && factory_method->key) instance->factory_method.key = factory_method->key;\
else instance->factory_method.key = PROT_FACT_DEFAULT_METHOD(key)
#define PROT_FACT_DEFAULT_METHOD(key)
define to set default

define to set method

Definition at line 29 of file prototype_factory.c.

Function Documentation

◆ prototype_default_clone()

static void * prototype_default_clone ( void *  base,
size_t  base_length 
)
static

clone

Definition at line 35 of file prototype_factory.c.

◆ prototype_default_free()

static void prototype_default_free ( void *  clone_base)
static

free

Definition at line 44 of file prototype_factory.c.

◆ prototype_default_free_base()

static void prototype_default_free_base ( void *  base)
static

free base

Definition at line 48 of file prototype_factory.c.

◆ prototype_factory_instance_clone_data()

void* prototype_factory_instance_clone_data ( PrototypeFactoryInstance  this)

clone data

Definition at line 77 of file prototype_factory.c.

Here is the caller graph for this function:

◆ prototype_factory_instance_free()

void prototype_factory_instance_free ( PrototypeFactoryInstance  this)

free

Definition at line 71 of file prototype_factory.c.

Here is the caller graph for this function:

◆ prototype_factory_instance_free_data()

void prototype_factory_instance_free_data ( PrototypeFactoryInstance  this,
void *  data 
)

free data

Definition at line 82 of file prototype_factory.c.

Here is the caller graph for this function:

◆ prototype_factory_instance_new()

PrototypeFactoryInstance prototype_factory_instance_new ( void *  base,
size_t  base_length,
prototype_factory_method_t factory_method 
)

new

Definition at line 55 of file prototype_factory.c.

Here is the caller graph for this function: