buffer.h

来自「关联规则中转换树算法在VC下的实现」· C头文件 代码 · 共 50 行

H
50
字号
// buffer.h: interface for the buffer class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_BUFFER_H__04B52FD8_FBF1_4A97_9731_14A3B86CFA23__INCLUDED_)
#define AFX_BUFFER_H__04B52FD8_FBF1_4A97_9731_14A3B86CFA23__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#define L2BITS	   0x3   // L2BITS: the two least sig. bits

#define MULTOF		8		// MULTOF: addresses should start at numbers which are divisible by MULTOF 

class memory{   
private:
	int BUFPOS;				//default: 40   number of tries to fetch memory from the OS
	long BUFS_BIG;			//default: 6291456 buffer size
	long BUFS_SMALL;		//default: 2097152 buffer size 
	int BUFSBSWITCH; 		//default:2 switch from small to big */

	char **buffer;
	int bufcount;           /* marks current buffer position */

	char **start;			/* pt to the next free position */

	unsigned int *rest;        /* number of free positions */

	unsigned int *restsize;    /* max. size of buffer */
	char *markbuf;              /* mark for freebuf */
	int markcount;
	unsigned int markrest;
private:
	int switchbuf(unsigned int i);
	void init();
public:
	memory();
	memory(int bufpos, long bufs_small, long bufs_big, int bufsbswitch);
	~memory();		

	void freebuf(unsigned int MR, int MC, char* MB);   //clear the buffer above the mark 
	char * newbuf(unsigned int num,unsigned int size);
	char* bufmark(unsigned int*, int*);
	void buffree();
	bool half(){return BUFPOS/(BUFPOS-bufcount) > 2;}
};

#endif // !defined(AFX_BUFFER_H__04B52FD8_FBF1_4A97_9731_14A3B86CFA23__INCLUDED_)

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?