Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

node.h File Reference

This file contains the declarations of the Node class tree and prototypes of C-style manipulation routines for nodes. More...


Compounds

class  AtomNode
 An AtomNode represents an atomic string. More...

class  ConjunctionNode
 A ConjunctionNode represents a conjunction between other nodes. More...

class  DisjunctionNode
 A DisjunctionNode represents a disjunction between other nodes. More...

class  FeatvalNode
 A FeatvalNode represents one feature (or attribute) in a feature structure, along with its value. More...

class  FunctionNode
 A FunctionNode represents the head of a function, which takes a number of feature structures as its arguments and returns a feature structure. More...

class  GenericNode
 The GenericNode is the root of the node class hierarchy. More...

struct  List
 A list of nodes. More...

class  ListNode
 A ListNode represents a list of feature structures. More...

struct  NodeIdMap
 NodeIdMap maps node IDs to pointers to nodes. More...

struct  NodeIdMapping
 NodeIdMapping is one mapping in a NodeIdMap. More...

class  ReentNode
 A ReentNode is a wrapper around a shared feature structure (or any shared object of another node type). More...

class  RefNode
 A RefNode represents a reference to another feature structure. More...

class  RelationNode
 A RelationNode represents a relation between a number of feature structures. More...

class  RestNode
 A RestNode represents all remaining elements in a set, that are not displayed. More...

class  SetNode
 A SetNode represents a set of feature structures. More...

class  StrucNode
 A StrucNode represents an entire feature structure. More...

class  TailNode
 A TailNode represents the tail of a list. More...

class  TreeNode
 A TreeNode represents one visible node in a structure tree. More...

class  TypeNode
 A TypeNode represents a type in afeature structure. More...


Defines

#define NODEFLAG_HIDDEN   0x00000001
 Node is hidden.

#define NODEFLAG_EXPANDED   0x00000002
 Node is expanded (applies to expandable nodes only).

#define NODEFLAG_DIFFERENT   0x00000004
 Node is to be marked as different (used in structure compare).

#define NODEFLAG_FOUND   0x00000008
 Node is to be marked as found (used in the "Find Node" function).

#define NODEFLAG_STRIKEOUT   0x00000010
 Node is struck out.

#define NODEFLAG_SHOWHIDDEN   0x00000020
 Always show node in gray if hidden (even if global "show hidden" is turned off).

#define NODEFLAG_MULTILINE   0x00000040
 Infix operators: draw each operand on a new line.

#define NODETYPE_GENERIC_NODE   1
 Type-ID of a GenericNode.

#define NODETYPE_TYPE_NODE   2
 Type-ID of a TypeNode.

#define NODETYPE_STRUC_NODE   3
 Type-ID of a StrucNode.

#define NODETYPE_FEATVAL_NODE   4
 Type-ID of a FeatvalNode.

#define NODETYPE_LIST_NODE   5
 Type-ID of a ListNode.

#define NODETYPE_SET_NODE   6
 Type-ID of a SetNode.

#define NODETYPE_FUNCTION_NODE   7
 Type-ID of a FunctionNode.

#define NODETYPE_REF_NODE   8
 Type-ID of a RefNode.

#define NODETYPE_REENT_NODE   9
 Type-ID of a ReentNode.

#define NODETYPE_TREE_NODE   10
 Type-ID of a TreeNode.

#define NODETYPE_ATOM_NODE   11
 Type-ID of a AtomNode.

#define NODETYPE_REL_NODE   12
 Type-ID of a RelationNode.

#define NODETYPE_TAIL_NODE   13
 Type-ID of a TailNode.

#define NODETYPE_REST_NODE   14
 Type-ID of a RestNode.

#define NODETYPE_DISJUNCTION_NODE   15
 Type-ID of a DisjunctionNode.

#define NODETYPE_CONJUNCTION_NODE   16
 Type-ID of a ConjunctionNode.

#define ID_LENGTH   10
 The maximum length of the string representation of a node ID.


Functions

TypeNodecreateType (unsigned int flags, int id, char *name)
 Creates a type node.

StrucNodecreateStruc (unsigned int flags, int id, TypeNode *type, List *featvals)
 Creates a StrucNode.

FunctionNodecreateFunction (unsigned int flags, int id, TypeNode *type, char *functor, List *structs)
 Creates a FunctionNode.

RelationNodecreateRelation (unsigned int flags, int id, char *functor, List *structs)
 Creates a RelationNode.

SetNodecreateSet (unsigned int flags, int id, List *structs, RestNode *rest)
 Creates a SetNode.

ListNodecreateList (unsigned int flags, int id, List *structs, TailNode *tail)
 Creates a ListNode.

FeatvalNodecreateFeatval (unsigned int flags, int id, char *feature, GenericNode *value)
 Creates a FeatvalNode.

RefNodecreateRef (unsigned int flags, int id, int ref)
 Creates a RefNode.

ReentNodecreateReent (unsigned int flags, int id, int ref, GenericNode *value)
 Creates a ReentNode.

