Public Member Functions | Protected Member Functions | Protected Attributes | Friends

mmdb::mmcif::Data Class Reference

mmcif::Data represents mmCIF's "data" category, which keeps structures and loops and is mandatory element of mmCIF file. More...

#include <mmdb_mmcif_.h>

Inheritance diagram for mmdb::mmcif::Data:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 Data ()
 Basic constructor.
 Data (cpstr N)
 Constructor that assigns data block name.
 Data (io::RPStream Object)
 Constructor for MMDB data streaming functions.
 ~Data ()
 Destructor.
void SetPrintWarnings (bool SPW)
 Sets flag to print warnings on reading mmCIF files.
void SetStopOnWarning (bool SOW)
 Sets flag to stop on warning when reading an mmCIF file.
void SetFlag (CIF_FLAG F)
 Sets optional flag(s) for reading mmCIF files. By default, no flags are set.
void RemoveFlag (CIF_FLAG F)
 Removes optional flag(s) for reading mmCIF files. By default, no flags are set.
int GetWarnings ()
 Returns bit-encoded warnings issued at last file read.
void SetWrongFields (cpstr *cats, cpstr *tags)
 Sets category names and tags that are to be ignored on file read.
int ReadMMCIFData (cpstr FName, io::GZ_MODE gzipMode=io::GZM_CHECK)
 Reads mmCIF data block from file.
int ReadMMCIFData (io::RFile f, pstr S, int &lcount)
 Reads sequential mmCIF data blocks from file.
bool WriteMMCIFData (cpstr FName, io::GZ_MODE gzipMode=io::GZM_CHECK)
 Writes mmCIF data block into file.
void WriteMMCIF (io::RFile f)
 Writes (next) mmCIF data block into file.
int GetNumberOfCategories ()
 Returns the number of categories (structures and loops) in data block.
PCategory GetCategory (int categoryNo)
 Retrieves pointer to category (a structure or a loop) by category number.
PStruct GetStructure (cpstr CName)
 Retrieves mmCIF structure with given name.
PLoop GetLoop (cpstr CName)
 Retrieves mmCIF loop with given name.
PLoop FindLoop (cpstr *tagList)
 Finds loop containing all tags from the tag list provided.
void GetDataName (pstr &dname, bool Remove=false)
 Retrieves data block name into dynamically-allocated string.
pstr GetDataName ()
 Returns data block name.
int CheckData (cpstr CName, cpstr TName)
int DeleteCategory (cpstr CName)
int DeleteStructure (cpstr CName)
int DeleteLoop (cpstr CName)
void Optimize ()
int GetString (pstr &Dest, cpstr CName, cpstr TName, bool Remove=false)
pstr GetString (cpstr CName, cpstr TName, int &RC)
int DeleteField (cpstr CName, cpstr TName)
int GetReal (realtype &R, cpstr CName, cpstr TName, bool Remove=false)
int GetInteger (int &I, cpstr CName, cpstr TName, bool Remove=false)
int GetLoopLength (cpstr CName)
int GetLoopString (pstr &Dest, cpstr CName, cpstr TName, int nrow, bool Remove=false)
pstr GetLoopString (cpstr CName, cpstr TName, int nrow, int &RC)
int DeleteLoopField (cpstr CName, cpstr TName, int nrow)
int GetLoopReal (realtype &R, cpstr CName, cpstr TName, int nrow, bool Remove=false)
int GetLoopInteger (int &I, cpstr CName, cpstr TName, int nrow, bool Remove=false)
int GetLoopSVector (psvector &S, cpstr CName, cpstr TName, int i1=0, int i2=MaxInt4, bool Remove=false)
int GetLoopRVector (rvector &R, cpstr CName, cpstr TName, int i1=0, int i2=MaxInt4, bool Remove=false)
int GetLoopIVector (ivector &I, cpstr CName, cpstr TName, int i1=0, int i2=MaxInt4, bool Remove=false)
void FreeMemory (int key)
void PutDataName (cpstr dname)
int PutNoData (int NoDataType, cpstr CName, cpstr TName)
int PutString (cpstr S, cpstr CName, cpstr TName, bool Concatenate=false)
int PutDate (cpstr CName, cpstr TName)
int PutReal (realtype R, cpstr CName, cpstr TName, int prec=8)
int PutInteger (int I, cpstr CName, cpstr TName)
int AddLoop (cpstr CName, PLoop &cifLoop)
int AddStructure (cpstr CName, PStruct &cifStruct)
int PutLoopNoData (int NoDataType, cpstr CName, cpstr TName, int nrow)
int PutLoopString (cpstr S, cpstr CName, cpstr TName, int nrow)
int PutLoopReal (realtype R, cpstr CName, cpstr TName, int nrow, int prec=8)
int PutLoopInteger (int I, cpstr CName, cpstr TName, int nrow)
int PutLoopSVector (psvector S, cpstr CName, cpstr TName, int i1, int i2)
int PutLoopRVector (rvector R, cpstr CName, cpstr TName, int i1, int i2, int prec=8)
int PutLoopIVector (ivector I, cpstr CName, cpstr TName, int i1, int i2)
int RenameCategory (cpstr CName, cpstr newCName)
void Copy (PData Data)
int CopyCategory (PData Data, cpstr CName, cpstr newCName=NULL)
void PrintCategories ()
void write (io::RFile f)
void read (io::RFile f)

