1 /* 2 * File: BootImage.h 3 * 4 * Copyright (c) Freescale Semiconductor, Inc. All rights reserved. 5 * See included license file for license details. 6 */ 7 #if !defined(_BootImage_h_) 8 #define _BootImage_h_ 9 10 #include <iostream> 11 #include "Version.h" 12 13 namespace elftosb 14 { 15 16 /*! 17 * \brief Abstract base class for all boot image format classes. 18 * 19 * Provides virtual methods for all of the common features between different 20 * boot image formats. These are the product and component version numbers 21 * and the drive tag. 22 * 23 * Also provided is the virtual method writeToStream() that lets the caller 24 * stream out the boot image without knowing the underlying format type. 25 */ 26 class BootImage 27 { 28 public: 29 //! \brief Constructor. BootImage()30 BootImage() {} 31 32 //! \brief Destructor. ~BootImage()33 virtual ~BootImage() {} 34 35 //! \name Versions 36 //@{ 37 virtual void setProductVersion(const version_t & version)=0; 38 virtual void setComponentVersion(const version_t & version)=0; 39 //@} 40 41 //! \brief Specify the drive tag to be set in the output file header. 42 virtual void setDriveTag(uint16_t tag)=0; 43 44 //! \brief Returns a string containing the preferred file extension for image format. 45 virtual std::string getFileExtension() const=0; 46 47 //! \brief Write the boot image to an output stream. 48 virtual void writeToStream(std::ostream & stream)=0; 49 }; 50 51 }; // namespace elftosb 52 53 #endif // _BootImage_h_ 54 55