2019-11-22 11:57:17 +00:00
|
|
|
#ifndef BUILDERS
|
|
|
|
#define BUILDERS
|
|
|
|
|
|
|
|
#include <IBuilder.hpp>
|
|
|
|
#include <sstream>
|
|
|
|
#include <Peripheral.hpp>
|
|
|
|
#include <sstream>
|
|
|
|
|
|
|
|
struct ZeroPointerBuilder : public IBuilder{
|
2019-11-22 14:22:52 +00:00
|
|
|
void build(std::stringstream& ss) const final;
|
2019-11-22 11:57:17 +00:00
|
|
|
};
|
|
|
|
|
2019-12-02 09:10:29 +00:00
|
|
|
struct FieldDefineBuilder : public IBuilder{
|
|
|
|
void build(std::stringstream& ss) const final;
|
|
|
|
};
|
|
|
|
|
2019-11-22 11:57:17 +00:00
|
|
|
struct PeripheralBuilder : public IBuilder{
|
2019-11-22 14:22:52 +00:00
|
|
|
PeripheralBuilder(const Peripheral &peripheral_) : peripheral(peripheral_) {}
|
|
|
|
void build(std::stringstream& ss) const final;
|
2019-11-22 11:57:17 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
const Peripheral& peripheral;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct RegisterBuilder : public IBuilder{
|
2019-11-22 14:22:52 +00:00
|
|
|
RegisterBuilder(const Register& register_, const unsigned int baseAddress_)
|
|
|
|
: registe(register_), baseAddress(baseAddress_) {}
|
|
|
|
void build(std::stringstream& ss) const final;
|
|
|
|
unsigned int getRegisterAddress() const;
|
2019-11-22 11:57:17 +00:00
|
|
|
private:
|
|
|
|
const Register& registe;
|
2019-11-22 14:22:52 +00:00
|
|
|
const unsigned int baseAddress;
|
2019-11-22 11:57:17 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct FieldBuilder : public IBuilder{
|
2019-11-22 14:22:52 +00:00
|
|
|
FieldBuilder(const Field& field_, const unsigned int registerAddress_)
|
|
|
|
: field(field_), registerAddress(registerAddress_) {}
|
|
|
|
void build(std::stringstream& ss) const final;
|
2019-12-02 09:10:29 +00:00
|
|
|
unsigned int getAddress() const;
|
2019-11-22 11:57:17 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
const Field& field;
|
2019-11-22 14:22:52 +00:00
|
|
|
const unsigned int registerAddress;
|
2019-11-22 11:57:17 +00:00
|
|
|
};
|
2019-12-02 09:10:29 +00:00
|
|
|
|
|
|
|
struct FunctionsBuilder : public IBuilder{
|
|
|
|
void build(std::stringstream& ss) const final;
|
|
|
|
};
|
|
|
|
|
2019-11-22 11:57:17 +00:00
|
|
|
#endif
|