Protected Member Functions

void InitData ()
void FreeWrongFields ()
bool CheckWrongField (cpstr C, cpstr T)
void Sort ()
int GetCategoryNo (cpstr cname)
int AddCategory (cpstr cname)
int DeleteCategory (int CatNo)
void GetDataItem (io::RFile f, pstr S, pstr &L, pstr &p, int &lcount, int &llen)
void GetLoop (io::RFile f, pstr S, pstr &L, pstr &p, int &lcount, int &llen)
int GetField (io::RFile f, pstr S, pstr &L, pstr &p, int &lcount, int &llen)

Protected Attributes

pstr name
int nCategories
PPCategory Category
ivector index
int flags
int Warning
int loopNo
int tagNo
psvector WrongCat
psvector WrongTag
int nWrongFields

Friends

class File

Detailed Description

mmcif::Data represents mmCIF's "data" category, which keeps structures and loops and is mandatory element of mmCIF file.

mmCIF's "data" category has the following form:

    data_DataName

    _structure1.tag1  value1
    ..........

    loop_
    ..........

In the above example, all structures and loops that follow data_ keyword until next data_ or end of file are part of data category with name DataName.

mmcif::Data represents this construct by keeping a list of mmcif::Struct and mmcif::Loop class instances associated with the corresponding categories in the data block.

The data object is created automatically when an mmCIF file is read, or it may be created programatically and then pushed into file.

Access to data is provided via category (structures and loops) names, tags and data indexes (in case of loops). Alternatively, pointers to contained structures and loops may be obtained first, an used for fetching data using mmcif::Struct's and mmcif::Loop's interface functions.

The following code gives an example of creating mmCIF's data category and populating it:

    mmcif::Data data;

      // Specify data name:
      data.PutDataName ( "Sample_Data" );

      // the following statement:
      data.PutInteger ( 12345,"_category1","id" );
      // creates structure "_category1" with tag "id" and assigns it
      // the integer value of 12345.

      data.PutString ( "a name","_category1","name" );

      // Loops may be created quite similarly:
      data.PutLoopInteger ( 12345   ,"_loop1","id"  ,2 );
      data.PutLoopInteger ( "a name","_loop1","name",0 );

      // push data into a file
      data.WriteMMCIFData ( "sample.cif" );

The resulting file sample.cif will contain:

    data_Sample_Data

    _category1.id   12345
    _category1.name "a name"

    loop_
    _loop1.id
    _loop1.name
    .      "a name"
    .      .
    12345  .

