summaryrefslogtreecommitdiffstats
path: root/common/DataSourceImager.h
blob: 00e61df3ff56dcd3837c9d51115685d443002309 (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
/*
 * File:	DataSourceImager.h
 *
 * Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
 * See included license file for license details.
 */
#if !defined(_DataSourceImager_h_)
#define _DataSourceImager_h_

#include "Blob.h"
#include "DataSource.h"

namespace elftosb {

/*!
 * \brief Converts a DataSource into a single binary buffer.
 */
class DataSourceImager : public Blob
{
public:
	//! \brief Constructor.
	DataSourceImager();
	
	//! \name Setup
	//@{
	void setBaseAddress(uint32_t address);
	void setFillPattern(uint8_t pattern);
	//@}
	
	void reset();
	
	//! \name Accessors
	//@{
	uint32_t getBaseAddress() { return m_baseAddress; }
	//@}
	
	//! \name Operations
	//@{
	//! \brief Adds all of the segments of which \a dataSource is composed.
	void addDataSource(DataSource * source);
	
	//! \brief Adds the data from one data segment.
	void addDataSegment(DataSource::Segment * segment);
	//@}

protected:
	uint8_t m_fill;
	uint32_t m_baseAddress;
	bool m_isBaseAddressSet;
};

};

#endif // _DataSourceImager_h_