xref: /netbsd-src/external/bsd/elftosb/dist/common/DataSourceImager.h (revision 993229b6fea628ff8b1fa09146c80b0cfb2768eb)
1 /*
2  * File:	DataSourceImager.h
3  *
4  * Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
5  * See included license file for license details.
6  */
7 #if !defined(_DataSourceImager_h_)
8 #define _DataSourceImager_h_
9 
10 #include "Blob.h"
11 #include "DataSource.h"
12 
13 namespace elftosb {
14 
15 /*!
16  * \brief Converts a DataSource into a single binary buffer.
17  */
18 class DataSourceImager : public Blob
19 {
20 public:
21 	//! \brief Constructor.
22 	DataSourceImager();
23 
24 	//! \name Setup
25 	//@{
26 	void setBaseAddress(uint32_t address);
27 	void setFillPattern(uint8_t pattern);
28 	//@}
29 
30 	void reset();
31 
32 	//! \name Accessors
33 	//@{
getBaseAddress()34 	uint32_t getBaseAddress() { return m_baseAddress; }
35 	//@}
36 
37 	//! \name Operations
38 	//@{
39 	//! \brief Adds all of the segments of which \a dataSource is composed.
40 	void addDataSource(DataSource * source);
41 
42 	//! \brief Adds the data from one data segment.
43 	void addDataSegment(DataSource::Segment * segment);
44 	//@}
45 
46 protected:
47 	uint8_t m_fill;
48 	uint32_t m_baseAddress;
49 	bool m_isBaseAddressSet;
50 };
51 
52 };
53 
54 #endif // _DataSourceImager_h_
55