NCBI C++ ToolKit
seq_masker_ostat_opt_bin.hpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /* $Id: seq_masker_ostat_opt_bin.hpp 66705 2015-03-19 14:07:19Z morgulis $
2  * ===========================================================================
3  *
4  * PUBLIC DOMAIN NOTICE
5  * National Center for Biotechnology Information
6  *
7  * This software/database is a "United States Government Work" under the
8  * terms of the United States Copyright Act. It was written as part of
9  * the author's official duties as a United States Government employee and
10  * thus cannot be copyrighted. This software/database is freely available
11  * to the public for use. The National Library of Medicine and the U.S.
12  * Government have not placed any restriction on its use or reproduction.
13  *
14  * Although all reasonable efforts have been taken to ensure the accuracy
15  * and reliability of the software and data, the NLM and the U.S.
16  * Government do not and cannot warrant the performance or results that
17  * may be obtained by using this software or data. The NLM and the U.S.
18  * Government disclaim all warranties, express or implied, including
19  * warranties of performance, merchantability or fitness for any particular
20  * purpose.
21  *
22  * Please cite the author in any work or product based on this material.
23  *
24  * ===========================================================================
25  *
26  * Author: Aleksandr Morgulis
27  *
28  * File Description:
29  * Definition of CSeqMaskerOStatOptBin class.
30  *
31  */
32 
33 #ifndef C_SEQ_MASKER_OSTATE_BIN_H
34 #define C_SEQ_MASKER_OSTATE_BIN_H
35 
37 
39 
40 /**
41  **\brief This class is responsible for saving optimized unit counts
42  ** in binary format.
43  **/
46 {
47  public:
48 
49  /// Format version.
51 
52  /**
53  **\brief Object constructor.
54  **\param name output file name
55  **\param sz requested upper limit on the size of the data structure
56  ** (forwarded to CSeqMaskerOstatOpt)
57  **\param use_ba use bit array optimization
58  **/
59  explicit CSeqMaskerOstatOptBin(
60  const string & name, Uint2 sz, bool use_ba,
61  string const & metadata );
62 
63  /**
64  **\brief Object constructor.
65  **\param os the output stream
66  **\param sz requested upper limit on the size of the data structure
67  ** (forwarded to CSeqMaskerOstatOpt)
68  **\param use_ba use bit array optimization
69  **/
70  explicit CSeqMaskerOstatOptBin(
71  CNcbiOstream & os, Uint2 sz, bool use_ba,
72  string const & metadata );
73 
74  /**
75  **\brief Object destructor.
76  **/
78 
79  /** Get actual counts format version. */
80  virtual CSeqMaskerVersion const & GetStatFmtVersion() const {
81  return FormatVersion;
82  }
83 
84  protected:
85 
86  /**
87  **\brief Write optimized data to the output stream.
88  **\param p structure containing the hash table and threshold
89  ** parameters and pointers to data tables
90  **/
91  virtual void write_out( const params & ) const;
92 
93  private:
94 
95  /**\internal
96  **\brief Write a 4-byte unsigned integer to the output stream.
97  **\param word the integer to write
98  **/
99  void write_word( Uint4 word ) const
100  {
101  out_stream.write(
102  reinterpret_cast< const char * >(&word), sizeof( Uint4 ) );
103  }
104 
105  /**\internal
106  **\brief Use bit array optimization.
107  **/
108  bool use_ba;
109 };
110 
112 
113 #endif
This class is responsible for saving optimized unit counts in binary format.
virtual ~CSeqMaskerOstatOptBin()
Object destructor.
virtual CSeqMaskerVersion const & GetStatFmtVersion() const
Get actual counts format version.
static CSeqMaskerVersion FormatVersion
Format version.
void write_word(Uint4 word) const
Class responsible for collecting unit counts statistics and representing it in optimized hash-based f...
virtual void write_out(const params &p) const =0
Dump the unit counts data to the output stream according to the requested format.
uint32_t Uint4
4-byte (32-bit) unsigned integer
Definition: ncbitype.h:103
uint16_t Uint2
2-byte (16-bit) unsigned integer
Definition: ncbitype.h:101
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
IO_PREFIX::ostream CNcbiOstream
Portable alias for ostream.
Definition: ncbistre.hpp:149
#define NCBI_XALGOWINMASK_EXPORT
Definition: ncbi_export.h:1033
Modified on Thu May 30 12:23:18 2024 by modify_doxy.py rev. 669887