File: loader.h

package info (click to toggle)
aeskulap 0.2.2-beta2%2Bgit20190406.ef77f01-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 3,736 kB
  • sloc: cpp: 9,213; ansic: 685; makefile: 330; sh: 256; xml: 101
file content (110 lines) | stat: -rw-r--r-- 2,064 bytes parent folder | download | duplicates (4)
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
/*
    Aeskulap ImagePool - DICOM abstraction library
    Copyright (C) 2005  Alexander Pipelka

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

    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Library General Public License for more details.

    You should have received a copy of the GNU Library General Public
    License along with this library; if not, write to the Free
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA

    Alexander Pipelka
*/

#ifndef IMAGEPOOL_LOADER_H
#define IMAGEPOOL_LOADER_H

#include <glibmm.h>
#include <queue>
#include <set>
#include <map>

#include "poolstudy.h"

class DcmDataset;

namespace ImagePool {

class Instance;
class Study;

class Loader {
public:

	Loader();
	
	virtual ~Loader();
	
	bool start();

	void stop();

	bool busy();

	sigc::signal< void, Glib::RefPtr<ImagePool::Study> > signal_study_added;

	Glib::Dispatcher signal_error;

protected:

	class CacheEntry {
	public:

		CacheEntry() : m_instancecount(0), m_seriescount(0) {
		};

		Glib::RefPtr<ImagePool::Study> m_study;

		guint m_instancecount;

		std::set< std::string > m_seriesuid;
		
		guint m_seriescount;

	};

	virtual bool run();
	
	virtual void finished();

	virtual bool on_timeout();

	void add_image(DcmDataset* dset);

	void process_instance();
	
	Glib::Thread* m_loader;

	//Glib::Dispatcher m_add_image;

	//Glib::Dispatcher m_finished;
	
	Glib::Mutex m_mutex;

	bool m_busy;

	std::map<std::string, CacheEntry> m_cache;

	sigc::connection m_conn_timer;

	bool m_finished;

private:

	void thread();
	
	std::queue< Glib::RefPtr<ImagePool::Instance> > m_imagequeue;
	
};

} // namespace ImagePool

#endif // IMAGEPOOL_LOADER_H