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
int byteStuffing(char **buf, int length){ | |
int newlength = length; | |
int i; | |
for (i = 1; i < length - 1; i++) | |
if ((*buf)[i] == FLAG || (*buf)[i] == ESCAPE) | |
newlength++; | |
*buf = (unsigned char*) realloc(*buf, newlength); |
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
void Campeonato::readFileBilhetes(string filename) { | |
ifstream ficheiro_leitura(filename.c_str()); | |
if(!ficheiro_leitura) | |
throw ErroNoFicheiro(filename); | |
else{ | |
string dono, data, provas; | |
unsigned int duracao; |
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
void Campeonato::readFileBilhetes(string filename) { | |
ifstream ficheiro_leitura(filename.c_str()); | |
vector<Prova*> vecprovas = calendario->getProvas(); | |
vector <int> indices; | |
if(!ficheiro_leitura) | |
throw ErroNoFicheiro(filename); | |
else{ |
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
void Campeonato::readFileBilhetes(string filename) { | |
fstream infile(filename.c_str()); | |
string linha, dono; | |
int dia, mes, ano; | |
vector<int> campeonatoIds; | |
while (getline(infile, dono)) // get name and check status file stream | |
{ |
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
void Campeonato::readFileBilhetes(string filename) { | |
fstream infile(filename.c_str()); | |
string linha, dono; | |
int dia, mes, ano; | |
vector<int> campeonatoIds; | |
BSTItrIn<Prova> it = calendario->getProvas(); | |
vector<Prova*> tmp; |
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
template<class T> | |
void Graph<T>::dijkstraShortestPath(const T &s) { | |
for(unsigned int i = 0; i < vertexSet.size(); i++) { | |
vertexSet[i]->path = NULL; | |
vertexSet[i]->dist = INT_INFINITY; | |
vertexSet[i]->processing = false; | |
} | |
Vertex<T>* v = getVertex(s); |
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
/* | |
* ================================================================================================ | |
* Class Vertex | |
* ================================================================================================ | |
*/ | |
template <class T> | |
class Vertex { | |
T info; | |
vector<Edge<T> > adj; | |
bool visited; |
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 <cstdio> | |
#include "graphviewer.h" | |
#include <fstream> | |
#include <iostream> | |
#include <sstream> | |
#include <conio.h> | |
#include <vector> | |
#include "Graph.h" | |
#include "Estacao.h" | |
#include "DadosGraficos.h" |
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
template<class T> | |
void Graph<T>::dijkstraShortestPath(const T &s) { | |
for(unsigned int i = 0; i < vertexSet.size(); i++) { | |
vertexSet[i]->path = NULL; | |
vertexSet[i]->dist = INT_INFINITY; | |
vertexSet[i]->processing = false; | |
} | |
Vertex<T>* v = getVertex(s); |
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
/* | |
* Graph.h | |
*/ | |
#ifndef GRAPH_H_ | |
#define GRAPH_H_ | |
#include <vector> | |
#include <queue> | |
#include <list> | |
#include <climits> |
OlderNewer