Coconut Framework  beta
Classes | Functions
CNGraph.h File Reference

Define CNGraph class. More...

#include "CNObject.h"
#include "CNObjectList.h"

Go to the source code of this file.

Classes

struct  CNGraph
 Direct Acyclic Graph model. More...
 

Functions

struct CNGraphCNAllocateGraph (struct CNResource *resource)
 Allocate CNGraph. More...
 
static void CNRetainGraph (struct CNGraph *dst)
 Retrain the resource for the CNGraph. More...
 
static void CNReleaseGraph (struct CNGraph *dst)
 Release the resource for the CNGraph. More...
 
static struct CNResource * CNResourceOfGraph (struct CNGraph *src)
 Get resource of the graph. More...
 
void CNAppendNodeToGraph (struct CNGraph *dst, struct CNNode *src)
 Append node to the graph. More...
 
void CNAppendEdgeToGraph (struct CNGraph *dst, struct CNEdge *src)
 Append edge to the graph. More...
 
CNBoolean CNRemoveEdgeFromGraph (struct CNGraph *dst, struct CNEdge *src)
 Remove edge from the graph. More...
 
static size_t CNCountOfNodesInGraph (const struct CNGraph *src)
 Count of nodes in the list. More...
 
static struct CNListItemCNFirstNodeInGraph (const struct CNGraph *src)
 Get first node in the graph. More...
 
static struct CNListItemCNCentinelNodeInGraph (const struct CNGraph *src)
 Get centinel node in the graph. More...
 
static struct CNListItemCNFirstEdgeInGraph (const struct CNGraph *src)
 Get first edge in the graph. More...
 
static struct CNListItemCNCentinelEdgeInGraph (const struct CNGraph *src)
 Get centinel edge in the graph. More...
 
void CNPrintGraph (struct CNText *buf, const struct CNGraph *src)
 Print the context of graph. More...
 

Detailed Description

Define CNGraph class.

Copyright
Copyright (C) 2013 Steel Wheels Project

Function Documentation

struct CNGraph* CNAllocateGraph ( struct CNResource *  resource)

Allocate CNGraph.

Returns
Allocated graph object
Parameters
resourceResource to allocate the graph
static void CNRetainGraph ( struct CNGraph dst)
inlinestatic

Retrain the resource for the CNGraph.

Parameters
dstDestination graph

References CNRetainObject(), and CNGraph::superClass.

static void CNReleaseGraph ( struct CNGraph dst)
inlinestatic

Release the resource for the CNGraph.

Parameters
dstDestination graph

References CNReleaseObject(), and CNGraph::superClass.

static struct CNResource* CNResourceOfGraph ( struct CNGraph src)
static

Get resource of the graph.

Returns
Resource of the source graph
Parameters
srcSource graph

References CNResourceOfObject(), and CNGraph::superClass.

void CNAppendNodeToGraph ( struct CNGraph dst,
struct CNNode src 
)

Append node to the graph.

Parameters
dstDestination graph
srcSource node
Note
This function is called by CNAllocateNode() when it allocate the new node. So you don't have to call this explicitry.
void CNAppendEdgeToGraph ( struct CNGraph dst,
struct CNEdge src 
)

Append edge to the graph.

Parameters
dstDestination graph
srcSource edge
Note
This function is called by CNAllocateEdge() when it allocate the new edge. So you don't have to call this explicitry.
CNBoolean CNRemoveEdgeFromGraph ( struct CNGraph dst,
struct CNEdge src 
)

Remove edge from the graph.

Return values
CNTrueSuccess to remove the edge
CNFalseFailed to remove the edge
Parameters
dstDestination graph
srcEdge to be removed
static size_t CNCountOfNodesInGraph ( const struct CNGraph src)
inlinestatic

Count of nodes in the list.

Returns
Count of nodes
Parameters
srcSource graph

References CNGraph::allNodes, and CNCountOfObjectsInList().

static struct CNListItem* CNFirstNodeInGraph ( const struct CNGraph src)
static

Get first node in the graph.

Returns
First nodes in the graph
Parameters
srcSource graph

References CNGraph::allNodes, and CNFirstListObject().

static struct CNListItem* CNCentinelNodeInGraph ( const struct CNGraph src)
static

Get centinel node in the graph.

Returns
Centinel nodes in the graph
Parameters
srcSource graph

References CNGraph::allNodes, and CNCentinelListObject().

static struct CNListItem* CNFirstEdgeInGraph ( const struct CNGraph src)
static

Get first edge in the graph.

Returns
First edge in the graph
Parameters
srcSource graph

References CNGraph::allEdges, and CNFirstListObject().

static struct CNListItem* CNCentinelEdgeInGraph ( const struct CNGraph src)
static

Get centinel edge in the graph.

Returns
Centinel edge in the graph
Parameters
srcSource graph

References CNGraph::allEdges, and CNCentinelListObject().

void CNPrintGraph ( struct CNText buf,
const struct CNGraph src 
)

Print the context of graph.

Parameters
bufText buffer
srcSource graph