PDBData Class Reference

#include <PDBData.h>

Inheritance diagram for PDBData:

PDBAtom PDBUnknown PDBAtomRecord PDBHetatm List of all members.

Public Types

 HEADER
 OBSLTE
 COMPND
 SOURCE
 EXPDTA
 AUTHOR
 REVDAT
 SPRSDE
 JRNL
 REMARK
 SEQRES
 FTNOTE
 HET
 FORMUL
 HELIX
 SHEET
 TURN
 SSBOND
 SITE
 CRYST1
 ORIGX
 SCALE
 MTRIX
 TVECT
 MODEL
 ATOM
 HETATM
 SIGATM
 ANISOU
 SIGUIJ
 TER
 ENDMDL
 CONECT
 MASTER
 END
 UNKNOWN
 COLUMNS
 FIELDS
enum  PDBType {
  HEADER, OBSLTE, COMPND, SOURCE,
  EXPDTA, AUTHOR, REVDAT, SPRSDE,
  JRNL, REMARK, SEQRES, FTNOTE,
  HET, FORMUL, HELIX, SHEET,
  TURN, SSBOND, SITE, CRYST1,
  ORIGX, SCALE, MTRIX, TVECT,
  MODEL, ATOM, HETATM, SIGATM,
  ANISOU, SIGUIJ, TER, ENDMDL,
  CONECT, MASTER, END, UNKNOWN
}
enum  PDBFormatStyle { COLUMNS, FIELDS }

Public Member Functions

 PDBData (PDBType newtype)
virtual ~PDBData (void)
PDBType type (void)
virtual void sprint (char *s, PDBFormatStyle usestyle=COLUMNS)

Static Public Attributes

static const char * PDBNames [UNKNOWN+1]

Static Protected Member Functions

static void scan (const char *data, int len, int start, int size, int *ans, int defalt)
static void scan (const char *data, int len, int start, int size, BigReal *ans, BigReal defalt)
static void scan (const char *data, int len, int start, int size, char *ans)
static void field (const char *data, int fld, char *result)
static void sprintcol (char *s, int start, int len, const char *val)
static void sprintcol (char *s, int start, int len, int val)
 *** provide a simple way to print to a specific column
static void sprintcol (char *s, int start, int len, int prec, BigReal val)

Detailed Description

Copyright (c) 1995, 1996, 1997, 1998, 1999, 2000 by The Board of Trustees of the University of Illinois. All rights reserved.

Definition at line 33 of file PDBData.h.


Member Enumeration Documentation

enum PDBData::PDBFormatStyle

Enumerator:
COLUMNS 
FIELDS 

Definition at line 48 of file PDBData.h.

00048 { COLUMNS, FIELDS };  // used to specify if the

enum PDBData::PDBType

Enumerator:
HEADER 
OBSLTE 
COMPND 
SOURCE 
EXPDTA 
AUTHOR 
REVDAT 
SPRSDE 
JRNL 
REMARK 
SEQRES 
FTNOTE 
HET 
FORMUL 
HELIX 
SHEET 
TURN 
SSBOND 
SITE 
CRYST1 
ORIGX 
SCALE 
MTRIX 
TVECT 
MODEL 
ATOM 
HETATM 
SIGATM 
ANISOU 
SIGUIJ 
TER 
ENDMDL 
CONECT 
MASTER 
END 
UNKNOWN 

Definition at line 42 of file PDBData.h.


Constructor & Destructor Documentation

PDBData::PDBData ( PDBType  newtype  )  [inline]

Definition at line 90 of file PDBData.h.

00090                               {
00091        mytype = newtype;
00092      }

virtual PDBData::~PDBData ( void   )  [inline, virtual]

Definition at line 93 of file PDBData.h.

00093                              {
00094      }


Member Function Documentation

void PDBData::field ( const char *  data,
int  fld,
char *  result 
) [static, protected]

Definition at line 133 of file PDBData.C.

References FALSE, and TRUE.

Referenced by PDBAtom::parse().

00134 {
00135   int i;
00136 
00137   Bool onword = FALSE;
00138   if (fld<=0)  {     // ask a stupid question, get a stupid answer
00139     result[0]='#';
00140     result[1]=0;
00141     return;
00142   }
00143   for (i=0; data[i]; i++)
00144     if (!onword && data[i] != ' ' && data[i] != '\t')  {  // if I found a field
00145        onword = TRUE;     // mark that I'm on it
00146        if (--fld <= 0)    // am I done?
00147          break;
00148     } else {
00149       if (onword && (data[i] == ' ' || data[i] == '\t')) { // left a field
00150         onword = FALSE;   // mark that I left
00151       }
00152     }
00153   if (fld>0) {  // oh no, didn't find the field!
00154      result[0] = '#';
00155      result[1] = 0;
00156      return;
00157   }
00158   
00159   int cpy=0;  // copy the field to the output
00160   while (data[i] != ' ' && data[i] != '\t' && data[i])
00161      result[cpy++] = data[i++];
00162   result[cpy] = 0;  // terminate and I'm done
00163 }

void PDBData::scan ( const char *  data,
int  len,
int  start,
int  size,
char *  ans 
) [static, protected]

Definition at line 81 of file PDBData.C.

References j.

