CifFile Class Reference

Public class that represents a CIF file, composed of blocks with tables. More...

#include <CifFile.h>

Inherited by DdlFile.

Inheritance diagram for CifFile:

Inheritance graph
[legend]
List of all members.

Public Types

enum  eQuoting { eSINGLE = 0, eDOUBLE }

Public Member Functions

 CifFile (const StringCompare::eCompareType caseSense=StringCompare::eCASE_SENSITIVE)
 CifFile (const eFileMode fileMode, const string &fileName, const bool verbose=false, const StringCompare::eCompareType caseSense=StringCompare::eCASE_SENSITIVE, const unsigned int maxLineLength=STD_CIF_LINE_LENGTH, const string &nullValue=CifString::NullValue)
 ~CifFile ()
bool GetVerbose ()
void SetSmartPrint (bool smartPrint=true)
bool IsSmartPrint ()
void SetQuoting (eQuoting quoting)
unsigned int GetQuoting ()
void Write (const string &cifFileName, const bool sortTables=false, const bool writeEmptyTables=false)
void Write (const string &cifFileName, const vector< string > &tableOrder, const bool writeEmptyTables=false)
int DataChecking (CifFile &dicRef)

Static Public Member Functions

static void GetItemNames (vector< string > &itemNames, ISTable &isTable)

Static Public Attributes

static const unsigned int STD_CIF_LINE_LENGTH = 80

Protected Types

enum  eIdentType { eNONE = 0, eLEFT, eRIGHT }

Protected Member Functions

int _IsQuotableText (const string &itemValue)
eIdentType _FindPrintType (const vector< string > &values)
void _PrintItemIdent (ostream &cifo, unsigned int &linePos)
void _PrintItemName (ostream &cifo, const string &category, const string &itemName, unsigned int &linePos)
void _PrintPostItemSeparator (ostream &cifo, unsigned int &linePos, const bool ident=false, const unsigned int numSpaces=1)
int _PrintItemValue (ostream &cifo, const string &itemValue, unsigned int &linePos, const eIdentType identType=eNONE, const unsigned int width=0)
int _PrintItemNameInHeader (ostream &cifo, const string &itemValue, unsigned int &linePos, const eIdentType identType=eNONE, const unsigned int width=0)
void _PrintHeaderedItems (ostream &cifo, const vector< string > &colNames, const vector< unsigned int > &colWidths, const vector< eIdentType > colPrintType)
void Write (ostream &cifo, const bool sortTables=false, const bool writeEmptyTables=false)
void Write (ostream &cifo, const vector< string > &catOrder, const bool writeEmptyTables=false)
void Write (ostream &cifo, vector< unsigned int > &tables, const bool writeEmptyTables=false)
int MandatoryCategoryChecking (CifFile &ref, ofstream &log)
int ItemsChecking (CifFile &ref, ofstream &log)

Protected Attributes

unsigned int _maxCifLineLength
string _nullValue
bool _verbose
bool _smartPrint
string _quotes

Static Protected Attributes

static const unsigned int STD_PRINT_SPACING = 3
static const unsigned int SMART_PRINT_SPACING = 1
static const unsigned int HEADER_SPACING = 40

Private Member Functions

void Init ()
void ConvertEscapedString (const string &inString, string &outString)

Detailed Description

Public class that represents a CIF file, composed of blocks with tables.

This class represents a CIF file. In addition to inherited methods from TableFile class, this class provides methods for writing the data to a text file, along with methods for controlling how the data is written, and a method for verifying the CIF file against dictionary.


Member Enumeration Documentation

enum CifFile::eQuoting

Enumerator:
eSINGLE 
eDOUBLE 

enum CifFile::eIdentType [protected]

Enumerator:
eNONE 
eLEFT 
eRIGHT 


Constructor & Destructor Documentation

CifFile::CifFile ( const StringCompare::eCompareType  caseSense = StringCompare::eCASE_SENSITIVE  ) 

Constructs a CIF file.