The same result may be achieved differently:

    mmcif::Data    data;
    mmcif::PStruct mmCIFStruct;  // equivalent to mmcif::Struct *mmCIFStruct
    mmcif::PLoop   mmCIFLoop;    // equivalent to mmcif::Loop   *mmCIFLoop

      // Specify data name:
      data.PutDataName ( "Sample_Data" );

      // create new mmCIF's structure in the data block:
      data.AddStructure ( "_category1",mmCIFStruct );
      if (mmCIFStruct)  {
        mmCIFStruct->PutInteger ( 12345   ,"id"   );
        mmCIFStruct->PutString  ( "a name","name" );
      }

      // similarly for the loop:
      data.AddLoop ( "_loop1",mmCIFLoop );
      if (mmCIFLoop)  {
        mmCIFLoop->PutInteger ( 12345   ,"id"  ,2 );
        mmCIFLoop->PutString  ( "a name","name",0 );
      }

      // push data into a file
      data.WriteMMCIFData ( "sample.cif" );

See general principles of working with mmCIF files and mmCIF hierarchies, as well as some code samples, in Section "mmcif_handler".


Constructor & Destructor Documentation

mmdb::mmcif::Data::Data (  )

Basic constructor.

mmdb::mmcif::Data::Data ( cpstr  N )

Constructor that assigns data block name.

Parameters:
[in]Ndata block name.
mmdb::mmcif::Data::Data ( io::RPStream  Object )

Constructor for MMDB data streaming functions.

mmdb::mmcif::Data::~Data (  )

Destructor.


Member Function Documentation

int mmdb::mmcif::Data::AddCategory ( cpstr  cname ) [protected]
int mmdb::mmcif::Data::AddLoop ( cpstr  CName,
PLoop &  cifLoop 
)
int mmdb::mmcif::Data::AddStructure ( cpstr  CName,
PStruct &  cifStruct 
)
int mmdb::mmcif::Data::CheckData ( cpstr  CName,
cpstr  TName 
)
bool mmdb::mmcif::Data::CheckWrongField ( cpstr  C,
cpstr  T 
) [protected]
void mmdb::mmcif::Data::Copy ( PData  Data )
int mmdb::mmcif::Data::CopyCategory ( PData  Data,
cpstr  CName,
cpstr  newCName = NULL 
)
int mmdb::mmcif::Data::DeleteCategory ( int  CatNo ) [protected]
int mmdb::mmcif::Data::DeleteCategory ( cpstr  CName )
int mmdb::mmcif::Data::DeleteField ( cpstr  CName,
cpstr  TName 
)
int mmdb::mmcif::Data::DeleteLoop ( cpstr  CName )
int mmdb::mmcif::Data::DeleteLoopField ( cpstr  CName,
cpstr  TName,
int  nrow 
)
int mmdb::mmcif::Data::DeleteStructure ( cpstr  CName )
PLoop mmdb::mmcif::Data::FindLoop ( cpstr *  tagList )

Finds loop containing all tags from the tag list provided.

Parameters:
tagListlist of tags to be looked for. The list should be terminated by empty string "". The order of tags is not significant.
Returns:
pointer to loop if loop with given tags was found, and NULL otherwise.

The function will look for first loop that includes all tags from the list. The list does not have to include all tags for that loop in order for function to succeed. This function is useful for reading "dirty cifs" that may contain loops without a name.

void mmdb::mmcif::Data::FreeMemory ( int  key )
void mmdb::mmcif::Data::FreeWrongFields (  ) [protected]
PCategory mmdb::mmcif::Data::GetCategory ( int  categoryNo )

Retrieves pointer to category (a structure or a loop) by category number.

Parameters:
categoryNocategory number to retrieve. Categories are numbered from 0 to GetNumberOfCategories()-1.
Returns:
pointer to category, if categoryNo is in the right range, or NULL otherwise.
Note:
The category type (structure or loop) is returned by function mmcif::Category::GetCategoryID().
The application should never attempt to deallocate the category returned. It will be properly disposed of by mmcif::Data's destructor.
int mmdb::mmcif::Data::GetCategoryNo ( cpstr  cname ) [protected]
void mmdb::mmcif::Data::GetDataItem ( io::RFile  f,
pstr  S,
pstr &  L,
pstr &  p,
int &  lcount,
int &  llen 
) [protected]
void mmdb::mmcif::Data::GetDataName ( pstr &  dname,
bool  Remove = false 
)

