From a33b9896b3897dfa47118f4612e41e5266807b0c Mon Sep 17 00:00:00 2001 From: Martin Brodbeck Date: Fri, 4 Oct 2019 15:22:15 +0200 Subject: [PATCH] Add entity files to git --- src/core/entity.cpp | 27 --------------------------- src/core/entity.h | 27 ++++----------------------- src/core/entityint.cpp | 5 +++++ src/core/entityint.h | 16 ++++++++++++++++ 4 files changed, 25 insertions(+), 50 deletions(-) create mode 100644 src/core/entityint.cpp create mode 100644 src/core/entityint.h diff --git a/src/core/entity.cpp b/src/core/entity.cpp index 8caa834..4a8cfb4 100644 --- a/src/core/entity.cpp +++ b/src/core/entity.cpp @@ -1,33 +1,6 @@ #include "entity.h" -#include - -#include -#include - -Entity::~Entity() = default; - -void Entity::createUuid() -{ - static boost::uuids::random_generator generator{}; - uuid_ = generator(); -} - -void Entity::setUuidFromString(const std::string& uuidString) -{ - boost::uuids::string_generator generator{}; - uuid_ = generator(uuidString); -} - Entity::State Entity::getState() const { return state_; } - -void Entity::setSourceNo(int sourceNo) { - sourceNo_ = sourceNo; -} - -int Entity::getSourceNo() const { - return sourceNo_; -} \ No newline at end of file diff --git a/src/core/entity.h b/src/core/entity.h index 017b6e0..68b3ba7 100644 --- a/src/core/entity.h +++ b/src/core/entity.h @@ -1,35 +1,16 @@ #ifndef ENTITY_H #define ENTITY_H -#include - -#include -#include - class Entity { - public: +public: enum class State { NEW, UPDATE, DELETE, OK }; - - // Entity() = default; - virtual ~Entity() = 0; - - void createUuid(); - void setUuidFromString(const std::string& uuidString); + //virtual ~Entity() = 0; void setState(State state) { state_ = state; } - void setSourceNo(int sourceNo); - - const boost::uuids::uuid& getUuid() const { return uuid_; }; - std::string getUuidAsString() const { return boost::uuids::to_string(uuid_); } virtual State getState() const; - virtual int getSourceNo() const; - protected: - int sourceNo_{}; - - private: - boost::uuids::uuid uuid_{}; +private: State state_{State::NEW}; }; -#endif // ENTITY_H \ No newline at end of file +#endif // ENTITY_H diff --git a/src/core/entityint.cpp b/src/core/entityint.cpp new file mode 100644 index 0000000..ba8c356 --- /dev/null +++ b/src/core/entityint.cpp @@ -0,0 +1,5 @@ +#include "entityint.h" + +void EntityInt::setId(int id) { + id_ = id; +} diff --git a/src/core/entityint.h b/src/core/entityint.h new file mode 100644 index 0000000..1a1cf59 --- /dev/null +++ b/src/core/entityint.h @@ -0,0 +1,16 @@ +#ifndef ENTITY_INT_H +#define ENTITY_INT_H + +#include "entity.h" + +class EntityInt : public Entity +{ +public: + void setId(int id); + int getId() const {return id_;}; + +protected: + int id_{}; +}; + +#endif // ENTITY_INT_H