2 * File: OutputSection.h
4 * Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
5 * See included license file for license details.
7 #if !defined(_OutputSection_h_)
8 #define _OutputSection_h_
10 #include "Operation.h"
11 #include "smart_ptr.h"
13 #include "OptionContext.h"
19 * @brief Base class for data model of sections of the output file.
24 OutputSection() : m_id(0), m_options(0) {}
25 OutputSection(uint32_t identifier) : m_id(identifier), m_options(0) {}
26 virtual ~OutputSection() {}
28 void setIdentifier(uint32_t identifier) { m_id = identifier; }
29 uint32_t getIdentifier() const { return m_id; }
31 //! \brief Set the option context.
33 //! The output section object will assume ownership of the option context
34 //! and delete it when the section is deleted.
35 inline void setOptions(OptionContext * context) { m_options = context; }
37 //! \brief Return the option context.
38 inline const OptionContext * getOptions() const { return m_options; }
41 uint32_t m_id; //!< Unique identifier.
42 smart_ptr<OptionContext> m_options; //!< Options associated with just this section.
46 * @brief A section of the output that contains boot operations.
48 class OperationSequenceSection : public OutputSection
51 OperationSequenceSection() : OutputSection() {}
52 OperationSequenceSection(uint32_t identifier) : OutputSection(identifier) {}
54 OperationSequence & getSequence() { return m_sequence; }
57 OperationSequence m_sequence;
61 * @brief A section of the output file that contains arbitrary binary data.
63 class BinaryDataSection : public OutputSection, public Blob
66 BinaryDataSection() : OutputSection(), Blob() {}
67 BinaryDataSection(uint32_t identifier) : OutputSection(identifier), Blob() {}
70 }; // namespace elftosb
72 #endif // _OutputSection_h_