Retrieves data block name into dynamically-allocated string.

Parameters:
dnamepointer reference to a string that accepts data block name. If dname is not NULL, it is treated as a pre-allocated string, which is disposed before copying. The application is responsible for deallocating dname.
Removeflag to remove name from the data block.
pstr mmdb::mmcif::Data::GetDataName (  ) [inline]

Returns data block name.

int mmdb::mmcif::Data::GetField ( io::RFile  f,
pstr  S,
pstr &  L,
pstr &  p,
int &  lcount,
int &  llen 
) [protected]
int mmdb::mmcif::Data::GetInteger ( int &  I,
cpstr  CName,
cpstr  TName,
bool  Remove = false 
)
void mmdb::mmcif::Data::GetLoop ( io::RFile  f,
pstr  S,
pstr &  L,
pstr &  p,
int &  lcount,
int &  llen 
) [protected]
PLoop mmdb::mmcif::Data::GetLoop ( cpstr  CName )

Retrieves mmCIF loop with given name.

Parameters:
CNamecharacter string with name of the loop (must start with underscore).
Returns:
pointer to loop if loop with given name was found, and NULL otherwise.
Note:
The application should never attempt to deallocate the loop returned. It will be properly disposed of by mmcif::Data's destructor.
int mmdb::mmcif::Data::GetLoopInteger ( int &  I,
cpstr  CName,
cpstr  TName,
int  nrow,
bool  Remove = false 
)
int mmdb::mmcif::Data::GetLoopIVector ( ivector &  I,
cpstr  CName,
cpstr  TName,
int  i1 = 0,
int  i2 = MaxInt4,
bool  Remove = false 
)
int mmdb::mmcif::Data::GetLoopLength ( cpstr  CName )
int mmdb::mmcif::Data::GetLoopReal ( realtype &  R,
cpstr  CName,
cpstr  TName,
int  nrow,
bool  Remove = false 
)
int mmdb::mmcif::Data::GetLoopRVector ( rvector &  R,
cpstr  CName,
cpstr  TName,
int  i1 = 0,
int  i2 = MaxInt4,
bool  Remove = false 
)
pstr mmdb::mmcif::Data::GetLoopString ( cpstr  CName,
cpstr  TName,
int  nrow,
int &  RC 
)
int mmdb::mmcif::Data::GetLoopString ( pstr &  Dest,
cpstr  CName,
cpstr  TName,
int  nrow,
bool  Remove = false 
)
int mmdb::mmcif::Data::GetLoopSVector ( psvector &  S,
cpstr  CName,
cpstr  TName,
int  i1 = 0,
int  i2 = MaxInt4,
bool  Remove = false 
)
int mmdb::mmcif::Data::GetNumberOfCategories (  ) [inline]

Returns the number of categories (structures and loops) in data block.

int mmdb::mmcif::Data::GetReal ( realtype &  R,
cpstr  CName,
cpstr  TName,
bool  Remove = false 
)
int mmdb::mmcif::Data::GetString ( pstr &  Dest,
cpstr  CName,
cpstr  TName,
bool  Remove = false 
)
pstr mmdb::mmcif::Data::GetString ( cpstr  CName,
cpstr  TName,
int &  RC 
)
PStruct mmdb::mmcif::Data::GetStructure ( cpstr  CName )

Retrieves mmCIF structure with given name.

Parameters:
CNamecharacter string with name of the structure (must start with underscore).
Returns:
pointer to structure if structure with given name was found, and NULL otherwise.
Note:
The application should never attempt to deallocate the structure returned. It will be properly disposed of by mmcif::Data's destructor.
int mmdb::mmcif::Data::GetWarnings (  ) [inline]

Returns bit-encoded warnings issued at last file read.

