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