more on states

This commit is contained in:
Martin Brodbeck 2018-07-11 15:59:08 +02:00
parent 976dcbcbeb
commit 4fdbc268a5
2 changed files with 6 additions and 4 deletions

View file

@ -19,7 +19,7 @@ void Entity::createUuidFromString(const std::string& uuidString)
uuid_ = generator(uuidString);
}
inline Entity::State Entity::getState()
inline Entity::State Entity::getState() const
{
return state_;
}

View file

@ -4,17 +4,19 @@
#include <string>
#include <boost/uuid/uuid.hpp>
#include <boost/uuid/uuid_io.hpp>
class Entity
{
public:
enum class State { NEW, UPDATED, READ };
// Entity();
enum class State { NEW, UPDATED, CLEAN };
virtual ~Entity() = 0;
const boost::uuids::uuid& getUuid() const { return uuid_; };
void createUuid();
void createUuidFromString(const std::string& uuidString);
State getState();
virtual State getState() const;
void setState(State state) { state_ = state; }
private:
boost::uuids::uuid uuid_{};