Parameters:
[in] caseSense - optional parameter that indicates case sensitivity of table names. Possible values are case sensitive and case in-sensitive. If not specified, case sensitive table names are assumed.
Returns:
Not applicable
Precondition:
None
Postcondition:
Constructed CIF file has virtual file mode, logging is turned off, maximum line length is set to STD_CIF_LINE_LENGTH, and unknown CIF value character is set to CifString::NullValue.
Exceptions:
 None

CifFile::CifFile ( const eFileMode  fileMode,
const string &  fileName,
const bool  verbose = false,
const StringCompare::eCompareType  caseSense = StringCompare::eCASE_SENSITIVE,
const unsigned int  maxLineLength = STD_CIF_LINE_LENGTH,
const string &  nullValue = CifString::NullValue 
)

Constructs a CIF file.

Parameters:
[in] fileMode - CIF file mode. Possible values are read-only, create, update and virtual. Detailed description of file mode is given in TableFile documentation.
[in] fileName - relative or absolute name of the file where object persistency is maintained. If fileMode specifies virtual mode, this parameter is ignored.
[in] verbose - optional parameter that indicates whether logging should be turned on (if true) or off (if false). If verbose is not spefified, logging is turned off.
[in] caseSense - optional parameter that indicates case sensitivity of table names. Possible values are case sensitive and case in-sensitive. If not specified, case sensitive table names are assumed.
[in] maxLineLength - optional parameter that indicates the maximum number of written characters in one line in the written text file. If not specified, STD_CIF_LINE_LENGTH is used.
[in] nullValue - optional parameter that indicates the character that is to be used to denote unknown value in the written CIF file. If not specified, CifString::NullValue is used.
Returns:
Not applicable
Precondition:
None
Postcondition:
None
Exceptions:
 None

CifFile::~CifFile (  ) 

Destructs a CIF file, by releasing all consumed resources.

Parameters:
 Not applicable
Returns:
Not applicable
Precondition:
None
Postcondition:
None
Exceptions:
 None


Member Function Documentation

bool CifFile::GetVerbose (  )  [inline]

Retrieves logging option.

Parameters:
 None
Returns:
true - if logging is turned on

false - if logging is turned off

Precondition:
None
Postcondition:
None
Exceptions:
 None

void CifFile::SetSmartPrint ( bool  smartPrint = true  )  [inline]

Sets smart printing option. Smart printing is used to beautify the output of a written text file.

Parameters:
smartPrint - smart printing. If false, smart printing is disabled. If true, smart printing is enabled. If not specified, smart printing is enabled.
Returns:
None
Precondition:
None
Postcondition:
None
Exceptions:
 None

bool CifFile::IsSmartPrint (  )  [inline]

Retrieves smart printing option.

Parameters:
 None
Returns:
true - if smart printing is enabled

false - if smart printing is disabled

Precondition:
None
Postcondition:
None
Exceptions:
 None

void CifFile::SetQuoting ( eQuoting  quoting  ) 

Sets quoting option. This option is used in order to select the type of quoting to be used in the written text file.

Parameters:
quoting - type of quoting. If eSINGLE, single quotes are used. If eDOUBLE, double quotes are used.
Returns:
None
Precondition:
None
Postcondition:
None
Exceptions:
 None

unsigned int CifFile::GetQuoting (  ) 

Retrieves quoting option.

Parameters:
 None
Returns:
eSINGLE - if single quotes are used

eDOUBLE - if double quotes are used

Precondition:
None
Postcondition:
None
Exceptions:
 None

void CifFile::Write ( const string &  cifFileName,
const bool  sortTables = false,
const bool  writeEmptyTables = false 
)

Writes the data out to a text file.

Parameters:
[in] cifFileName - relative or absolute name of the text file to which the data from CifFile object is to be written to.
[in] sortTables - optional parameter that indicates whether written tables should be sorted (if true) or not sorted (if false). If sortTables is not spefified, tables are not sorted prior to writing them.
[in] writeEmptyTables - optional parameter that indicates whether empty tables (0 rows) are to be written (if true) or not written (if false). If writeEmptyTables is not spefified, empty tables are not written.
Returns:
None
Precondition:
None
Postcondition:
None
Exceptions:
 None