Returns:
an integer number, which is an or-superposition of warning flags:
  • CIFW_UnrecognizedItems: unrecognized items were found
  • CIFW_MissingField: expected data field not found
  • CIFW_EmptyLoop: loop category was defined but has no data
  • CIFW_UnexpectedEOF: mmCIF construct finished prematurely
  • CIFW_LoopFieldMissing: loop category has wrong number of data fields
  • CIFW_NotAStructure: attempt to use a category name, which was once defined as a structure, as a loop
  • CIFW_NotALoop: attempt to use a category name, which was once defined as a loop, as a structure
  • CIFW_DuplicateTag: duplicate tag was found in a structure or loop
void mmdb::mmcif::Data::InitData (  ) [protected]
void mmdb::mmcif::Data::Optimize (  )
void mmdb::mmcif::Data::PrintCategories (  )
void mmdb::mmcif::Data::PutDataName ( cpstr  dname )
int mmdb::mmcif::Data::PutDate ( cpstr  CName,
cpstr  TName 
)
int mmdb::mmcif::Data::PutInteger ( int  I,
cpstr  CName,
cpstr  TName 
)
int mmdb::mmcif::Data::PutLoopInteger ( int  I,
cpstr  CName,
cpstr  TName,
int  nrow 
)
int mmdb::mmcif::Data::PutLoopIVector ( ivector  I,
cpstr  CName,
cpstr  TName,
int  i1,
int  i2 
)
int mmdb::mmcif::Data::PutLoopNoData ( int  NoDataType,
cpstr  CName,
cpstr  TName,
int  nrow 
)
int mmdb::mmcif::Data::PutLoopReal ( realtype  R,
cpstr  CName,
cpstr  TName,
int  nrow,
int  prec = 8 
)
int mmdb::mmcif::Data::PutLoopRVector ( rvector  R,
cpstr  CName,
cpstr  TName,
int  i1,
int  i2,
int  prec = 8 
)
int mmdb::mmcif::Data::PutLoopString ( cpstr  S,
cpstr  CName,
cpstr  TName,
int  nrow 
)
int mmdb::mmcif::Data::PutLoopSVector ( psvector  S,
cpstr  CName,
cpstr  TName,
int  i1,
int  i2 
)
int mmdb::mmcif::Data::PutNoData ( int  NoDataType,
cpstr  CName,
cpstr  TName 
)
int mmdb::mmcif::Data::PutReal ( realtype  R,
cpstr  CName,
cpstr  TName,
int  prec = 8 
)
int mmdb::mmcif::Data::PutString ( cpstr  S,
cpstr  CName,
cpstr  TName,
bool  Concatenate = false 
)
void mmdb::mmcif::Data::read ( io::RFile  f )
int mmdb::mmcif::Data::ReadMMCIFData ( cpstr  FName,
io::GZ_MODE  gzipMode = io::GZM_CHECK 
)

Reads mmCIF data block from file.

Parameters:
FNamecharacter null-terminated string with file name
gzipModeflag to read compressed files:

  • GZM_NONE: do not assume any compression
  • GZM_CHECK: check compression type by file extension
  • GZM_ENFORCE: same as GZM_ENFORCE_GZIP
  • GZM_ENFORCE_GZIP: assume gzip compression (*.gz files)
  • GZM_ENFORCE_COMPRESS: assume compression with 'compress' (*.Z files).
Returns:
CIFRC_Ok: no errors
negative: there were errors
positive: there were warnings.

This function will read 1st data block from the specified file. In case of non-zero return, use GetCIFMessage() function to print the corresponding error message or warning:

        mmcif::Data data;
        char       errLog[500];
        int        rc;
           rc = data.ReadMMCIFData  ( "myfile.cif" );
           if (rc<0)
             printf ( " There was an error:\n %s\n",
                      GetCIFMessage(errLog,rc) );
           else if (rc>0)
             printf ( " There were warnings:\n %s\n",
                      GetCIFMessage(errLog,rc) );
           else
             printf ( " mmCIF file has be read in successfully.\n" );