00082 {
00083   if (length < start) {             // check if the string is long enough
00084    ans[0] = 0;
00085    return;
00086   }
00087   strncpy(ans, data + start - 1, size);
00088   ans[size]=0;
00089                       //  fix up leading and trailing spaces
00090   int i,j;
00091   for (i=0,j=0; ans[i]; i++)  //   all this does is strip out _all_ the
00092     if (ans[i]!=' ' && ans[i]!='\t')   //   spaces -- this is important because I
00093       ans[j++]=ans[i];  // check that a string is empty by looking to see if 
00094   ans[j]=0;   // [0] == 0 instead of checking to see if all the elements are spaces
00095 }

void PDBData::scan ( const char *  data,
int  len,
int  start,
int  size,
BigReal ans,
BigReal  defalt 
) [static, protected]

Definition at line 97 of file PDBData.C.

00099 {
00100   char tempbuffer[200];
00101   if (length < start) {               // check if the string is long enough
00102    *ans = defalt;                     // return the default
00103    return;
00104   }
00105   if (size>199)                       // make sure I won't overflow my array
00106     size=199;
00107   strncpy(tempbuffer, data + start - 1, size);// convert the string to a BigReal
00108   tempbuffer[size]= 0;
00109   int flg=0;
00110   for (int i=strlen(tempbuffer)-1; i>=0; i--) { // see if this is a blank string
00111     if (tempbuffer[i]>' ') {
00112        flg = 1;
00113        break;
00114     }
00115   }
00116   if (flg != 1) {  // then it was a blank string
00117     *ans = defalt;
00118   } else {
00119     *ans = atof(tempbuffer);  // WARNING : ASSUMES BigReal <= double!!!
00120   }
00121 }

void PDBData::scan ( const char *  data,
int  len,
int  start,
int  size,
int *  ans,
int  defalt 
) [static, protected]

Definition at line 53 of file PDBData.C.

00055 {
00056   char tempbuffer[200];       // temp. string buffer
00057   if (length < start) {       // check if the string is long enough
00058     *ans = defalt;                   // return the default
00059     return;
00060   }
00061   if (size>199)                      // make sure I won't overflow my array
00062     size=199;
00063   strncpy(tempbuffer, data + start-1, size);  // convert the string to an int
00064   tempbuffer[size]= 0;
00065   int flg=0;
00066   for (int i=strlen(tempbuffer)-1; i>=0; i--) { // see if this is a blank string
00067     if (tempbuffer[i]>' ') {
00068        flg = 1;
00069        break;
00070     }
00071   }
00072   if (flg != 1) {  // then it was a blank string
00073     *ans = defalt;
00074   } else {
00075   *ans = atoi(tempbuffer);
00076   }
00077 }

virtual void PDBData::sprint ( char *  s,
PDBFormatStyle  usestyle = COLUMNS 
) [inline, virtual]

Definition at line 99 of file PDBData.h.

References COLUMNS.

00099                                                                       {
00100        if (usestyle == COLUMNS)     // get rid of warning
00101          strcpy(s, "REMARK     (undefined remark - this is a bug)");
00102         else
00103          strcpy(s, "REMARK     (undefined remark - this is a bug)");
00104      }

void PDBData::sprintcol ( char *  s,
int  start,
int  len,
int  prec,
BigReal  val 
) [static, protected]

Definition at line 176 of file PDBData.C.

References sprintcol().

00177 {
00178  char temps[100];
00179  sprintf(temps, "%*.*f", len, prec, val);
00180  sprintcol( s, start, len, temps); // copy to the output string
00181 }

void PDBData::sprintcol ( char *  s,
int  start,
int  len,
int  val 
) [static, protected]

*** provide a simple way to print to a specific column

Definition at line 169 of file PDBData.C.

References sprintcol().

00170 {
00171  char temps[100];
00172  sprintf(temps, "%*d", len, val);  // convert the int to a string
00173  sprintcol( s, start, len, temps); // copy to the output string
00174 }

void PDBData::sprintcol ( char *  s,
int  start,
int  len,
const char *  val 
) [static, protected]

Definition at line 183 of file PDBData.C.

Referenced by sprintcol().

00184 {
00185  s+=start-1;
00186  while (len-- >0 && *val)  // copy string up to end of string or len
00187   *s++ = *val++;
00188 }

PDBType PDBData::type ( void   )  [inline]

Definition at line 95 of file PDBData.h.

00095                          {
00096        return mytype;
00097      }


Member Data Documentation

const char * PDBData::PDBNames [static]

Initial value:

 {
       "HEADER", "OBSLTE", "COMPND",
       "SOURCE", "EXPDTA", "AUTHOR", "REVDAT", "SPRSDE", "JRNL",
       "REMARK", "SEQRES", "FTNOTE", "HET", "FORMUL", "HELIX",
       "SHEET", "TURN", "SSBOND", "SITE", "CRYST1", "ORIGX",
       "SCALE", "MTRIX", "TVECT", "MODEL", "ATOM", "HETATM",
       "SIGATM", "ANISOU", "SIGUIJ", "TER", "ENDMDL", "CONECT",
       "MASTER", "END", "UNKNOWN"}

Definition at line 52 of file PDBData.h.

Referenced by new_PDBData().


The documentation for this class was generated from the following files:
Generated on Tue Nov 21 01:17:20 2017 for NAMD by  doxygen 1.4.7