Daylight v4.9
Release Date: 1 February 2008

Name

dt_stream - allocate a stream object

Generic Prototype

dt_stream(dt_Handle, dt_Integer) => dt_Handle

C Prototype

#include "dt_smiles.h"

dt_Handle dt_stream(dt_Handle object, dt_Integer type)

FORTRAN Prototype

include 'dt_f_smiles.inc'

integer*4 dt_f_stream(object, type)

integer*4 object
integer*4 type

Description

Allocates a stream object which contains all of the parts of type 'type' within the object 'object'.

For a molecule, atom, bond, or cycle, valid types are TYP_ATOM, TYP_BOND, and TYP_CYCLE. If 'object' is a molecule, returns all appropriate objects of the type 'type'. If a molecule is not structurally modified between calls to dt_stream(3), dt_stream(3) is guaranteed to return equivalent streams for equivalent arguments.

If 'object' is a atom, TYP_ATOM returns a stream containing exactly one atom, TYP_BOND returns all bonds attached to the atom, TYP_CYCLE returns all cycles which pass through the atom.

If 'object' is a bond, TYP_ATOM returns the two atoms which are joined by the bond, TYP_BOND returns just one bond, and TYP_CYCLE returns all cycles which incorporate that bond.

If 'object' is a cycle, TYP_ATOM returns all atoms in the cycle, TYP_BOND returns all bonds in the cycle, and TYP_CYCLE returns one cycle.

If 'object' is a reaction, valid types are TYP_ATOM, TYP_BOND, TYP_CYCLE, and TYP_MOLECULE. For a reaction, returns all appropriate objects of the type 'type' across the entire reaction. If a reaction is not structurally modified between calls to dt_stream(3), dt_stream(3) is guaranteed to return equivalent streams for equivalent arguments.

If 'object' is a path or substructure, TYP_ATOM and TYP_BOND return streams of all of the atoms and bonds in the path or substructure, respectively. For a substructure, the order of atoms or bonds is arbitrary but consistent provided that the substructure is not modified. For a path, the ordering of atoms and bonds is determined by the order in which the atoms and bonds were added to the path.

If 'object' is a pathset, TYP_PATH returns the path object contained in the pathset. TYP_ATOM or TYP_BOND returns all the atoms or bonds contained in the pathset.

If 'object' is a THOR server, TYP_ANY and TYP_DATABASE returns all opened databases on the server. Returns an empty stream if no databases are opened.

If 'object' is a Merlin server, TYP_ANY and TYP_POOL returns all opened databases on the server. Returns an empty stream if no databases are opened.

TYP_DATATREE returns a stream of all datatrees in the database. This type of stream is unique in that the objects returned are created as needed. Unlike other types of streams, if a stream of TDT objects is reset, it will recreate the objects if they have been deallocated. This allows you to get an object from the stream, operate on it, and discard it before moving on to the next object. Without this behavior, it would be impossible to use streams over a database, as the size and number of objects is typically large. TYP_STRING returns a stream of string objects which contain the lexical representation of the TDTs in the database (indirect data are not expanded). Like datatree streams, these string object are created on demand; you must deallocate them as you go. Furthermore, if the stream is reset, different objects will be returned the next time through the stream. Each call to dt_next(3) will cause a new string object to be created. No other stream in the Daylight Toolkit behaves this way.

If 'object' is a THOR or Merlin database, TYP_DATATYPE returns all datatypes in the database.

If 'object' is a datatype, TYP_FIELDTYPE returns all fieldtypes in the datatype.

If 'object' is a dataitem, TYP_DATAFIELD returns the datafields in the dataitem.

If 'object' is a datatree, TYP_DATATREE returns all of the subtrees in the TDT. TYP_DATAITEM returns all of the dataitems attached directly to the TDT but not dataitems attached to subtrees. The first dataitem is always the root identifier itself. TYP_ANY returns both the dataitems and subtrees of the TDT.

Return Value

Returns a new stream object or the NULL_OB if an error is encountered.

Related Topics

dt_atend(3) dt_atstart(3) dt_count(3) dt_next(3) dt_toend(3)