Created
May 11, 2017 00:44
-
-
Save brun0xff/aed2018f959a0602f1e073ef35062b6d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include "aloca.h" | |
using namespace std; | |
meualoc::meualoc(int tamanhoMemoria,int politicaMem) | |
{ | |
memoria = (char *) malloc(sizeof(char) * tamanhoMemoria); | |
this->politicaMem = politicaMem; | |
this->tamanhoMemoria = tamanhoMemoria; | |
} | |
char *meualoc::aloca(unsigned short int tamanho) | |
{ | |
char *new_nemory = NULL; | |
if(politicaMem == FIRSTFIT) | |
{ | |
/* FIRSTFIT */ | |
for(int i=0; i<tamanhoMemoria; i++) | |
{ | |
if(memoria[i] == NULL) | |
{ | |
} | |
} | |
} | |
else if(politicaMem == BESTFIT) | |
{ | |
/* BESTFIT */ | |
} | |
else if(politicaMem == NEXTFIT) | |
{ | |
/* NEXTFIT */ | |
} | |
return new_nemory; | |
} | |
int meualoc::libera(char* ponteiro) | |
{ | |
cout << "libera(char* ponteiro)" << '\n'; | |
return 0; | |
} | |
char *meualoc::verifica(char* ponteiro,int posicao) | |
{ | |
cout << "verifica(char* ponteiro,int posicao) " << posicao << endl; | |
return NULL; | |
} | |
void meualoc::imprimeDados() | |
{ | |
printf("Nº of elements: %d\n", 0); | |
printf("Nº of higher number: %d\n", 0); | |
printf("Nº avg blocks null: %d\n", 0); | |
} | |
meualoc::~meualoc() | |
{ | |
free(memoria); | |
} | |
int main(int argc, const char ** argv) | |
{ | |
meualoc obj(50,1); | |
obj.aloca(6); | |
obj.verifica(NULL); | |
obj.verifica(NULL, 666); | |
obj.libera(NULL); | |
obj.imprimeDados(); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment