Toolkit Tutorial: Programming
dt_Handle
path1
,
pathX
,
container2
,
object
;
dt_Integer
uid
;
int
i
,
j
;
i
=
0
;
while
(
NULL_OB
!=
(
pathX
=
dt_next
(
container
)))
{
if
(
0
==
i
)
path1
=
pathX
;
i
++
;
j
=
0
;
container2
=
dt_stream
(
pathX
,
TYP_ANY
);
while
(
NULL_OB
!=
(
object
=
dt_next
(
container2
)))
{
j
++
;
str
=
dt_typename
(
&
slen
,
object
);
uid
=
dt_uid
(
object
);
printf
(
"Path %d object %d is type %.*s with uid %d\n"
,
i
,
j
,
slen
,
str
,
uid
+
1
);
}
}
dt_reset
(
container
);
pathX
=
dt_next
(
container
);
if
(
pathX
==
path1
)
printf
(
"Reset is like rewind.\n"
);
if
(
dt_base
(
pathX
)
==
molecule
)
printf
(
"You can access the molecule through the path.\n"
);
(
selected
output
)
Path
1
object
1
is
type
atom
with
uid
1
Path
1
object
2
is
type
bond
with
uid
1
Path
1
object
3
is
type
atom
with
uid
2
Path
2
object
1
is
type
atom
with
uid
6
Path
2
object
2
is
type
bond
with
uid
6
Path
2
object
3
is
type
atom
with
uid
5