Category : C Source Code
Archive   : AETSK101.ZIP
Filename : SYSQVFNC.H

 
Output of file : SYSQVFNC.H contained in archive : AETSK101.ZIP
/*
sysqvfnc.h

queues of objects of type Qable

copyright (c) 1991 J. Alan Eldridge

history:

< from sysqtmpl.h -- the template version >

10/28/91 created

10/30/91 changed class hierarchy so we now have:

SysQ queue of Ts
SysPriQ priority queue of Ts
SysQP queue of ptrs to T
SysPriQP priority queue of ptrs to T

11/08/91 created this virtual function version...
this has only classes SysQP and SysPriQP
*/

/*
in the virtual function version of SysQ, anything that can
be put on a queue must define operator <, so it can be put
on a priority queue... gotta impose rules>
*/

class Qable {
private:
// nothing right now
public:
virtual int operator<(Qable &) = 0;
};

struct SysQNode {
Qable *data;
SysQNode *next;
SysQNode *prev;
};

class SysQP {
protected:
int nused, nfree, maxnodes;
SysQNode *head, *tail, *free;

SysQNode *getfree(int=1);
void putfree(SysQNode*);

SysQNode *findnode(Qable*);
virtual SysQNode *findpred(Qable*);

void create(SysQNode*);
void insert(SysQNode*, SysQNode*);

int Ins(Qable*);
int Get(Qable* &,int rmv=1);
public:
SysQP(int n=0, int lim=INT_MAX);
virtual ~SysQP();
int Add(Qable*);
int Del(Qable*);
Qable* Get(int rmv=1);
int Cnt()
{ return nused; }
int Max()
{ return maxnodes; }
};

class SysPriQP: public SysQP {
public:
SysPriQP(int n=0,int lim=INT_MAX): SysQP(n,lim)
{ }
int Add(Qable *t)
{ return SysQP::Ins(t); }
};



  3 Responses to “Category : C Source Code
Archive   : AETSK101.ZIP
Filename : SYSQVFNC.H

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/