1/*
2 * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
3 * Distributed under the terms of the MIT License.
4 */
5#ifndef IMAGE_H
6#define IMAGE_H
7
8#include <image.h>
9
10#include <Referenceable.h>
11#include <util/DoublyLinkedList.h>
12
13#include "ImageInfo.h"
14
15
16enum image_debug_info_state {
17	IMAGE_DEBUG_INFO_NOT_LOADED,
18	IMAGE_DEBUG_INFO_LOADING,
19	IMAGE_DEBUG_INFO_LOADED,
20	IMAGE_DEBUG_INFO_UNAVAILABLE
21};
22
23
24class ImageDebugInfo;
25class LocatableFile;
26class Team;
27
28
29class Image : public BReferenceable, public DoublyLinkedListLinkImpl<Image> {
30public:
31								Image(Team* team, const ImageInfo& imageInfo,
32									LocatableFile* imageFile);
33								~Image();
34
35			status_t			Init();
36
37			Team*				GetTeam() const		{ return fTeam; }
38			image_id			ID() const			{ return fInfo.ImageID(); }
39			const BString&		Name() const		{ return fInfo.Name(); }
40			const ImageInfo&	Info() const		{ return fInfo; }
41			image_type			Type() const		{ return fInfo.Type(); }
42			LocatableFile*		ImageFile() const	{ return fImageFile; }
43
44			bool				ContainsAddress(target_addr_t address) const;
45
46			// mutable attributes follow (locking required)
47			ImageDebugInfo*		GetImageDebugInfo() const { return fDebugInfo; }
48			image_debug_info_state ImageDebugInfoState() const
49									{ return fDebugInfoState; }
50			status_t			SetImageDebugInfo(ImageDebugInfo* debugInfo,
51									image_debug_info_state state);
52
53private:
54			Team*				fTeam;
55			ImageInfo			fInfo;
56			LocatableFile*		fImageFile;
57			// mutable
58			ImageDebugInfo*		fDebugInfo;
59			image_debug_info_state fDebugInfoState;
60};
61
62
63typedef DoublyLinkedList<Image> ImageList;
64
65
66#endif	// IMAGE_H
67