Skip to content

Instantly share code, notes, and snippets.

View luistelmocosta's full-sized avatar

Luís Costa luistelmocosta

  • Porto, Portugal
View GitHub Profile
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);
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;
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{
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
{
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;
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);
/*
* ================================================================================================
* Class Vertex
* ================================================================================================
*/
template <class T>
class Vertex {
T info;
vector<Edge<T> > adj;
bool visited;
#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"
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);
/*
* Graph.h
*/
#ifndef GRAPH_H_
#define GRAPH_H_
#include <vector>
#include <queue>
#include <list>
#include <climits>