int mmdb::mmcif::Data::ReadMMCIFData ( io::RFile  f,
pstr  S,
int &  lcount 
)

Reads sequential mmCIF data blocks from file.

Parameters:
RCFilereference to a CFile object opened on a file
Sbuffer string which represent a sliding read window. The string should be at least 500 characters long, initialized with empty-string value before first read, and passed unchanged between the reads
lcountline counter, should be set zero before first read and passed unchanged between the reads.
Returns:
CIFRC_Ok: no errors
negative: there were errors
positive: there were warnings.

This function will read 1st data block from the current position of the file. The function is useful if a file contains more than a single data block, which should be read sequentially.

Note:
Alternatively, files with multiple data blocks can be read using mmcif::File class.

In case of non-zero return, use GetCIFMessage() function to print the corresponding error message or warning:

      mmcif::Data    mmCIFData;
      CFile         f;
      char          S[1000];
      int           rc,lcount;

        // open file first
        f.assign ( "/path/example.cif" );
        if (!f.reset(true))  {
          printf ( " *** cannot open file '%s' for reading.\n",
                   f.FileName() );
          return -1;
        }

        lcount = 0;         // global line counter through the file
        S[0]   = char(0);   // buffer string
        while (!f.FileEnd())  {

          rc = mmCIFData.ReadMMCIFData ( f,S,lcount );

          if (rc!=CIFRC_Ok)  {  // error or warning
            if ((rc<0) && (!f.FileEnd()))  { // error
              printf ( " *** error reading file %s:\n"
                       "     %s\n",f.FileName(),GetCIFMessage(S,rc) );
              return rc;
            } else if (rc>0)  { // warning
              printf ( " ... warning on reading file %s:\n"
                       "     %s\n",f.FileName(),GetCIFMessage(S,rc) );
            }
          } else  {
            // fetch needful values from the data block
            // ........
          }

        }

        f.shut();  // close file

        // NOTE: do not delete mmcif::Struct/mmcif::Loop
        // classes obtained from mmcif::Data. If you do, get a crash.
        // All these structures are containers that dispose their
        // content automatically.
void mmdb::mmcif::Data::RemoveFlag ( CIF_FLAG  F )

Removes optional flag(s) for reading mmCIF files. By default, no flags are set.

Parameters:
[in]Fflag or logical "or" of several flags to be removed (unset):

  • CIFFL_PrintWarnings no wornings will be printed in stdout, but rather returned in the bit-encoded return code
  • CIFFL_StopOnWarnings warnings will not stop reading
  • CIFFL_SuggestCategories loops without names will count as errors and stop reading
  • CIFFL_SuggestTags duplicate tags in structures and loops will count as errors and stop reading.

See more detail flag description in mmcif::Data::SetFlag().

int mmdb::mmcif::Data::RenameCategory ( cpstr  CName,
cpstr  newCName 
)
void mmdb::mmcif::Data::SetFlag ( CIF_FLAG  F )

Sets optional flag(s) for reading mmCIF files. By default, no flags are set.

Parameters:
[in]Fflag or logical "or" of several flags to be set:

  • CIFFL_PrintWarnings toggles printing warning messages at reading an mmCIF file, in stdout. If this flag is not set (default), the warnings will be returned in the bit-encoded return code
  • CIFFL_StopOnWarnings if set, reading an mmCIF file will stop at first warning issued
  • CIFFL_SuggestCategories allows for reading of mmCIF files with loops and structures having no category names ("dirty CIFs"). If this flag is set, then hidden category names will be automatically generated. These names will not appear in the output. As these names are hidden, they cannot be used to access data. In order to access data in such categories, consider whether they are structures or loops. In case of a unnamed structure, simply specify "" (empty string) for structure name in all access functions ( note that CIFFL_SuggestCategories flag must be on while accessing such data). In case of a loop, first use the mmcif::Data::FindLoop function to retrieve pointer on the hidden loop, and then use mmcif::Loop's interface function to fetch data from the loop.
  • CIFFL_SuggestTags allows for duplicate tags in a category (structure or loop, including hidden categories). This may help reading "dirty CIFs". At present, only data for first non-unique tag may be accessed.