void CifFile::Write ( const string &  cifFileName,
const vector< string > &  tableOrder,
const bool  writeEmptyTables = false 
)

Writes the data out to a text file.

Parameters:
[in] cifFileName - relative or absolute name of the text file to which the data from CifFile object is to be written to.
[in] tableOrder - vector of table names that indicates the order of written tables.
[in] writeEmptyTables - optional parameter that indicates whether empty tables (0 rows) are to be written (if true) or not written (if false). If writeEmptyTables is not spefified, empty tables are not written.
Returns:
None
Precondition:
None
Postcondition:
None
Exceptions:
 None

int CifFile::DataChecking ( CifFile dicRef  ) 

Checks a CIF file against the dictionary.

Parameters:
[in] dicRef - reference to a dictionary file
Returns:
0 - if all checks passed

different than 0 - if checks failed

Precondition:
None
Postcondition:
None
Exceptions:
 None

void CifFile::GetItemNames ( vector< string > &  itemNames,
ISTable &  isTable 
) [static]

Constructs CIF item names in the form "_<category>.<item>", by using the table name for the category name and each column name for the item name.

Parameters:
[out] itemNames - constructed CIF item names. The number of CIF items is equal to the number of table columns.
[in] isTable - table reference
Returns:
None
Precondition:
None
Postcondition:
None
Exceptions:
 None

int CifFile::_IsQuotableText ( const string &  itemValue  )  [protected]

CifFile::eIdentType CifFile::_FindPrintType ( const vector< string > &  values  )  [protected]

void CifFile::_PrintItemIdent ( ostream &  cifo,
unsigned int &  linePos 
) [protected]

void CifFile::_PrintItemName ( ostream &  cifo,
const string &  category,
const string &  itemName,
unsigned int &  linePos 
) [protected]

void CifFile::_PrintPostItemSeparator ( ostream &  cifo,
unsigned int &  linePos,
const bool  ident = false,
const unsigned int  numSpaces = 1 
) [protected]

int CifFile::_PrintItemValue ( ostream &  cifo,
const string &  itemValue,
unsigned int &  linePos,
const eIdentType  identType = eNONE,
const unsigned int  width = 0 
) [protected]

int CifFile::_PrintItemNameInHeader ( ostream &  cifo,
const string &  itemValue,
unsigned int &  linePos,
const eIdentType  identType = eNONE,
const unsigned int  width = 0 
) [protected]

void CifFile::_PrintHeaderedItems ( ostream &  cifo,
const vector< string > &  colNames,
const vector< unsigned int > &  colWidths,
const vector< eIdentType colPrintType 
) [protected]

void CifFile::Write ( ostream &  cifo,
const bool  sortTables = false,
const bool  writeEmptyTables = false 
) [protected]

void CifFile::Write ( ostream &  cifo,
const vector< string > &  catOrder,
const bool  writeEmptyTables = false 
) [protected]

void CifFile::Write ( ostream &  cifo,
vector< unsigned int > &  tables,
const bool  writeEmptyTables = false 
) [protected]

int CifFile::MandatoryCategoryChecking ( CifFile ref,
ofstream &  log 
) [protected]

int CifFile::ItemsChecking ( CifFile ref,
ofstream &  log 
) [protected]

void CifFile::Init (  )  [private]

void CifFile::ConvertEscapedString ( const string &  inString,
string &  outString 
) [private]


Member Data Documentation

const unsigned int CifFile::STD_CIF_LINE_LENGTH = 80 [static]

const unsigned int CifFile::STD_PRINT_SPACING = 3 [static, protected]

const unsigned int CifFile::SMART_PRINT_SPACING = 1 [static, protected]

const unsigned int CifFile::HEADER_SPACING = 40 [static, protected]

unsigned int CifFile::_maxCifLineLength [protected]

string CifFile::_nullValue [protected]

bool CifFile::_verbose [protected]

bool CifFile::_smartPrint [protected]

string CifFile::_quotes [protected]


The documentation for this class was generated from the following files:
Generated on Tue Apr 24 09:25:36 2007 for cif-file-v1.0 by  doxygen 1.5.1