Main Page | Class List | Directories | File List | Class Members | File Members

bincoord.h File Reference

Binary coordinate reader and writer. More...

#include "adt/array.h"
#include "mdio/file.h"
#include "mdapi/mdtypes.h"

Go to the source code of this file.

Classes

struct  mdio_Bincoord_t
 Binary coordinate reader and writer class. More...

Typedefs

typedef mdio_Bincoord_t mdio_Bincoord
 Binary coordinate reader and writer class.

Functions

mdio_Bincoordmdio_createBincoord (void)
 Constructor.
void mdio_destroyBincoord (mdio_Bincoord *)
 Destructor.
int mdio_readBincoord (mdio_Bincoord *, const char *name, int n_expect)
 Read binary coordinate file.
MD_Dvec * mdio_getBincoord (mdio_Bincoord *, int *nelems)
 Obtain array of coordinates.
int mdio_setBincoord (mdio_Bincoord *, MD_Dvec *dvec, int nelems)
 Set an array of coordinates.
int mdio_writeBincoord (mdio_Bincoord *, const char *name)
 Write binary coordinate file.
int mdio_initializeBincoord (mdio_Bincoord *)
 Alternative constructor.
void mdio_cleanupBincoord (mdio_Bincoord *)
 Alternative destructor.


Detailed Description

Binary coordinate reader and writer.

Author:
David J. Hardy
Date:
2003-2005
The mdio_Bincoord class reads and writes NAMD-style binary coordinate files. Reads are stored into an array of MD_Dvec coordinates which is then obtained from the mdio_Bincoord object. The mdio_Bincoord object can also be provided with a user-defined array of MD_Dvec coordinates for writing.

The mdio_Bincoord class is derived from mdio_File so that error handling is performed by typecasting (mdio_Bincoord *) to (mdio_File *).


Typedef Documentation

typedef struct mdio_Bincoord_t mdio_Bincoord
 

Binary coordinate reader and writer class.

Members should be treated as private.


Function Documentation

void mdio_cleanupBincoord mdio_Bincoord  ) 
 

Alternative destructor.

Use to destroy a preallocated mdio_Bincoord object (i.e. one constructed using mdio_initializeBincoord() ).

mdio_Bincoord* mdio_createBincoord void   ) 
 

Constructor.

Creates dynamically allocated binary coordinate file reader and writer object.

Returns:
Pointer to new object or NULL on failure.

void mdio_destroyBincoord mdio_Bincoord  ) 
 

Destructor.

Frees dynamically allocated binary coordinate file reader and writer object after freeing an allocated array of MD_Dvec.

Note that an MD_Dvec array obtained from reading a file does not persist beyond the destruction of the mdio_Bincoord object.

MD_Dvec* mdio_getBincoord mdio_Bincoord ,
int *  nelems
 

Obtain array of coordinates.

Parameters:
[out] nelems Length of array returned into indicated variable.
If this array resulted from mdio_readBincoord(), then it will persist only until destruction of the mdio_Bincoord object.

Returns:
The MD_Dvec coordinate array as a pointer.

int mdio_initializeBincoord mdio_Bincoord  ) 
 

Alternative constructor.

Use to construct a preallocated mdio_Bincoord object. See mdio_createBincoord() for a description of expected arguments.

int mdio_readBincoord mdio_Bincoord ,
const char *  name,
int  n_expect
 

Read binary coordinate file.

Parameters:
[in] name A nil-terminated string naming the binary coordinate file.
[in] n_expect The number of coordinates expected in the file.
If the number of coordinates is unknown, then n_expect should be set to 0. Otherwise, this value is used to validate the expected number of coordinates.

Returns:
0 on success, MDIO_ERROR on failure. It is considered an error for n_expect to not match the number of coordinates contained in the file.

int mdio_setBincoord mdio_Bincoord ,
MD_Dvec *  dvec,
int  nelems
 

Set an array of coordinates.

Parameters:
[in] dvec Array of coordinates.
[in] nelems Number of elements in array.
The dvec array will still belong to the user, which means that no attempt will be made to free it, and the burden of any dynamic memory management still belongs to the user.

Returns:
0 on success, MDIO_ERROR on failure.

int mdio_writeBincoord mdio_Bincoord ,
const char *  name
 

Write binary coordinate file.

Parameters:
[in] name A nil-terminated string naming the binary coordinate file.
The coordinates written will be whatever is known by the mdio_Bincoord object, either from a previous call to mdio_setBincoord() or a previous read using mdio_readBincoord().

Returns:
0 on success, MDIO_ERROR on failure.


Generated on Mon Sep 26 10:55:19 2005 for MDX by  doxygen 1.4.4