Daylight v4.9
Release Date: 1 February 2008

Name

dt_thor_moveitem - move an object within a TDT

Generic Prototype

dt_thor_moveitem(dt_Handle, dt_Handle) => dt_Boolean

C Prototype

#include "dt_thor.h"

dt_Boolean dt_thor_moveitem(dt_Handle ob1, dt_Handle ob2)

FORTRAN Prototype

include 'dt_f_thor.inc'

logical dt_f_thor_moveitem(ob1, ob2)

integer*4 ob1
integer*4 ob2

Description

Moves the object 'ob1' from one place to another in a TDT. Moves 'ob1' to after the object 'ob2'. There is no way to move an object to before the first object in a TDT, as that would replace the TDT's identifier, nor is it possible to move the first object in a TDT (its root identifier). The objects 'ob1' and 'ob2' must have the same root TDT.

All streams over the root datatree and all of its constituents are deallocated and their handles are revoked as a result of this function.

There are four combinations of 'ob1' and 'ob2':

1. ob1 and ob2 are TYP_DATAITEM. This move is always legal; the dataitem 'ob1' is moved so that if follows 'ob2'. If the two dataitems are in different subtrees or the root tree to begin with, 'ob1' is reparented to be in the same subtree as 'ob2'.

2. ob1 and ob2 are TYP_DATATREE. This is legal if 'ob1' and 'ob2' are both subtrees. 'ob1' is moved after 'ob2'.

3. ob1 is TYP_DATATREE, ob2 is TYP_DATAITEM. If 'ob2' is a dataitem of the root tree, 'ob1' becomes the first subtree of the TDT. If 'ob2' is a dataitem in a subtree, 'ob1' is moved to after the subtree that 'ob1' is in.

4. ob1 is TYP_DATAITEM, ob2 is TYP_DATATREE. This combination is not legal.

Return Value

Returns TRUE if the operation was successful, FALSE otherwise. If the move is illegal, the TDT is unaffected. If the move is legal but fails, the TDT will probably be corrupt. This is extremely rare but is typically caused by corrupt TDT's being passed in.

Related Topics

dt_thor_alloc_dataitem(3) dt_thor_tdtget(3) dt_thor_tdtmerge(3) dt_thor_tdtrevise(3)