Main Page | Modules | Namespace List | Class Hierarchy | Class List | Namespace Members | Class Members

MOL2File Class Reference
[Molecular structure file formats]

SYBYL MOL2 file class. More...

#include <MOL2File.h>

Inheritance diagram for MOL2File:

GenericMolFile LineBasedFile File List of all members.

Public Member Functions

Constructors and Destructors
 MOL2File () throw ()
 Default constructor.
 MOL2File (const String &filename, File::OpenMode open_mode=std::ios::in) throw (Exception::FileNotFound)
 Detailed constructor.
 MOL2File (const MOL2File &file) throw (Exception::FileNotFound)
 Copy constructor.
virtual ~MOL2File () throw ()
 Destructor.
Reading and Writing of Kernel Datastructures
virtual bool write (const System &system) throw (File::CannotWrite)
 Write a system to the MOL2 file.
virtual bool read (System &system) throw (Exception::ParseError)
 Read a system from the MOL2 file.
virtual Moleculeread () throw (Exception::ParseError)
 Read a molecule.
virtual bool write (const Molecule &molecule) throw (File::CannotWrite)
 Write a molecule.
const MOL2Fileoperator= (const MOL2File &file) throw ()

Static Public Attributes

Constants
const String TRIPOS
 Tripos Record Type Identifier (RTI).

Protected Member Functions

void readAtomSection_ ()
void readBondSection_ ()
void readMoleculeSection_ ()
void readSetSection_ ()
void readSubstructureSection_ ()
String getSybylType_ (const Atom &atom) const
bool nextLine_ ()
void clear_ ()
bool buildAll_ (System &system)

Protected Attributes

vector< AtomStruct > atoms_
vector< BondStruct > bonds_
vector< SetStruct > sets_
vector< SubstructureStruct > substructures_
MoleculeStruct molecule_
Size number_of_lines_
char buffer_ [4096]
String line_
 buffer for the line in use

Static Protected Attributes

const Size MAX_LENGTH_

Detailed Description

SYBYL MOL2 file class.

This class is used to read and write SYBYL MOL2 files (Tripos).


Member Function Documentation

virtual Molecule* MOL2File::read  )  throw (Exception::ParseError) [virtual]
 

Read a molecule.

This method will load the first (or the next, on subsequent invocation) molecule from the file. If the file format does not support multiple molecules, only the first call to read will be successful. This method will create an instance of molecule and its the user's responsibility to destroy that molecule.

Returns:
a pointer to a molecule, 0 if the file was not open, empty, or at its end
Exceptions:
Exception::ParseError if the contents of the file could not be parsed

Reimplemented from GenericMolFile.

virtual bool MOL2File::write const Molecule molecule  )  throw (File::CannotWrite) [virtual]
 

Write a molecule.

Repeated invocations of this method append molecules to the same file.

The default implementation does nothing.

Reimplemented from GenericMolFile.