Routines for hierobj.kb


AddChild

File Name

hierobj.kb

Syntax

AddChild(Hier: HierarchyObject, parent_id: INTEGER, NewData: DataType)

Parameters

Hier -- the hierarchy to be manipulated

parent_id -- the parent of the new node. Must be

a valid node_id currently in Hier.

NewData -- the data to be stored at the new node

Returns

Returns the ID of the new node. If parent_id was

invalid, returns -1

Side Effects

None

Description

Adds a node in the hierarchy as the child of an existing node.

Dialog Forms Called

None


FlattenHierarchy

File Name

hierobj.kb

Syntax

FlattenHierarchy(Hier: HierarchyObject, filename: STRING)

Parameters

Hier -- the hierarchy to be manipulated

filename -- the file to which to write the hierarchy

Returns

None

Side Effects

None

Description

Streams an entire hierarchy into a file.

Dialog Forms Called

None


FlattenNode

File Name

hierobj.kb

Syntax

Flattennode(Hier: HierarchyObject, node_id: INTEGER, fhdl: FILE)

Parameters

Hier -- the hierarchy to be manipulated

node_id -- the node from which to get data

fhdl -- a file handle currently open in which to write

stream information

Returns

None

Side Effects

None

Description

Writes a node's information to an open file.

Dialog Forms Called

None


GetCurrent

File Name

hierobj.kb

Syntax

GetCurrent(Hier: HierarchyObject)

Parameters

Hier -- the hierarchy to be manipulated

Returns

Returns the node_id of the current element

Side Effects

None

Description

Gets the current pointer in the hierarchy structure. Run Time: O(1)

Dialog Forms Called

None


GetData

File Name

hierobj.kb

Syntax

GetData(Hier: HierarchyObject, node_id: INTEGER)

Parameters

Hier -- the hierarchy to be manipulated

node_id -- the node from which to get data

Returns

Returns the data stored at node_id. If the node

does not exist, the return is $Unknown

Side Effects

None

Description

Returns the data stored at the node_id.

Dialog Forms Called

None


GetFirstChild

File Name

hierobj.kb

Syntax

GetFirstChild(Hier: HierarchyObject, node_id: INTEGER)

Parameters

Hier -- the hierarchy to be manipulated

node_id -- the node from which to find the first child

Returns

Returns the child_id of node_id. If no child

exists, 0 is returned. If node_id is invalid.

-1 is returned.

Side Effects

None

Description

Gets the child of an existing node.

Dialog Forms Called

None


GetNextSibling

File Name

hierobj.kb

Syntax

GetNextSibling(Hier: HierarchyObject, node_id: INTEGER)

Parameters

Hier -- the hierarchy to be manipulated

node_id -- the node from which to find the sibling

Returns

Returns the sibling_id of node_id. If no sibling

exists, 0 is returned. If node_id is invalid.

-1 is returned

Side Effects

None

Description

Gets the first sibling of an existing node.

Dialog Forms Called

None


GetNumElements

File Name

hierobj.kb

Syntax

GetNumElements(Hier: HierarchyObject)

Parameters

Hier -- the hierarchy to be manipulated

Returns

Returns the number of elements currently in Hier

Side Effects

None

Description

Returns the number of elements currently in Hier

Dialog Forms Called

None


GetNumLevels

File Name

hierobj.kb

Syntax

GetNumLevels(Hier: HierarchyObject)

Parameters

Hier -- the hierarchy to be manipulated

Returns

Returns the number of levels currently in Hier

Side Effects

None

Description

Returns the number of levels currently in Hier.

Dialog Forms Called

None


GetParent

File Name

hierobj.kb

Syntax

GetParent(Hier: HierarchyObject, node_id: INTEGER)

Parameters

Hier -- the hierarchy to be manipulated

node_id -- the node ID of the parent

Returns

Returns the parent_id of node_id. If no parent

exists, 0 is returned. If node_id is invalid.

-1 is returned.

Side Effects

None

Description

Gets the parent of an existing node.

Dialog Forms Called

None


IsValidNode

File Name

hierobj.kb

Syntax

IsValidNode(Hier: HierarchyObject, node_id: INTEGER)

Parameters

Hier -- the hierarchy to be manipulated

node_id -- the node for which to check validity

Returns

TRUE if node_id is valid, FALSE otherwise

