mirror of
https://gitlab.com/klmp200/LO41.git
synced 2025-07-10 11:49:24 +00:00
Ajout des singletons
This commit is contained in:
18
SharedData/SharedData.c
Normal file
18
SharedData/SharedData.c
Normal file
@ -0,0 +1,18 @@
|
||||
//
|
||||
// Created by Antoine Bartuccio on 06/06/2018.
|
||||
//
|
||||
|
||||
#include "SharedData.h"
|
||||
|
||||
void _free__SharedData(THIS(SharedData)){
|
||||
free(this);
|
||||
}
|
||||
|
||||
SharedData *_get_instance_SharedData(){
|
||||
static SharedData * new_shared_data = NULL;
|
||||
if (new_shared_data == NULL){
|
||||
new_shared_data = malloc_or_die(sizeof(SharedData));
|
||||
LINK(SharedData, new_shared_data, _free_);
|
||||
}
|
||||
return new_shared_data;
|
||||
}
|
17
SharedData/SharedData.h
Normal file
17
SharedData/SharedData.h
Normal file
@ -0,0 +1,17 @@
|
||||
//
|
||||
// Created by Antoine Bartuccio on 06/06/2018.
|
||||
//
|
||||
|
||||
#ifndef LO41_SHAREDDATA_H
|
||||
#define LO41_SHAREDDATA_H
|
||||
|
||||
#include "../Objects.h"
|
||||
|
||||
typedef struct o_SharedData {
|
||||
|
||||
DESTRUCTOR(SharedData);
|
||||
} SharedData;
|
||||
|
||||
SharedData *_get_instance_SharedData();
|
||||
|
||||
#endif //LO41_SHAREDDATA_H
|
Reference in New Issue
Block a user