Coconut Framework  beta
Classes | Typedefs | Functions
CNNode.h File Reference

Define CNNode class. More...

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

Go to the source code of this file.

Classes

struct  CNNode
 Node of the direct acyclic graph. More...
 
struct  CNNodeMethods
 Methods for CNNode. More...
 

Typedefs

typedef void(* CNPrintNodeFuncRef )(struct CNText *buf, const struct CNNode *src)
 

Functions

struct CNNodeCNAllocateNode (struct CNGraph *parent, size_t size, const struct CNNodeMethods *methods)
 Allocate CNNode. More...
 
static void CNRetainNode (struct CNNode *dst)
 Retrain the resource for the CNNode. More...
 
static void CNReleaseNode (struct CNNode *dst)
 Release the resource for the CNNode. More...
 
static struct CNResource * CNResourceOfNode (struct CNNode *src)
 Get resource of the CNNode. More...
 
static struct CNObjectCNObjectOfNode (struct CNNode *src)
 Get object of the node. More...
 
static void CNDestroyContextOfNode (struct CNNode *dst)
 Release the contex of the node. More...
 
static size_t CNCountOfProducerEdges (const struct CNNode *src)
 Get number of producers of the node. More...
 
static struct CNListItemCNFirstProducerEdgeInNode (const struct CNNode *src)
 Get first producer node of the source node. More...
 
static struct CNListItemCNCentinelProducerEdgeInNode (const struct CNNode *src)
 Get centinel producer node of the source node. More...
 
static size_t CNCountOfConsumerEdges (const struct CNNode *src)
 Get number of consumers of the node. More...
 
static struct CNListItemCNFirstConsumerEdgeInNode (const struct CNNode *src)
 Get first consumer node of the source node. More...
 
static struct CNListItemCNCentinelConsumerEdgeInNode (const struct CNNode *src)
 Get centinel consumer node of the source node. More...
 
static void CNPrintNode (struct CNText *buf, const struct CNNode *src)
 Print the context of node. More...
 
void CNLinkNode (struct CNEdge *edge, struct CNNode *producer, struct CNNode *consumer)
 Link 2 nodes. More...
 
CNBoolean CNUnlinkNode (struct CNGraph *graph, struct CNNode *producer, struct CNNode *consumer)
 Unlink 2 nodes. More...
 
CNBoolean CNIsolateNode (struct CNGraph *graph, struct CNNode *dst)
 Unlink all for the node. More...
 

Detailed Description

Define CNNode class.

Copyright
Copyright (C) 2013 Steel Wheels Project

Typedef Documentation

typedef void(* CNPrintNodeFuncRef)(struct CNText *buf, const struct CNNode *src)

Function to dump the context of CNNode

Function Documentation

struct CNNode* CNAllocateNode ( struct CNGraph parent,
size_t  size,
const struct CNNodeMethods methods 
)

Allocate CNNode.

Returns
Allocated node
Parameters
sizeSize of the object
parentOwner of the node
methodsMethod for CNNode
Note
The parent graph will be the owner of the allocated node. The node will be released when the parent graph is released.
static void CNRetainNode ( struct CNNode dst)
inlinestatic

Retrain the resource for the CNNode.

Parameters
dstDestination node

References CNRetainObject(), and CNNode::superClass.

static void CNReleaseNode ( struct CNNode dst)
inlinestatic

Release the resource for the CNNode.

Parameters
dstDestination node

References CNReleaseObject(), and CNNode::superClass.

static struct CNResource* CNResourceOfNode ( struct CNNode src)
static

Get resource of the CNNode.

Returns
Resource of the node
Parameters
srcSource node

References CNResourceOfObject(), and CNNode::superClass.

static struct CNObject* CNObjectOfNode ( struct CNNode src)
static

Get object of the node.

Returns
Object
Parameters
srcSource node

References CNNode::superClass.

static void CNDestroyContextOfNode ( struct CNNode dst)
inlinestatic

Release the contex of the node.

Parameters
dstDestination node
Note
You can call this in the dealloc function of the node class.

References CNDestroyObjectList(), CNNode::consumerEdges, and CNNode::producerEdges.

static size_t CNCountOfProducerEdges ( const struct CNNode src)
inlinestatic

Get number of producers of the node.

Returns
Number of producers
Parameters
srcSource node

References CNCountOfObjectsInList(), and CNNode::producerEdges.

static struct CNListItem* CNFirstProducerEdgeInNode ( const struct CNNode src)
static

Get first producer node of the source node.

Returns
First producer node
Parameters
srcSource node

References CNFirstListObject(), and CNNode::producerEdges.

static struct CNListItem* CNCentinelProducerEdgeInNode ( const struct CNNode src)
static

Get centinel producer node of the source node.

Returns
Centinel producer node
Parameters
srcSource node

References CNCentinelListObject(), and CNNode::producerEdges.

static size_t CNCountOfConsumerEdges ( const struct CNNode src)
inlinestatic

Get number of consumers of the node.

Returns
Number of consumers
Parameters
srcSource node

References CNCountOfObjectsInList(), and CNNode::consumerEdges.

static struct CNListItem* CNFirstConsumerEdgeInNode ( const struct CNNode src)
static

Get first consumer node of the source node.

Returns
First consumer node
Parameters
srcSource node

References CNFirstListObject(), and CNNode::consumerEdges.

static struct CNListItem* CNCentinelConsumerEdgeInNode ( const struct CNNode src)
static

Get centinel consumer node of the source node.

Returns
Centinel consumer node
Parameters
srcSource node

References CNCentinelListObject(), and CNNode::consumerEdges.

static void CNPrintNode ( struct CNText buf,
const struct CNNode src 
)
inlinestatic

Print the context of node.

Parameters
bufText buffer
srcSource node

References CNMethodsOfObject(), CNNodeMethods::printNode, and CNNode::superClass.

void CNLinkNode ( struct CNEdge edge,
struct CNNode producer,
struct CNNode consumer 
)

Link 2 nodes.

Parameters
edgeEdge to link the edge
producerProducer node
consumerConsumer node
CNBoolean CNUnlinkNode ( struct CNGraph graph,
struct CNNode producer,
struct CNNode consumer 
)

Unlink 2 nodes.

Return values
CNTrueSuccessed to unlink
CNFalseFailed to unlink
Parameters
graphParent graph for nodes
producerProducer node
consumerConsumer node
CNBoolean CNIsolateNode ( struct CNGraph graph,
struct CNNode dst 
)

Unlink all for the node.

Return values
CNTrueSuccessed to isolation
CNFalseFailed to isolation
Parameters
graphParent graph for the node
dstDestination node