Side Effects

None

Description

Checks to see if the current node is valid.

Dialog Forms Called

None


MatchData

File Name

hierobj.kb

Syntax

MatchData(Hier: HierarchyObject, node_id: INTEGER, Data: DataType)

Parameters

Hier -- the hierarchy to be manipulated

node_id -- the node at which to check the data

Data -- the data to use as criteria for the match

Returns

Returns TRUE if a match, FALSE otherwise

Side Effects

None

Description

Compares two values and returns data that indicates if they match.

Dialog Forms Called

None


ReadFileForSource

File Name

hierobj.kb

Syntax

ReadHier(filename: STRING)

Parameters

filename -- the file from which to read the hierarchy

Returns

None

Side Effects

None

Description

Reads a file to determine what database was used when it was written.

Dialog Forms Called

None


ReadHier

File Name

hierobj.kb

Syntax

ReadHier(Hier: HierarchyObject, filename: STRING)

Parameters

Hier -- the Hierarchy to be manipulated

filename -- the file from which to read the hierarchy

Returns

None

Side Effects

None

Description

Reads a hierarchy in from a text file

Dialog Forms Called

None


ScanHierarchyForData

File Name

hierobj.kb

Syntax

ScanHierarchyForData(Hier: HierarchyObject, Data: DataType)

Parameters

Hier -- the hierarchy to be manipulated

Data -- the data to use as criteria for the scan

Returns

Returns the ID of the first matching node, -1 if not

found

Side Effects

None

Description

Returns the ID of the first matching node.

Dialog Forms Called

None


ScanNextLevelForData

File Name

hierobj.kb

Syntax

ScanNextLevelForData(Hier: HierarchyObject, parent_id: INTEGER, Data: DataType)

Parameters

Hier -- the hierarchy to be manipulated

parent_id -- the parent of the level to scan

Data -- the data to use as criteria for the scan

Returns

Returns the ID of the first matching node.

Side Effects

None

Description

Returns the ID of the first matching node.

Dialog Forms Called

None


SetCurrent

File Name

hierobj.kb

Syntax

SetCurrent(Hier: HierarchyObject, node_id: INTEGER)

Parameters

Hier -- the hierarchy to be manipulated

node_id -- the node ID for the sibling

Returns

Returns TRUE if node_id was valid, otherwise FALSE

Side Effects

None

Description

Sets the current pointer in the hierarchy structure to the node_ID. Run Time: O(1)

Dialog Forms Called

None


SetData

File Name

hierobj.kb

Syntax

SetData (REF Hier: HierarchyObject, VAL node_id: INTEGER, VAL NewData: DataType): BOOLEAN;

Parameters

Hier -- the hierarchy to be manipulated

node_id -- the node from which to get the data

NewData -- new data to place at node_id

Returns

Returns TRUE if the node_id is valid, FALSE

otherwise. This overwrites the current data

stored at node_id.

Side Effects

None

Description

Returns TRUE if the node_id is valid, FALSE otherwise. This will overwrite the current data stored at node_id Run Time: O(1)

Dialog Forms Called

None


SetSource

File Name

hierobj.kb

Syntax

SetSource(Hier: HierarchyObject, source: STRING)

Parameters

Hier -- the hierarchy to be manipulated

source -- the Tivoli source name to which currently

connected

Returns

None

Side Effects

None

Description

Sets the source attribute in the hierarchy.

Dialog Forms Called

None


StartSubTreeWalk

File Name

hierobj.kb

Syntax

StartSubTreeWalk (Hier: HierarchyObject, node_id: INTEGER)

Parameters

Hier -- the hierarchy to be manipulated

node_id -- node at which to start the traversal

Returns

Returns TRUE if node_id was valid, FALSE otherwise

Side Effects

None

Description

Prepares the hierarchy for a traversal of all nodes of a subtree in a breadth-first fashion.

Dialog Forms Called

None


TakeAStep

File Name

hierobj.kb

Syntax

TakeAStep(Hier: HierarchyObject)

Parameters

Hier -- the hierarchy to be manipulated

Returns

Returns the node that was just stepped into

Side Effects

None

Description

Moves the current pointer to the next node in the breadth-first traversal of the hierarchy. Run Time: O(n) where n = Number of children at the new node location

Dialog Forms Called

None