xref: /haiku/src/apps/debuganalyzer/model_loader/ThreadModelLoader.h (revision ef8252e1e01692d90c627e7c2aaebc05c9d21458)
1ded186e9SIngo Weinhold /*
2ded186e9SIngo Weinhold  * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
3ded186e9SIngo Weinhold  * Distributed under the terms of the MIT License.
4ded186e9SIngo Weinhold  */
5ded186e9SIngo Weinhold #ifndef THREAD_MODEL_LOADER_H
6ded186e9SIngo Weinhold #define THREAD_MODEL_LOADER_H
7ded186e9SIngo Weinhold 
8ded186e9SIngo Weinhold #include "AbstractModelLoader.h"
9ded186e9SIngo Weinhold #include "Model.h"
10ded186e9SIngo Weinhold 
11ded186e9SIngo Weinhold 
12ded186e9SIngo Weinhold class ThreadModel;
13ded186e9SIngo Weinhold 
14ded186e9SIngo Weinhold 
15ded186e9SIngo Weinhold class ThreadModelLoader : public AbstractModelLoader {
16ded186e9SIngo Weinhold public:
17ded186e9SIngo Weinhold 								ThreadModelLoader(Model* model,
18ded186e9SIngo Weinhold 									Model::Thread* thread,
19ded186e9SIngo Weinhold 									const BMessenger& target,
20ded186e9SIngo Weinhold 									void* targetCookie);
21ded186e9SIngo Weinhold 
22ded186e9SIngo Weinhold protected:
23ded186e9SIngo Weinhold 								~ThreadModelLoader();
24ded186e9SIngo Weinhold 
25ded186e9SIngo Weinhold public:
26ded186e9SIngo Weinhold 			ThreadModel*		DetachModel();
27ded186e9SIngo Weinhold 
28ded186e9SIngo Weinhold protected:
29ded186e9SIngo Weinhold 	virtual	status_t			PrepareForLoading();
30ded186e9SIngo Weinhold 	virtual	status_t			Load();
31ded186e9SIngo Weinhold 	virtual	void				FinishLoading(bool success);
32ded186e9SIngo Weinhold 
33ded186e9SIngo Weinhold private:
34*ef8252e1SIngo Weinhold 			// shorthands for the longish structure names
35*ef8252e1SIngo Weinhold 			typedef system_profiler_thread_enqueued_in_run_queue
36*ef8252e1SIngo Weinhold 				thread_enqueued_in_run_queue;
37*ef8252e1SIngo Weinhold 			typedef system_profiler_thread_removed_from_run_queue
38*ef8252e1SIngo Weinhold 				thread_removed_from_run_queue;
39*ef8252e1SIngo Weinhold 
40*ef8252e1SIngo Weinhold private:
41ded186e9SIngo Weinhold 			status_t			_Load();
42ded186e9SIngo Weinhold 
43ded186e9SIngo Weinhold private:
44ded186e9SIngo Weinhold 			Model*				fModel;
45ded186e9SIngo Weinhold 			Model::Thread*		fThread;
46ded186e9SIngo Weinhold 			ThreadModel*		fThreadModel;
47ded186e9SIngo Weinhold };
48ded186e9SIngo Weinhold 
49ded186e9SIngo Weinhold 
50ded186e9SIngo Weinhold #endif	// THREAD_MODEL_LOADER_H
51