Add storage entity

This commit is contained in:
Andrew nuark G 2020-12-15 16:49:48 +07:00
parent b1333c74a5
commit d00ec79847
3 changed files with 51 additions and 0 deletions

View file

@ -0,0 +1,21 @@
#include "storage_entity.h"
unsigned long long storage_entity::__global_id = 0;
storage_entity::storage_entity(unsigned int capacity) : _capacity(capacity) {
this->_id = storage_entity::__global_id++;
}
unsigned long long storage_entity::id() {
return this->_id;
}
unsigned int storage_entity::capacity() {
return this->_capacity;
}
const QVector<cargo_entity> storage_entity::cargo() {
return this->_cargo;
}

28
entities/storage_entity.h Normal file
View file

@ -0,0 +1,28 @@
#ifndef STORAGE_ENTITY_H
#define STORAGE_ENTITY_H
#include "cargo_entity.h"
#include <QVector>
#include <QCryptographicHash>
class storage_entity
{
private:
static unsigned long long __global_id;
unsigned long long _id;
unsigned int _capacity;
QVector<cargo_entity> _cargo;
public:
storage_entity() = default;
storage_entity(unsigned int capacity);
unsigned long long id();
unsigned int capacity();
const QVector<cargo_entity> cargo();
};
#endif // STORAGE_ENTITY_H

View file

@ -14,6 +14,7 @@ SOURCES += \
deliverypointeditdialog.cpp \ deliverypointeditdialog.cpp \
entities/cargo_entity.cpp \ entities/cargo_entity.cpp \
entities/dpoint_entity.cpp \ entities/dpoint_entity.cpp \
entities/storage_entity.cpp \
main.cpp \ main.cpp \
storageeditdialog.cpp \ storageeditdialog.cpp \
usereditdialog.cpp \ usereditdialog.cpp \
@ -25,6 +26,7 @@ HEADERS += \
deliverypointeditdialog.h \ deliverypointeditdialog.h \
entities/cargo_entity.h \ entities/cargo_entity.h \
entities/dpoint_entity.h \ entities/dpoint_entity.h \
entities/storage_entity.h \
storageeditdialog.h \ storageeditdialog.h \
usereditdialog.h \ usereditdialog.h \
vesseleditdialog.h vesseleditdialog.h