UltraGrid
UltraGrid Low-Latency High-Resolution Transmission System
Loading...
Searching...
No Matches
tanner.h
Go to the documentation of this file.
1/*
2 * =====================================================================================
3 *
4 * Filename: tanner.h
5 *
6 * Description: Definition of Tanner graph
7 *
8 * Version: 1.0
9 * Created: 03/01/2012 11:23:26 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 <vector>
21#include <map>
22
23#ifndef TANNER_H
24#define TANNER_H
25
26class Tanner_graph;
27
28
29/*
30 * =====================================================================================
31 * Class: Node
32 * Description: A node in Tanner graph
33 * =====================================================================================
34 */
35class Node
36{
37
38 public:
39 enum Node_type {
42 }; /* ---------- end of enum nodeType ---------- */
43
44 /* ==================== LIFECYCLE ======================================= */
45 Node ( Tanner_graph *t, Node_type type, char *data); /* constructor */
46// Node ( const Node &other ); /* copy constructor */
47 ~Node (); /* destructor */
48
49 /* ==================== ACCESSORS ======================================= */
50
51 char* getDataPtr() { return data; }
52
53 Node_type getType() { return type; }
54
55 bool isDone() { return done; }
56
57 /* ==================== MUTATORS ======================================= */
58
59 //int setDataPtr(char *d);
60
61 void setType(Node_type t) { type = t; }
62
63 void setDone(bool v) { done = v; }
64
65 std::vector <int> neighbours;
66
67 /* ==================== OPERATORS ======================================= */
68
69// Node& operator = ( const Node &other ); /* assignment operator */
70
71 protected:
72 /* ==================== DATA MEMBERS ======================================= */
74
75 private:
76 /* ==================== DATA MEMBERS ======================================= */
77 char *data;
79 bool done;
80
81
82}; /* ----- end of class Node ----- */
83
84
85/*
86 * =====================================================================================
87 * Class: Edge
88 * Description: Edge in Tanner graph
89 * =====================================================================================
90 */
91class Edge
92{
93 public:
94 /* ==================== LIFECYCLE ======================================= */
95 Edge (Node *first, Node *second); /* constructor */
96 Edge ( const Edge &other ); /* copy constructor */
97 ~Edge () { } /* destructor */
98
99 /* ==================== ACCESSORS ======================================= */
100
101 Node* getFirst() { return first; }
102 Node* getSecond() { return second; }
103 /* ==================== MUTATORS ======================================= */
104
105 /* ==================== OPERATORS ======================================= */
106
107 Edge& operator = ( const Edge &other ); /* assignment operator */
108
109 protected:
110 /* ==================== DATA MEMBERS ======================================= */
111
112 private:
113 /* ==================== DATA MEMBERS ======================================= */
114
117
118}; /* ----- end of class Edge ----- */
119
120
121/*
122 * =====================================================================================
123 * Class: Tanner_graph
124 * Description: Tanner graph representation
125 * =====================================================================================
126 */
128{
129 public:
130 /* ==================== LIFECYCLE ======================================= */
131
132 /* ==================== ACCESSORS ======================================= */
133
134 int get_data_size() { return data_size; }
135// std::vector<Node>& getNodes() { return nodes; }
136// std::vector<Edge>& getEdges() { return edges; }
137 /* ==================== MUTATORS ======================================= */
138
139 void add_node(Node::Node_type t, int index, char *data);
140 void set_data_size(int size);
141 /* ==================== OPERATORS ======================================= */
142
143 Tanner_graph& operator = ( const Tanner_graph &other ); /* assignment operator */
145 std::map<int, Node> nodes;
146
147 protected:
148 /* ==================== DATA MEMBERS ======================================= */
149
150 private:
151 /* ==================== DATA MEMBERS ======================================= */
152
153}; /* ----- end of class Tanner_graph ----- */
154
155#endif
Definition tanner.h:92
Edge(Node *first, Node *second)
Definition tanner.cpp:61
~Edge()
Definition tanner.h:97
Node * getFirst()
Definition tanner.h:101
Edge(const Edge &other)
Edge & operator=(const Edge &other)
Node * second
Definition tanner.h:116
Node * first
Definition tanner.h:115
Node * getSecond()
Definition tanner.h:102
Definition tanner.h:36
char * data
Definition tanner.h:77
std::vector< int > neighbours
Definition tanner.h:65
void setDone(bool v)
Definition tanner.h:63
bool done
Definition tanner.h:79
Node_type type
Definition tanner.h:78
Node_type getType()
Definition tanner.h:53
bool isDone()
Definition tanner.h:55
char * getDataPtr()
Definition tanner.h:51
~Node()
Definition tanner.cpp:40
Tanner_graph * tanner
Definition tanner.h:73
void setType(Node_type t)
Definition tanner.h:61
Node(Tanner_graph *t, Node_type type, char *data)
Definition tanner.cpp:30
Node_type
Definition tanner.h:39
@ variable_node
Definition tanner.h:40
@ constraint_node
Definition tanner.h:41
int get_data_size()
Definition tanner.h:134
Tanner_graph & operator=(const Tanner_graph &other)
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