svd2cpp/Src/Builders.hpp

51 lines
1.4 KiB
C++
Raw Normal View History

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{
void build(std::stringstream& ss) const final;
2019-11-22 11:57:17 +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{
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{
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;
const unsigned int baseAddress;
2019-11-22 11:57:17 +00:00
};
struct FieldBuilder : public IBuilder{
FieldBuilder(const Field& field_, const unsigned int registerAddress_)
: field(field_), registerAddress(registerAddress_) {}
void build(std::stringstream& ss) const final;
unsigned int getAddress() const;
2019-11-22 11:57:17 +00:00
private:
const Field& field;
const unsigned int registerAddress;
2019-11-22 11:57:17 +00:00
};
struct FunctionsBuilder : public IBuilder{
void build(std::stringstream& ss) const final;
};
2019-11-22 11:57:17 +00:00
#endif