Coconut Framework  beta
CNEdge.h
Go to the documentation of this file.
1 
8 #ifndef CNEDGE_H
9 #define CNEDGE_H
10 
11 #include "CNObject.h"
12 #include "CNType.h"
13 #include "CNForwarders.h"
14 
16 struct CNEdge {
20  struct CNNode * producerNode ;
22  struct CNNode * consumerNode ;
25 } ;
26 
28 typedef void (*CNPrintEdgeFuncRef)(struct CNText * buf, const struct CNEdge * src) ;
29 
31 struct CNEdgeMethods {
36 } ;
37 
48 struct CNEdge *
49 CNAllocateEdge(struct CNGraph * parent, size_t size, const struct CNEdgeMethods * methods) ;
50 
55 static inline void
56 CNRetainEdge(struct CNEdge * dst)
57 {
58  CNRetainObject(&(dst->superClass)) ;
59 }
60 
65 static inline void
66 CNReleaseEdge(struct CNEdge * dst)
67 {
68  CNReleaseObject(&(dst->superClass)) ;
69 }
70 
76 static inline struct CNResource *
77 CNResourceOfEdge(struct CNEdge * src)
78 {
79  return CNResourceOfObject(&(src->superClass)) ;
80 }
81 
87 static inline struct CNObject *
88 CNObjectOfEdge(struct CNEdge * src)
89 {
90  return &(src->superClass) ;
91 }
92 
99 void
100 CNDestroyContextOfEdge(struct CNEdge * dst) ;
101 
107 static inline void
108 CNPrintEdge(struct CNText * buf, const struct CNEdge * src)
109 {
110  const struct CNEdgeMethods * methods = (const struct CNEdgeMethods *) CNMethodsOfObject(&(src->superClass)) ;
111  (*(methods->printEdge))(buf, src) ;
112 }
113 
119 static inline struct CNNode *
120 CNProducerNodeOfEdge(const struct CNEdge * src)
121 {
122  return src->producerNode ;
123 }
124 
130 void
131 CNSetProducerNodeToEdge(struct CNEdge * dst, struct CNNode * src) ;
132 
138 static inline struct CNNode *
139 CNConsumerNodeOfEdge(const struct CNEdge * src)
140 {
141  return src->consumerNode ;
142 }
143 
149 void
150 CNSetConsumerNodeToEdge(struct CNEdge * dst, struct CNNode * src) ;
151 
157 static inline CNBoolean
158 CNIsVisitedEdge(const struct CNEdge * src)
159 {
160  return src->isVisited ;
161 }
162 
168 static inline void
169 CNSetVisitedEdge(struct CNEdge * dst, CNBoolean flag)
170 {
171  dst->isVisited = flag ;
172 }
173 
174 #endif /* CNEDGE */
175 
static void CNPrintEdge(struct CNText *buf, const struct CNEdge *src)
Print the context of edge.
Definition: CNEdge.h:108
static struct CNNode * CNProducerNodeOfEdge(const struct CNEdge *src)
Get producer node from edge.
Definition: CNEdge.h:120
static struct CNObject * CNObjectOfEdge(struct CNEdge *src)
Get object of the edge.
Definition: CNEdge.h:88
void CNDestroyContextOfEdge(struct CNEdge *dst)
Release the contex of the edge.
Definition: CNText.h:20
Edge of the graph.
Definition: CNEdge.h:16
Forward declaration of data types.
struct CNObjectMethods superClass
Definition: CNEdge.h:33
Root object.
Definition: CNObject.h:38
CNPrintEdgeFuncRef printEdge
Definition: CNEdge.h:35
static void CNSetVisitedEdge(struct CNEdge *dst, CNBoolean flag)
Set visited flag to edge.
Definition: CNEdge.h:169
static void CNRetainEdge(struct CNEdge *dst)
Retrain the resource for the CNEdge.
Definition: CNEdge.h:56
struct CNEdge * CNAllocateEdge(struct CNGraph *parent, size_t size, const struct CNEdgeMethods *methods)
Allocate CNEdge.
static struct CNResource * CNResourceOfEdge(struct CNEdge *src)
Get resource of the CNEdge.
Definition: CNEdge.h:77
Methods for CNNode.
Definition: CNEdge.h:31
Node of the direct acyclic graph.
Definition: CNNode.h:17
CNBoolean isVisited
Definition: CNEdge.h:24
Direct Acyclic Graph model.
Definition: CNGraph.h:17
Define CNObject data structure.
static CNBoolean CNIsVisitedEdge(const struct CNEdge *src)
Check visited flag in edge.
Definition: CNEdge.h:158
Methods for CNObject.
Definition: CNObject.h:29
struct CNNode * consumerNode
Definition: CNEdge.h:22
Define primitive data types.
void CNReleaseObject(struct CNObject *dst)
Release the object.
struct CNObject superClass
Definition: CNEdge.h:18
static void CNRetainObject(struct CNObject *dst)
Retain the object.
Definition: CNObject.h:75
void CNSetConsumerNodeToEdge(struct CNEdge *dst, struct CNNode *src)
Set consumer node for the edge.
void(* CNPrintEdgeFuncRef)(struct CNText *buf, const struct CNEdge *src)
Definition: CNEdge.h:28
static struct CNNode * CNConsumerNodeOfEdge(const struct CNEdge *src)
Get consumer node from edge.
Definition: CNEdge.h:139
static void CNReleaseEdge(struct CNEdge *dst)
Release the resource for the CNEdge.
Definition: CNEdge.h:66
unsigned int CNBoolean
Boolean type.
Definition: CNType.h:14
static struct CNResource * CNResourceOfObject(struct CNObject *src)
Get resource for the object.
Definition: CNObject.h:95
void CNSetProducerNodeToEdge(struct CNEdge *dst, struct CNNode *src)
Set producer node for the edge.
static struct CNObjectMethods * CNMethodsOfObject(const struct CNObject *src)
Get methods for the object.
Definition: CNObject.h:106
struct CNNode * producerNode
Definition: CNEdge.h:20