~aleteoryx/muditaos

ref: 7cbfd6a98449c3b005ad0e4c35408728f0957499 muditaos/module-services/service-db/include/service-db/DatabaseAgent.hpp -rw-r--r-- 990 bytes
7cbfd6a9 — Mateusz Piesta [BH-1356] Meditation stats backend 3 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#pragma once

#include <Database/Database.hpp>
#include <Service/Service.hpp>

#include <string>
#include <memory>

class Database;
namespace sys
{
    class Service;
} // namespace sys

class DatabaseAgent
{
  public:
    explicit DatabaseAgent(sys::Service *parentService);
    virtual ~DatabaseAgent() = default;

    virtual void registerMessages()                                = 0;
    virtual void unRegisterMessages()                              = 0;
    [[nodiscard]] virtual auto getAgentName() -> const std::string = 0;

    bool storeIntoFile(const std::filesystem::path &file);
    [[nodiscard]] virtual auto getDbFilePath() -> const std::string = 0;

    static constexpr auto ZERO_ROWS_FOUND = 0;
    static constexpr auto ONE_ROW_FOUND   = 1;

  protected:
    sys::Service *parentService;
    std::unique_ptr<Database> database;
};