TreeNodecreateTree (unsigned int flags, int id, char *label, char *arclabel, int linkid, List *subtrees)
 Creates a TreeNode.

AtomNodecreateAtom (unsigned int flags, int id, char *atom)
 Creates an AtomNode.

TailNodecreateTail (unsigned int flags, int id, GenericNode *tail)
 Creates a TailNode (which represents the tail in a list of type ListNode).

RestNodecreateRest (unsigned int flags, int id, GenericNode *rest)
 Creates a RestNode (which represents the rest in a set of type SetNode).

DisjunctionNodecreateDisjunction (unsigned int flags, int id, List *operands)
 Creates a DisjunctionNode.

ConjunctionNodecreateConjunction (unsigned int flags, int id, List *operands)
 Creates a ConjunctionNode.

void destroyNode (GenericNode *node)
 Deallocates all memory used by a node.

Listprepend (GenericNode *item, List *tail)
 Prepends a node to a list.

Listappend (List *l, GenericNode *item)
 Appends a node to a list.

void freeList (List *list)
 Frees a list.

void catList (List *list, int level)
 DEBUG: Print a list.

void writeGenericNode (FILE *file, GenericNode *node)
 Writes a node and all its child nodes to a file in the Grisu data exchange format.
(See EBNF documentation).


NodeIdMapaddToMap (NodeIdMap *map, GenericNode *node, int id)
 Adds a node to a node map.

GenericNodefindNodeById (NodeIdMap *map, char *id)
 Returns a node given its node ID.

void destroyMap (NodeIdMap *map)
 Destroys a node map, and deletes all nodes contained in the map.


Detailed Description

This file contains the declarations of the Node class tree and prototypes of C-style manipulation routines for nodes.

Author:
Holger Wunsch

Define Documentation

#define ID_LENGTH   10
 

The maximum length of the string representation of a node ID.

#define NODEFLAG_DIFFERENT   0x00000004
 

Node is to be marked as different (used in structure compare).

#define NODEFLAG_EXPANDED   0x00000002
 

Node is expanded (applies to expandable nodes only).

#define NODEFLAG_FOUND   0x00000008
 

Node is to be marked as found (used in the "Find Node" function).

#define NODEFLAG_HIDDEN   0x00000001
 

Node is hidden.

#define NODEFLAG_MULTILINE   0x00000040
 

Infix operators: draw each operand on a new line.

#define NODEFLAG_SHOWHIDDEN   0x00000020
 

Always show node in gray if hidden (even if global "show hidden" is turned off).

#define NODEFLAG_STRIKEOUT   0x00000010
 

Node is struck out.

#define NODETYPE_ATOM_NODE   11
 

Type-ID of a AtomNode.

#define NODETYPE_CONJUNCTION_NODE   16
 

Type-ID of a ConjunctionNode.

#define NODETYPE_DISJUNCTION_NODE   15
 

Type-ID of a DisjunctionNode.

#define NODETYPE_FEATVAL_NODE   4
 

Type-ID of a FeatvalNode.

#define NODETYPE_FUNCTION_NODE   7
 

Type-ID of a FunctionNode.

#define NODETYPE_GENERIC_NODE   1
 

Type-ID of a GenericNode.

#define NODETYPE_LIST_NODE   5
 

Type-ID of a ListNode.

#define NODETYPE_REENT_NODE   9
 

Type-ID of a ReentNode.

#define NODETYPE_REF_NODE   8
 

Type-ID of a RefNode.

#define NODETYPE_REL_NODE   12
 

Type-ID of a RelationNode.

#define NODETYPE_REST_NODE   14
 

Type-ID of a RestNode.

#define NODETYPE_SET_NODE   6
 

Type-ID of a SetNode.

#define NODETYPE_STRUC_NODE   3
 

Type-ID of a StrucNode.

#define NODETYPE_TAIL_NODE   13
 

Type-ID of a TailNode.

#define NODETYPE_TREE_NODE   10
 

Type-ID of a TreeNode.

#define NODETYPE_TYPE_NODE   2
 

Type-ID of a TypeNode.


Function Documentation

NodeIdMap* addToMap NodeIdMap map,
GenericNode node,
int  id
 

Adds a node to a node map.

Parameters:
map pointer to the node map or NULL if a new node is to be created
node the node
id the node's ID.
Returns:
pointer to the updated node map.

List* append List l,
GenericNode item
 

Appends a node to a list.

Parameters:
l the list or NULL if node is the first element.
item the node
Returns:
a pointer to the list

void catList List list,
int  level
 

DEBUG: Print a list.

AtomNode* createAtom unsigned int  flags,
int  id,
char *  atom
 

Creates an AtomNode.

Parameters:
flags the node flags.
id the node ID.
atom the value.
Returns:
the AtomNode.

ConjunctionNode* createConjunction unsigned int  flags,
int  id,
List operands
 

Creates a ConjunctionNode.