void mmdb::mmcif::Data::SetPrintWarnings ( bool  SPW )

Sets flag to print warnings on reading mmCIF files.

Parameters:
[in]SPWflag to print warnings:

  • true : warnings will be printed to stdout
  • false : warnings will not be printed but returned in return code (default)
void mmdb::mmcif::Data::SetStopOnWarning ( bool  SOW )

Sets flag to stop on warning when reading an mmCIF file.

Parameters:
[in]SOWflag to stop on warning:

  • true : reading will stop on first warning encountered
  • false : warnings will not stop reading (default)
void mmdb::mmcif::Data::SetWrongFields ( cpstr *  cats,
cpstr *  tags 
)

Sets category names and tags that are to be ignored on file read.

Parameters:
[in]catslist of categories, terminated by NULL
[in]tagslist of tags, terminated by NULL.

This special function is to aid reading corrupt mmCIF files. The input lists should be of equal length 'n', and specify 'n' "wrong fields" that should be ignored on input. E.g., ith "wrong field" is identified as "cats[i].taga[i]". If "wrong field" belongs to a loop, then all the corresponding column is assumed to be absent. This corrects for mmCIF errors when defined tags in loops or structures do not have actual data associated with them.

In order to remove settings, call SetWrongFields(NULL,NULL).

Example:

        // assume data for "_category.item1" and "_category.item2"
        // missed in a file to-be-read
        mmcif::Data data;
        cpstr cats[] = { "_category", "_category", NULL };
        cpstr tags[] = { "item1"    , "item2"    , NULL };

           data.SetWrongFields ( cats,tags );
           data.ReadMMCIFData  ( "corrupt.cif" );
void mmdb::mmcif::Data::Sort (  ) [protected]
void mmdb::mmcif::Data::write ( io::RFile  f )
void mmdb::mmcif::Data::WriteMMCIF ( io::RFile  f )

Writes (next) mmCIF data block into file.

Parameters:
RCFilereference to a CFile object opened on a file.

This function allows for sequential write of mmCIF data blocks into a file.

Note:
Alternatively, files with multiple data blocks can be created using mmcif::File class.

Example:

      io::File       f;
      mmcif::Data  cifData;

        // open file first
        f.assign ( "/path/example.cif" );
        if (!f.rewrite())  {
          printf ( " *** cannot open file '%s' for writing.\n",
                   f.FileName() );
          return -1;
        }

        cifData.PutDataName ( "name1" );
        // fill cifData with all data needed
        cifData.WriteMMCIF ( f ); // first data block written

        cifData.FreeMemory  ( 0 );  // reset data block to empty
        cifData.PutDataName ( "name2" );
        // fill cifData with all data needed
        cifData.WriteMMCIF ( f );  // second data block written

        // add as many data blocks as needed

        // now close the file
        f.shut();
bool mmdb::mmcif::Data::WriteMMCIFData ( cpstr  FName,
io::GZ_MODE  gzipMode = io::GZM_CHECK 
)

Writes mmCIF data block into file.

Parameters:
FNamecharacter null-terminated string with file name
gzipModeflag to read compressed files:

  • GZM_NONE: do not compress
  • GZM_CHECK: compress according to file extension
  • GZM_ENFORCE: same as GZM_ENFORCE_GZIP
  • GZM_ENFORCE_GZIP: compress with gzip
  • GZM_ENFORCE_COMPRESS: compression with 'compress'.
Returns:
true: no errors
false: file cannot be open for writing.

Friends And Related Function Documentation

friend class File [friend]

Member Data Documentation

PPCategory mmdb::mmcif::Data::Category [protected]
int mmdb::mmcif::Data::flags [protected]
int mmdb::mmcif::Data::loopNo [protected]
int mmdb::mmcif::Data::tagNo [protected]
int mmdb::mmcif::Data::Warning [protected]

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines