2018-07-05 16:29:43 +02:00
|
|
|
#ifndef ENTITY_H
|
|
|
|
#define ENTITY_H
|
|
|
|
|
2018-07-06 10:54:44 +02:00
|
|
|
#include <string>
|
|
|
|
|
|
|
|
#include <boost/uuid/uuid.hpp>
|
2018-07-11 15:59:08 +02:00
|
|
|
#include <boost/uuid/uuid_io.hpp>
|
2018-07-06 10:54:44 +02:00
|
|
|
|
2018-07-05 16:29:43 +02:00
|
|
|
class Entity
|
|
|
|
{
|
2018-07-09 13:03:25 +02:00
|
|
|
public:
|
2018-07-12 12:18:51 +02:00
|
|
|
enum class State { NEW, UPDATE, DELETE, OK };
|
2018-07-11 15:59:08 +02:00
|
|
|
|
2018-07-20 11:52:26 +02:00
|
|
|
//Entity() = default;
|
2018-07-09 20:51:33 +02:00
|
|
|
virtual ~Entity() = 0;
|
2018-07-13 13:05:36 +02:00
|
|
|
|
2018-07-09 13:03:25 +02:00
|
|
|
void createUuid();
|
2018-07-12 14:38:22 +02:00
|
|
|
void setUuidFromString(const std::string& uuidString);
|
2018-07-11 15:59:08 +02:00
|
|
|
void setState(State state) { state_ = state; }
|
2018-07-13 13:05:36 +02:00
|
|
|
void setSourceNo(int sourceNo);
|
|
|
|
|
|
|
|
const boost::uuids::uuid& getUuid() const { return uuid_; };
|
2018-07-16 12:00:17 +02:00
|
|
|
std::string getUuidAsString() const { return boost::uuids::to_string(uuid_); }
|
2018-07-13 13:05:36 +02:00
|
|
|
virtual State getState() const;
|
|
|
|
virtual int getSourceNo() const;
|
2018-07-09 13:03:25 +02:00
|
|
|
|
|
|
|
private:
|
2018-07-10 12:51:03 +02:00
|
|
|
boost::uuids::uuid uuid_{};
|
|
|
|
State state_{State::NEW};
|
2018-07-13 13:05:36 +02:00
|
|
|
int sourceNo_{};
|
2018-07-05 16:29:43 +02:00
|
|
|
};
|
|
|
|
|
2018-07-09 13:03:25 +02:00
|
|
|
#endif // ENTITY_H
|