Parameters:
flags the node flags
id the node ID
operands the list of operands. This list must have at least two elements.
Returns:
the ConjunctionNode.

DisjunctionNode* createDisjunction unsigned int  flags,
int  id,
List operands
 

Creates a DisjunctionNode.

Parameters:
flags the node flags
id the node ID
operands the list of operands. This list must have at least two elements.
Returns:
the DisjunctionNode.

FeatvalNode* createFeatval unsigned int  flags,
int  id,
char *  feature,
GenericNode value
 

Creates a FeatvalNode.

Parameters:
flags the node flags.
id the node ID.
feature the feature's name
value the value
Returns:
the FeatvalNode

FunctionNode* createFunction unsigned int  flags,
int  id,
TypeNode type,
char *  functor,
List structs
 

Creates a FunctionNode.

Parameters:
flags the node flags.
id the node ID.
type the type node containing the return type of the function.
functor a string containing the name of the function
structs the arguments, a list with elements of type GenericNode.
Returns:
the FunctionNode.

ListNode* createList unsigned int  flags,
int  id,
List structs,
TailNode tail
 

Creates a ListNode.

Parameters:
flags the node flags.
id the node ID.
structs the items in the list (type GenericNode)
tail the tail
Returns:
the ListNode.

ReentNode* createReent unsigned int  flags,
int  id,
int  ref,
GenericNode value
 

Creates a ReentNode.

Parameters:
flags the node flags.
id the node ID.
ref the reference ID.
value the shared node.
Returns:
the ReentNode.

RefNode* createRef unsigned int  flags,
int  id,
int  ref
 

Creates a RefNode.

Parameters:
flags the node flags.
id the node ID.
ref the reference ID.
Returns:
the RefNode.

RelationNode* createRelation unsigned int  flags,
int  id,
char *  functor,
List structs
 

Creates a RelationNode.

Parameters:
flags the node flags.
id the node ID.
functor a string containing the name of the relation
structs the arguments, a list with elements of type GenericNode.
Returns:
the RelationNode.

RestNode* createRest unsigned int  flags,
int  id,
GenericNode rest
 

Creates a RestNode (which represents the rest in a set of type SetNode).

Parameters:
flags the node flags.
id the node ID.
rest the rest.
Returns:
the RestNode.

SetNode* createSet unsigned int  flags,
int  id,
List structs,
RestNode rest
 

Creates a SetNode.

Parameters:
flags the node flags.
id the node ID.
structs the elements in the set (type GenericNode)
rest the rest
Returns:
the SetNode.

StrucNode* createStruc unsigned int  flags,
int  id,
TypeNode type,
List featvals
 

Creates a StrucNode.

Parameters:
flags the node flags
id the node ID
type the type node containing the type of the feature structure.
featvals a list with instances of FeatvalNode that contains the features and their values.
Returns:
the StrucNode.

TailNode* createTail unsigned int  flags,
int  id,
GenericNode tail
 

Creates a TailNode (which represents the tail in a list of type ListNode).

Parameters:
flags the node flags.
id the node ID.
tail the tail.
Returns:
the TailNode.

TreeNode* createTree unsigned int  flags,
int  id,
char *  label,
char *  arclabel,
int  linkid,
List subtrees
 

Creates a TreeNode.

Parameters:
flags the node flags.
id the node ID.
label the node label.
arclabel the label on the arc that leads into this node, or NULL if there should be no label.
linkid the node ID of the node to displayed when the tree node is expanded by the user.
subtrees the list of child nodes of type TreeNode.
Returns:
the TreeNode.

TypeNode* createType unsigned int  flags,
int  id,
char *  name
 

Creates a type node.

Parameters:
flags the node flags
id the node ID
name the type name.
Returns:
the new TypeNode.

void destroyMap NodeIdMap map  ) 
 

Destroys a node map, and deletes all nodes contained in the map.

Parameters:
map the node map.

void destroyNode GenericNode node  ) 
 

Deallocates all memory used by a node.

Note that this function does not recursively delete any child nodes! Memory is freed instead by destroying all nodes in a NodeIdMap.

Parameters:
node the node to be destroyed.

GenericNode* findNodeById NodeIdMap map,
char *  id
 

Returns a node given its node ID.

Parameters:
map the node map
id the node ID
Returns:
a pointer to the node, or NULL if there is no node with id in map.

void freeList List list  ) 
 

Frees a list.

The nodes in the list are not freed (nodes are freed by deleting all nodes in a NodeIdMap.

Parameters:
list the list

List* prepend GenericNode item,
List tail
 

Prepends a node to a list.

Parameters:
item the node
tail the list, or NULL if node is the first element.
Returns:
a pointer to the list with node as its first element.

void writeGenericNode FILE *  file,
GenericNode node
 

Writes a node and all its child nodes to a file in the Grisu data exchange format.
(See EBNF documentation).


Generated on Sun Apr 27 18:26:57 2003 for Grisu by doxygen1.3