queue ok for flux

This commit is contained in:
quentin.perret 2022-06-10 15:50:27 +02:00
parent 8c9de2d97d
commit 2e7253c43c
5 changed files with 21 additions and 13 deletions

Binary file not shown.

View file

@ -19,10 +19,9 @@ int main(int argc , char** argv){
double period = 1 / freqEch; double period = 1 / freqEch;
double invTimeBandWidth = 1 /(nRow * period); double invTimeBandWidth = 1 /(nRow * period);
Pqueue new = createE
/*
pthread_t rawData; pthread_t rawData;
pthread_create(&rawData , NULL, simulateFlux, (void *)&rawData); pthread_create(&rawData , NULL, simulateFlux, (void *)&rawData);
pthread_exit(NULL); pthread_exit(NULL);
*/
} }

View file

@ -24,7 +24,7 @@ typedef struct queue *Pqueue;
* @param lenChar size of char array that will be created * @param lenChar size of char array that will be created
* @return Pqueue new element created * @return Pqueue new element created
*/ */
Pqueue createE(int lenChar , char* _tabChar){ Pqueue createE(int lenChar){
Pqueue new = (Pqueue) malloc(sizeof(struct queue)); Pqueue new = (Pqueue) malloc(sizeof(struct queue));
assert(new); assert(new);
/* ???? tab char create or give pointer ???*/ /* ???? tab char create or give pointer ???*/
@ -55,18 +55,24 @@ char * gettabChar(Pqueue elem){
return elem->tabChar; return elem->tabChar;
} }
Pqueue setCharLen(Pqueue elem , int _charLen){ void setCharLen(Pqueue elem , int _charLen){
assert(elem); assert(elem);
elem->charLen = _charLen; elem->charLen = _charLen;
} }
Pqueue setTabChar(Pqueue elem , int _charLen , char *_tabChar){ void setTabChar(Pqueue elem , int _charLen , char *_tabChar){
assert(elem); assert(elem);
elem->charLen = _charLen; elem->charLen = _charLen;
elem->tabChar = (char *) malloc(_charLen * sizeof(char)); elem->tabChar = (char *) malloc(_charLen * sizeof(char));
elem->tabChar = _tabChar; elem->tabChar = _tabChar;
} }
void setNextE(Pqueue elem , Pqueue next){
assert(elem);
assert(next);
elem -> pNextE = next;
}
/** /**
* @brief remove and free the last element of queue * @brief remove and free the last element of queue
* *
@ -129,10 +135,11 @@ Pqueue addLastQ(Pqueue elem, const char* str, int len){
previous = tmp; previous = tmp;
tmp = getNextE(tmp); tmp = getNextE(tmp);
} }
tmp = createE(len); tmp -> pNextE = createE(len);
tmp->tabChar = str; Pqueue next = getNextE(tmp);
tmp->charLen = len; next->tabChar = str;
return tmp; next->charLen = len;
return next;
} }
void printE(Pqueue elem){ void printE(Pqueue elem){

View file

@ -11,8 +11,10 @@ Pqueue getNextE(Pqueue elem);
char * gettabChar(Pqueue elem); char * gettabChar(Pqueue elem);
//Setters //Setters
Pqueue setCharLen(Pqueue elem , int _charLen); void setCharLen(Pqueue elem , int _charLen);
Pqueue setTabChar(Pqueue elem , int _charLen , char *_tabChar); void setTabChar(Pqueue elem , int _charLen , char *_tabChar);
void setNextE(Pqueue elem , Pqueue next);
Pqueue addLastQ(Pqueue elem, const char* str, int len); Pqueue addLastQ(Pqueue elem, const char* str, int len);
//Removers //Removers

View file

@ -107,7 +107,7 @@ bool writeOneRawData(FILE *rawDataFile){
} }
} }
cptData++; cptData++;
sleep(0.004); //simul la freq ech //sleep(0.004); //simul la freq ech
return true; return true;
} }
else { else {