summaryrefslogtreecommitdiffstats
path: root/knights/io_engine.h
blob: a2638623f2c708f0744f20aab013bf5cd82e023c (plain)
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/***************************************************************************
                          io_engine.h  -  description
                             -------------------
    begin                : Sat Jun 30 2001
    copyright            : (C) 2003 by Troy Corbin Jr.
    email                : tcorbin@users.sourceforge.net
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef IO_ENGINE_H
#define IO_ENGINE_H

#include <tqstring.h>
#include <tqvaluelist.h>
#include "io_base.h"

/**
  *@author Troy Corbin Jr.
  */

class TQFile;
class KProcess;
class resource;
class proto_base;

class io_engine : public io_base
{
  Q_OBJECT
  TQ_OBJECT
	public:
													io_engine( TQWidget *tqparent=NULL, resource *Rsrc=0 );
													~io_engine();

		void									Start( const int side );

	public slots:
		virtual void					recvCMD( const Command& command );
		void									recvProtoCMD( const Command& command );
		void									SendClear( KProcess* );
		void									Recv( KProcess*, char*, int );

	signals:
		virtual void					sendCMD(const Command& command);

	protected slots:
		void									sendToChild( void );
		void									WriteFIFO( const TQString &Data );

	protected:
		void									Kill( void );

	private:

		engineList::Iterator	IT;
		proto_base						*proto;

		/* States */
		bool									SafeToSend;
		bool									SendSIGINT;
		bool									CleanBuffer;
		bool									Forced;

		/* References */
		TQFile									*Log;
		int										Protocol;
		ChessMove							Move;

		/* Data */
		KProcess							*engine;
		TQString								FIFO_In;
		TQString								FIFO_Out;
};

#endif