Matrix Science Mascot Parser toolkit
 
Loading...
Searching...
No Matches
ms_cache_file.hpp
1/*
2##############################################################################
3# file: ms_cache_file.hpp #
4# 'msparser' toolkit #
5# Used internally in Mascot Parser as well as being available externally #
6# #
7##############################################################################
8# COPYRIGHT NOTICE #
9# Copyright 1998-2013 Matrix Science Limited All Rights Reserved. #
10# #
11##############################################################################
12# $Archive:: $
13# $Author: villek@matrixscience.com $
14# $Date: 2023-02-02 13:47:30 +0000 $
15# $Revision: a80892d71615baa5079d40d1461ed9c24e3bffff | MSPARSER_REL_3_0_0-2024-09-24-0-g93ebaeb4f4 $
16# $NoKeywords:: $
17##############################################################################
18*/
19
20#ifndef MS_CACHE_FILE_HPP
21#define MS_CACHE_FILE_HPP
22
23
24
25// Includes from the standard template library
26#include <map>
27#include <string>
28
29#ifndef SWIG
30 // Helper class - don't use from outside library
31
32namespace matrix_science {
33
39 class ms_cache_stream;
40
41 // internal
42 struct ms_cache_record
43 {
44 UINT64 position;
45 unsigned length;
46
47 inline ms_cache_record()
48 {
49 position = 0;
50 length = 0;
51 }
52 };
53
54 // internal
55 class MS_MASCOTRESFILE_API ms_cache_file :
56 public ms_errors
57 {
58 public:
59 static const unsigned OPEN_FLAG_READ_ONLY = 1;
60
61 public:
62 ms_cache_file();
63 ~ms_cache_file();
64
65 bool open(const std::string & filename, unsigned flags = 0);
66 void close();
67 bool save();
68
69 bool readStream(ms_cache_stream * stream);
70 bool writeStream(ms_cache_stream * stream);
71 bool deleteStream(ms_cache_stream * stream);
72
73 std::string getFileName() const { return filename_; }
74
75 private:
76 //Do not copy this object
77 ms_cache_file(const ms_cache_file & src);
78 ms_cache_file& operator=(const ms_cache_file & right);
79
80 UINT64 appendPos_;
81 INT64 lastAssignedId_;
82 unsigned flags_;
83 std::string filename_;
84 FILE * fileHandle_;
85 unsigned version_;
86 std::map<INT64, ms_cache_record> recordMap_;
87 bool open_;
88 }; // end of tools_group
90} // matrix_science
91
92#endif // SWIG
93
94#endif // MS_CACHE_FILE_HPP
95
96/*------------------------------- End of File -------------------------------*/