librcsb-core-wrapper  1.005
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
DicFile Class Reference

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

#include <DicFile.h>

Inheritance diagram for DicFile:
Inheritance graph
Collaboration diagram for DicFile:
Collaboration graph

Public Member Functions

 DicFile (const eFileMode fileMode, const std::string &objFileName, const bool verbose=false, const Char::eCompareType caseSense=Char::eCASE_SENSITIVE, const unsigned int maxLineLength=STD_CIF_LINE_LENGTH, const std::string &nullValue=CifString::UnknownValue)
 
 DicFile (const bool verbose=false, const Char::eCompareType caseSense=Char::eCASE_SENSITIVE, const unsigned int maxLineLength=STD_CIF_LINE_LENGTH, const std::string &nullValue=CifString::UnknownValue)
 
 ~DicFile ()
 
void WriteItemAliases (const std::string &fileName)
 
ISTableGetFormatTable ()
 
int WriteFormatted (const std::string &cifFileName, ISTable *formatP=NULL)
 
int WriteFormatted (const std::string &cifFileName, TableFile *ddl, ISTable *formatP=NULL)
 
void Compress (CifFile *ddl)
 
CifFileGetRefFile ()
 
void Write (const std::string &cifFileName, const bool sortTables=false, const bool writeEmptyTables=false)
 
void Write (const std::string &cifFileName, const std::vector< std::string > &tableOrder, const bool writeEmptyTables=false)
 
void Write (std::ostream &outStream, const bool sortTables=false, const bool writeEmptyTables=false)
 
void Write (std::ostream &cifo, const std::vector< std::string > &catOrder, const bool writeEmptyTables=false)
 
void Write (std::ostream &cifo, std::vector< unsigned int > &tables, const bool writeEmptyTables=false)
 
- Public Member Functions inherited from CifFile
 CifFile (const eFileMode fileMode, const std::string &fileName, const bool verbose=false, const Char::eCompareType caseSense=Char::eCASE_SENSITIVE, const unsigned int maxLineLength=STD_CIF_LINE_LENGTH, const std::string &nullValue=CifString::UnknownValue)
 
 CifFile (const bool verbose=false, const Char::eCompareType caseSense=Char::eCASE_SENSITIVE, const unsigned int maxLineLength=STD_CIF_LINE_LENGTH, const std::string &nullValue=CifString::UnknownValue)
 
 ~CifFile ()
 
void SetSrcFileName (const std::string &srcFileName)
 
const std::string & GetSrcFileName ()
 
bool GetVerbose ()
 
void SetSmartPrint (bool smartPrint=true)
 
bool IsSmartPrint ()
 
void SetQuoting (eQuoting quoting)
 
unsigned int GetQuoting ()
 
void SetLooping (const std::string &catName, bool looping=false)
 
bool GetLooping (const std::string &catName)
 
void Write (const std::string &cifFileName, const bool sortTables=false, const bool writeEmptyTables=false)
 
void Write (const std::string &cifFileName, const std::vector< std::string > &tableOrder, const bool writeEmptyTables=false)
 
void Write (std::ostream &outStream, const bool sortTables=false, const bool writeEmptyTables=false)
 
void WriteNmrStar (const std::string &nmrStarFileName, const std::string &globalBlockName, const bool sortTables=false, const bool writeEmptyTables=false)
 
int DataChecking (CifFile &dicRef, const std::string &diagFileName, const bool extraDictChecks=false, const bool extraCifChecks=false)
 
int DataChecking (Block &block, Block &refBlock, std::ostringstream &buf, const bool extraDictChecks=false, const bool extraCifChecks=false)
 
void SetEnumCheck (bool caseSense=false)
 
bool GetEnumCheck ()
 
const std::string & GetParsingDiags ()
 
void FindCifNullRows (std::vector< unsigned int > &nullRowsIndices, const ISTable &isTable)
 
void GetAttributeValue (std::string &attribVal, const std::string &blockId, const std::string &category, const std::string &attribute)
 
void GetAttributeValueIf (std::string &attribVal, const std::string &blockId, const std::string &category, const std::string &attributeA, const std::string &attributeB, const std::string &valB)
 
bool IsAttributeValueDefined (const std::string &blockId, const std::string &category, const std::string &attribute)
 
void SetAttributeValue (const std::string &blockId, const std::string &category, const std::string &attribute, const std::string &value, const bool create=false)
 
void SetAttributeValueIf (const std::string &blockId, const std::string &category, const std::string &attributeA, const std::string &valA, const std::string &attributeB, const std::string &valB, const bool create=false)
 
void SetAttributeValueIfNull (const std::string &blockId, const std::string &category, const std::string &attribute, const std::string &value)
 
void GetAttributeValues (std::vector< std::string > &strings, const std::string &blockId, const std::string &category, const std::string &attribute)
 
