summaryrefslogtreecommitdiffstats
path: root/kstars/kstars/stardatasink.h
blob: b655ef8c41039d45765414ef87e218a659cac72f (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
83
84
85
86
87
88
89
90
91
/***************************************************************************
                          stardatasink.h  -  description
                             -------------------
    begin                : Son Feb 10 2002
    copyright            : (C) 2002 by Thomas Kabelmann
    email                : tk78@gmx.de
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   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 STARDATASINK_H
#define STARDATASINK_H


/**@class StarDataSink
	*StarDataSink receives data from an FileSource object and appends these data
	*to a TQList of star data. It's an asynchronous io class.
	*@author Thomas Kabelmann
	*@version 1.0
	*/

#include <tqobject.h>
#include <tqasyncio.h>

#include <tqglobal.h>

class KStarsData;

class StarDataSink : public TQObject, public TQDataSink {
/**
	*class needs signals
	*/
	Q_OBJECT
  TQ_OBJECT

	public:
	/** constructor	*/
		StarDataSink( KStarsData *parent, const char *name=0 );

	/** destructor */
		~StarDataSink();

	/** is this object ready to receive data? */
		int readyToReceive();

	/** end of data transmission reached */
		void eof();

	/**
		*This function receives data from FileSource and appends data
		*to some lists in KStarsData.
		*/
		void receive( const uchar *data, int entries );

	private:

		KStarsData *ksData;

		// has objectnamelist changed while reloading?
		uint nameListCount;

		// counts the number of blocks
		uint receivedBlocks;

	signals:

	/**
		*send signal if all data were transmitted
		*/
		void done();

	/**
		*send signal to update skymap time by time
		*just for long data transmissions needed.
		*/
		void updateSkymap();

	/**
		*If name list has changed emit this signal.
		*/
		void clearCache();
};

#endif