UltraGrid
UltraGrid Low-Latency High-Resolution Transmission System
Loading...
Searching...
No Matches
tanner.cpp
Go to the documentation of this file.
1/*
2 * =====================================================================================
3 *
4 * Filename: tanner.cpp
5 *
6 * Description: Implementation of Tanner graph
7 *
8 * Version: 1.0
9 * Created: 03/01/2012 11:22:55 AM
10 * Revision: none
11 * Compiler: gcc
12 *
13 * Author: Milan Kabat (), kabat@ics.muni.cz
14 * Company: FI MUNI
15 *
16 * =====================================================================================
17 */
18
19
20#include <cstring>
21#include <cstdlib>
22#include <cstdio>
23#include "tanner.h"
24
25using namespace std;
26
27/*-----------------------------------------------------------------------------
28 * Implementation of class Node
29 *-----------------------------------------------------------------------------*/
30Node::Node(Tanner_graph * /* tanner */, Node::Node_type t, char *d) {
31// int size = tanner->data_size;
32 this->type = t;
33 data = d;
34 done = false;
35// neighbours[0] = 0;
36// printf("Created node with data: %d\n", *data);
37 tanner = nullptr;
38}
39
42
43#if 0
44// unused and seems quite suspicious (but since it is not called, it is unclear
45// what contents of pointer d is
46int Node::setDataPtr(char *d) {
47
48 if ( d != 0 ) {
49 sprintf(data, d, tanner->data_size);
50 return 0;
51 } else
52 return 1;
53}
54#endif
55
56
57/*-----------------------------------------------------------------------------
58 * Implementation fo class Edge
59 *-----------------------------------------------------------------------------*/
60
62 first = a;
63 second = b;
64}
65
66
67/*-----------------------------------------------------------------------------
68 * Implementation fo class Tanner_graph
69 *-----------------------------------------------------------------------------*/
71 data_size = size;
72}
73
74void Tanner_graph::add_node(Node::Node_type type, int index, char *data) {
75// printf("Creating node with data: %d\n", *data);
76
77 if(data == NULL) {
78// void *d = calloc(data_size, sizeof(char));
79 Node n(this, type, data);
80 nodes.insert(std::pair <int, Node>(index, n));
81 } else {
82 Node n(this, type, data);
83 nodes.insert(std::pair <int, Node>(index, n));
84 }
85}
86
87
Edge(Node *first, Node *second)
Definition tanner.cpp:61
Node * second
Definition tanner.h:116
Node * first
Definition tanner.h:115
Definition tanner.h:36
char * data
Definition tanner.h:77
bool done
Definition tanner.h:79
Node_type type
Definition tanner.h:78
~Node()
Definition tanner.cpp:40
Tanner_graph * tanner
Definition tanner.h:73
Node(Tanner_graph *t, Node_type type, char *data)
Definition tanner.cpp:30
Node_type
Definition tanner.h:39
std::map< int, Node > nodes
Definition tanner.h:145
int data_size
Definition tanner.h:144
void set_data_size(int size)
Definition tanner.cpp:70
void add_node(Node::Node_type t, int index, char *data)
Definition tanner.cpp:74
Option::OptType type
Definition settings.cpp:194