void GetAttributeValuesIf (std::vector< std::string > &strings, const std::string &blockId, const std::string &category, const std::string &attributeA, const std::string &attributeB, const std::string &valB)
 
void SetAttributeValues (const std::string &blockId, const std::string &category, const std::string &attribute, const std::vector< std::string > &values)
 
int CheckCategories (Block &block, Block &refBlock, std::ostringstream &log)
 
void CheckCategoryKey (Block &block, std::ostringstream &log)
 
void CheckItemsTable (Block &block, std::ostringstream &log)
 
int CheckItems (Block &block, Block &refBlock, std::ostringstream &log)
 
- Public Member Functions inherited from TableFile
 TableFile (const Char::eCompareType caseSense=Char::eCASE_SENSITIVE)
 
 TableFile (const eFileMode fileMode, const string &fileName, const Char::eCompareType caseSense=Char::eCASE_SENSITIVE)
 
virtual ~TableFile ()
 
string GetFileName (void)
 
eFileMode GetFileMode (void)
 
Char::eCompareType GetCaseSensitivity (void)
 
unsigned int GetStatusInd (void)
 
unsigned int GetNumBlocks ()
 
void GetBlockNames (vector< string > &blockNames)
 
string GetFirstBlockName ()
 
bool IsBlockPresent (const string &blockName)
 
string AddBlock (const string &blockName)
 
BlockGetBlock (const string &blockName)
 
string RenameBlock (const string &oldBlockName, const string &newBlockName)
 
string RenameFirstBlock (const string &newBlockName)
 
void Flush ()
 
void Serialize (const string &fileName)
 
void Close ()
 

Protected Member Functions

int WriteFormatted (std::ostream &cifo, ISTable *formatP)
 
int WriteFormatted (std::ostream &cifo, TableFile *ddl, ISTable *formatP)
 
void WriteItemAliases (std::ostream &cifo)
 
- Protected Member Functions inherited from CifFile
int _IsQuotableText (const std::string &itemValue)
 
eIdentType _FindPrintType (const std::vector< std::string > &values)
 
void _PrintItemIdent (std::ostream &cifo, unsigned int &linePos)
 
void _PrintItemName (std::ostream &cifo, const std::string &category, const std::string &itemName, unsigned int &linePos)
 
void _PrintPostItemSeparator (std::ostream &cifo, unsigned int &linePos, const bool ident=false, const unsigned int numSpaces=1)
 
int _PrintItemValue (std::ostream &cifo, const std::string &itemValue, unsigned int &linePos, const eIdentType identType=eNONE, const unsigned int width=0)
 
int _PrintItemNameInHeader (std::ostream &cifo, const std::string &itemValue, unsigned int &linePos, const eIdentType identType=eNONE, const unsigned int width=0)
 
void _PrintHeaderedItems (std::ostream &cifo, const std::vector< std::string > &colNames, const std::vector< unsigned int > &colWidths, const std::vector< eIdentType > colPrintType)
 
void Write (std::ostream &cifo, const std::vector< std::string > &catOrder, const bool writeEmptyTables=false)
 
void Write (std::ostream &cifo, std::vector< unsigned int > &tables, const bool writeEmptyTables=false)
 
- Protected Member Functions inherited from TableFile
void _SetStatusInd (const string &blockName)
 
void _AddBlock (const string &blockName, Serializer *serP)
 
void _GetNumTablesInBlocks (vector< UInt32 > &numTablesInBlocks)
 
ISTable_GetTablePtr (const unsigned int blockIndex, const unsigned int tableIndex)
 
void _GetAllTables ()
 
unsigned int GetTotalNumTables ()
 
void GetTableNames (vector< string > &tableNames)
 
void GetTablesIndices (vector< unsigned int > &tablesIndices)
 
void GetSortedTablesIndices (vector< unsigned int > &tablesIndices)
 
void _ReadFileIndex ()
 
void _ReadFileIndexVersion0 ()
 
void _ReadFileIndexVersion1 ()
 
void _WriteFileIndex (Serializer *serP, const vector< unsigned int > &tableLocs)
 

Protected Attributes

ISTable_formatP
 
- Protected Attributes inherited from CifFile
std::string _beginDataKeyword
 
std::string _endDataKeyword
 
std::string _beginLoopKeyword
 
std::string _endLoopKeyword
 
unsigned int _maxCifLineLength
 
std::string _nullValue
 
bool _verbose
 
bool _smartPrint
 
std::string _quotes
 
std::map< std::string, bool > _looping
 
bool _enumCaseSense
 
- Protected Attributes inherited from TableFile
string _fileName
 
eFileMode _fileMode
 
Char::eCompareType _caseSense
 
unsigned int _statusInd
 
mapped_ptr_vector< Block, StringLess_blocks
 
Serializer_f
 

Additional Inherited Members

- Public Types inherited from CifFile
enum  eQuoting { eSINGLE = 0 , eDOUBLE }
 
