File: DicFile.h

package info (click to toggle)
librcsb-core-wrapper 1.005-13
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 16,576 kB
  • sloc: xml: 122,915; cpp: 25,250; ansic: 3,736; makefile: 1,033; sh: 772; lex: 294; yacc: 235; perl: 213; python: 121; csh: 30
file content (180 lines) | stat: -rw-r--r-- 5,484 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
//$$FILE$$
//$$VERSION$$
//$$DATE$$
//$$LICENSE$$


/*!
** \file DicFile.h
**
** \brief Header file for DicFile class.
*/


#ifndef DICFILE_H
#define DICFILE_H


#include <string>
#include <iostream>

#include "GenString.h"
#include "ISTable.h"
#include "CifFile.h"


/**
**  \class DicFile
**
**  \brief Public class that represents a dictionary file, composed of
**    blocks with tables.
**
**  This class represents a dictionary file. In addition to inherited methods
**  from \e CifFile class, this class provides a method for writing the
**  content of "item_aliases" table to a text file.
*/
class DicFile : public CifFile
{
  public:
    using CifFile::Write;

    /**
    **  Constructs a dictionary file.
    **
    **  \param[in] fileMode - dictionary file mode. Possible values are
    **    read-only, create, update and virtual. Detailed description of
    **    file mode is given in \e TableFile documentation.
    **  \param[in] fileName - relative or absolute name of the file
    **    where object persistency is maintained. If \e fileMode specifies
    **    virtual mode, this parameter is ignored.
    **  \param[in] verbose - optional parameter that indicates whether
    **    logging should be turned on (if true) or off (if false).
    **    If \e verbose is not specified, logging is turned off.
    **  \param[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.
    **  \param[in] maxLineLength - optional parameter that indicates the
    **    maximum number of written characters in one line in the written
    **    text file. If not specified, \e STD_CIF_LINE_LENGTH is used.
    **  \param[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, \e CifString::UnknownValue is used.
    **
    **  \return Not applicable
    **
    **  \pre None
    **
    **  \post None
    **
    **  \exception: None
    */
    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 in virtual mode.
    **
    **  \param[in] verbose - optional parameter that indicates whether
    **    logging should be turned on (if true) or off (if false).
    **    If \e verbose is not specified, logging is turned off.
    **  \param[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.
    **  \param[in] maxLineLength - optional parameter that indicates the
    **    maximum number of written characters in one line in the written
    **    text file. If not specified, \e STD_CIF_LINE_LENGTH is used.
    **  \param[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, \e CifString::UnknownValue is used.
    **
    **  \return Not applicable
    **
    **  \pre None
    **
    **  \post None
    **
    **  \exception: None
    */
    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);

    /**
    **  Destructs a dictionary file, by releasing all consumed resources.
    **
    **  \param: Not applicable
    **
    **  \return Not applicable
    **
    **  \pre None
    **
    **  \post None
    **
    **  \exception: None
    */
    ~DicFile();

    /**
    **  Writes the content of "item_aliases" table to a text file.
    **
    **  \param[in] fileName - relative or absolute name of the text file
    **    to which the content of "item_aliases" table is to be written to.
    **
    **  \return None
    **
    **  \pre None
    **
    **  \post None
    **
    **  \exception: None
    */
    void WriteItemAliases(const std::string& fileName);


    /**
    **  Method, not currently part of users public API, and will soon be
    **  re-examined.
    */
    ISTable* GetFormatTable();
 
    /**
    **  Method, not currently part of users public API, and will soon be
    **  re-examined.
    */
    int WriteFormatted(const std::string& cifFileName, ISTable* formatP = NULL);

    /**
    **  Method, not currently part of users public API, and will soon be
    **  re-examined.
    */
    int WriteFormatted(const std::string& cifFileName, TableFile* ddl,
      ISTable* formatP = NULL);

    /**
    **  Method, not currently part of users public API, and will soon be
    **  re-examined.
    */
    void Compress(CifFile* ddl);

    CifFile* GetRefFile();

  protected:
    ISTable* _formatP;

    int WriteFormatted(std::ostream& cifo, ISTable* formatP);
    int WriteFormatted(std::ostream& cifo, TableFile* ddl, ISTable* formatP);

    void WriteItemAliases(std::ostream& cifo);

  private:
    void AddRefRow(ISTable& table, const char* first, const char* second, 
      const char* third);
};

#endif