diff --git a/sea_transport/system/apparatus.h b/sea_transport/system/apparatus.h index ff628e8..7464395 100644 --- a/sea_transport/system/apparatus.h +++ b/sea_transport/system/apparatus.h @@ -12,28 +12,85 @@ #include +/** + * @brief Main system class + * + */ class apparatus { private: + //! Static pointer instance static apparatus *_instance; + //! Static path to save file static const QString filename; + //! Pointer to users subsystem auth_system* _auth_system; + //! Pointer to objects subsystem object_system* _object_system; public: + /** + * @brief Construct a new apparatus object + * + */ explicit apparatus(); + /** + * @brief Destroy the apparatus object + * + */ ~apparatus(); + /** + * @brief Get the auth subsystem object + * + * @return auth_system* + */ auth_system* get_auth_subsystem(); + /** + * @brief Get the object subsystem object + * + * @return object_system* + */ object_system* get_object_subsystem(); + /** + * @brief Saves system data to disk + * + */ void save(); + /** + * @brief Loads system data from disk + * + */ void load(); + /** + * @brief Checks if it is first run + * + * @return true + * @return false + */ static bool is_first_run(); + /** + * @brief Generates lock file after initialization + * + */ static void generate_lock_file(); + /** + * @brief Get ther main system object + * + * @return apparatus* + */ static apparatus* instance(); + /** + * @brief Initializes system on start + * + */ static void init(); + /** + * @brief Shuts system down in the end + * + */ static void shutdown(); }; diff --git a/sea_transport/system/auth_system.h b/sea_transport/system/auth_system.h index 8d0d3bf..adabce6 100644 --- a/sea_transport/system/auth_system.h +++ b/sea_transport/system/auth_system.h @@ -6,19 +6,66 @@ #include "../entities/user_entity.h" +/** + * @brief User's manipulation subsystem + * + */ class auth_system { private: + //! Subsystem's users collection QVector _users; public: + /** + * @brief Construct a new auth system object + * + */ auth_system() = default; + /** + * @brief Get user + * + * @param login user's login + * @param success operation success reference + * @return user_entity* + */ user_entity* get_user(const QString &login, bool &success); + /** + * @brief Remove user from subsystem + * + * @param login user's login + * @return true + * @return false + */ bool remove_user(const QString &login); + /** + * @brief Registeer new user in system + * + * @param login new user's login + * @param password new usere's password + * @param role new user's role + * @return true + * @return false + */ bool register_user(const QString &login, const QString &password, UserRole role); + /** + * @brief Get subsystem immutable users collection + * + * @return const QVector& + */ const QVector& users() const; + /** + * @brief Reads subsytem's data from disk + * + * @param stream read stream + */ void deserialize_data(QDataStream *stream); + /** + * @brief Writes subsytem's data to disk + * + * @param stream write stream + */ void serialize_data(QDataStream *stream); }; diff --git a/sea_transport/system/object_system.h b/sea_transport/system/object_system.h index 40d09f1..f7a973f 100644 --- a/sea_transport/system/object_system.h +++ b/sea_transport/system/object_system.h @@ -7,27 +7,99 @@ #include "../entities/vessel_entity.h" +/** + * @brief Object's manipulation subsystem + * + */ class object_system { private: + //! Subsystem's DP collection QVector _dpoints; + //! Subsystem's vessels collection QVector _vessels; public: + /** + * @brief Construct a new object system object + * + */ object_system() = default; + /** + * @brief Get DP object + * + * @param oid DP's ID + * @param success operation success reference + * @return dpoint_entity* + */ dpoint_entity* get_dpoint(entity_id oid, bool &success); + /** + * @brief Remove DP from subsystem + * + * @param oid DP's ID + * @return true + * @return false + */ bool remove_dpoint(entity_id oid); + /** + * @brief Add DP to subsystem + * + * @param dpoint new DP object + * @return true + * @return false + */ bool add_dpoint(dpoint_entity dpoint); + /** + * @brief Get vessel object + * + * @param oid vessel ID + * @param success operation success reference + * @return vessel_entity* + */ vessel_entity* get_vessel(entity_id oid, bool &success); + /** + * @brief Remove vessel from subsystem + * + * @param oid vessel's ID + * @return true + * @return false + */ bool remove_vessel(entity_id oid); + /** + * @brief Add vessel to subsystem + * + * @param dpoint + * @return true + * @return false + */ bool add_vessel(vessel_entity dpoint); + /** + * @brief Get subsystem immutable DP collection + * + * @return const QVector + */ const QVector dpoints() const; + /** + * @brief Get subsystem immutable vessel collection + * + * @return const QVector + */ const QVector vessels() const; + /** + * @brief Reads subsytem's data from disk + * + * @param stream read stream + */ void deserialize_data(QDataStream *stream); + /** + * @brief Writes subsytem's data to disk + * + * @param stream write stream + */ void serialize_data(QDataStream *stream); };