- Public Types inherited from TableFile
enum  eStatusInd { eCLEAR_STATUS = 0x0000 , eDUPLICATE_BLOCKS = 0x0001 , eUNNAMED_BLOCKS = 0x0002 }
 
- Public Attributes inherited from CifFile
std::string _parsingDiags
 
std::string _checkingDiags
 
- Static Public Attributes inherited from CifFile
static const unsigned int STD_CIF_LINE_LENGTH = 80
 
- Protected Types inherited from CifFile
enum  eIdentType { eNONE = 0 , eLEFT , eRIGHT }
 
- Static Protected Attributes inherited from CifFile
static const unsigned int STD_PRINT_SPACING = 3
 
static const unsigned int SMART_PRINT_SPACING = 1
 
static const unsigned int HEADER_SPACING = 40
 

Detailed Description

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

This class represents a dictionary file. In addition to inherited methods from CifFile class, this class provides a method for writing the content of "item_aliases" table to a text file.

Constructor & Destructor Documentation

◆ DicFile() [1/2]

DicFile::DicFile ( const eFileMode  fileMode,
const std::string &  objFileName,
const bool  verbose = false,
const Char::eCompareType  caseSense = Char::eCASE_SENSITIVE,
const unsigned int  maxLineLength = STD_CIF_LINE_LENGTH,
const std::string &  nullValue = CifString::UnknownValue 
)

Constructs a dictionary file.

Parameters
[in]fileMode- dictionary 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 specified, 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::UnknownValue is used.
Returns
Not applicable
Precondition
None
Postcondition
None
Exceptions

◆ DicFile() [2/2]

DicFile::DicFile ( const bool  verbose = false,
const Char::eCompareType  caseSense = Char::eCASE_SENSITIVE,
const unsigned int  maxLineLength = STD_CIF_LINE_LENGTH,
const std::string &  nullValue = CifString::UnknownValue 
)

Constructs a dictionary file in virtual mode.

Parameters
[in]verbose- optional parameter that indicates whether logging should be turned on (if true) or off (if false). If verbose is not specified, 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::UnknownValue is used.
Returns
Not applicable
Precondition
None
Postcondition
None
Exceptions

◆ ~DicFile()

DicFile::~DicFile ( )

Destructs a dictionary file, by releasing all consumed resources.

Parameters
Not applicable
Returns
Not applicable
Precondition
None
Postcondition
None
Exceptions

Member Function Documentation

◆ Compress()

void DicFile::Compress ( CifFile ddl)

Method, not currently part of users public API, and will soon be re-examined.

◆ GetFormatTable()

ISTable* DicFile::GetFormatTable ( )

Method, not currently part of users public API, and will soon be re-examined.

◆ GetRefFile()

CifFile* DicFile::GetRefFile ( )

◆ Write() [1/5]

void CifFile::Write

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 specified, 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 specified, empty tables are not written.
Returns
None
Precondition
None
Postcondition
None
Exceptions

◆ Write() [2/5]

void CifFile::Write

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 specified, empty tables are not written.
Returns
None
Precondition
None
Postcondition
None
Exceptions

◆ Write() [3/5]

void CifFile::Write

◆ Write() [4/5]

void CifFile::Write

◆ Write() [5/5]

void CifFile::Write

Writes the data out to an output stream.

Parameters
[in]outStream- a reference to the output stream
[in]sortTables- optional parameter that indicates whether written tables should be sorted (if true) or not sorted (if false). If sortTables is not specified, 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 specified, empty tables are not written.
Returns
None
Precondition
None
Postcondition
None
Exceptions

◆ WriteFormatted() [1/4]

int DicFile::WriteFormatted ( const std::string &  cifFileName,
ISTable formatP = NULL 
)

Method, not currently part of users public API, and will soon be re-examined.

◆ WriteFormatted() [2/4]

int DicFile::WriteFormatted ( const std::string &  cifFileName,
TableFile ddl,
ISTable formatP = NULL 
)

Method, not currently part of users public API, and will soon be re-examined.

◆ WriteFormatted() [3/4]

int DicFile::WriteFormatted ( std::ostream &  cifo,
ISTable formatP 
)
protected

◆ WriteFormatted() [4/4]

int DicFile::WriteFormatted ( std::ostream &  cifo,
TableFile ddl,
ISTable formatP 
)
protected

◆ WriteItemAliases() [1/2]

void DicFile::WriteItemAliases ( const std::string &  fileName)

Writes the content of "item_aliases" table to a text file.

Parameters
[in]fileName- relative or absolute name of the text file to which the content of "item_aliases" table is to be written to.
Returns
None
Precondition
None
Postcondition
None
Exceptions

◆ WriteItemAliases() [2/2]

void DicFile::WriteItemAliases ( std::ostream &  cifo)
protected

Member Data Documentation

◆ _formatP

ISTable* DicFile::_formatP
protected

The documentation for this class was generated from the following file: