1
0
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:
2018-06-06 13:50:11 +02:00
parent 00eebf97f2
commit 8b29c54d76
5 changed files with 42 additions and 1 deletions

18
SharedData/SharedData.c Normal file
View 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
View 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