File: mem_disk_file.h

package info (click to toggle)
kmc 3.1.1%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 2,376 kB
  • sloc: cpp: 33,006; python: 372; perl: 178; makefile: 135; sh: 34
file content (45 lines) | stat: -rw-r--r-- 1,127 bytes parent folder | download
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
/*
  This file is a part of KMC software distributed under GNU GPL 3 licence.
  The homepage of the KMC project is http://sun.aei.polsl.pl/kmc
  
  Authors: Sebastian Deorowicz, Agnieszka Debudaj-Grabysz, Marek Kokot
  
  Version: 3.1.1
  Date   : 2019-05-19
*/

#ifndef _MEM_DISK_FILE_H
#define _MEM_DISK_FILE_H

#include "defs.h"
#include <string>
#include <stdio.h>
#include <vector>
using namespace std;


//************************************************************************************************************
// CMemDiskFile - wrapper for FILE* or memory equivalent
//************************************************************************************************************
class CMemDiskFile
{
	bool memory_mode;
	FILE* file;
	typedef pair<uchar*, uint64> elem_t;//buf,size
	typedef vector<elem_t> container_t;

	container_t container;
	string name;
public:
	CMemDiskFile(bool _memory_mode);
	void Open(const string& f_name);
	void Rewind();
	int Close();
	size_t Read(uchar * ptr, size_t size, size_t count);
	size_t Write(const uchar * ptr, size_t size, size_t count);
	void Remove();
};

#endif

// ***** EOF