@@ -7,6 +7,11 | |||
|
7 | 7 | |
|
8 | 8 | Q_DECLARE_LOGGING_CATEGORY(LOG_AmdaServer) |
|
9 | 9 | |
|
10 | // Directive used to determine the active AMDA server | |
|
11 | #ifndef SCIQLOP_AMDA_SERVER | |
|
12 | #define SCIQLOP_AMDA_SERVER "default" | |
|
13 | #endif | |
|
14 | ||
|
10 | 15 | /** |
|
11 | 16 | * @brief The AmdaServer class represents the server used to retrieve AMDA data (singleton). |
|
12 | 17 | * |
@@ -18,9 +18,28 public: | |||
|
18 | 18 | QString url() const override { return QStringLiteral("amdatest.irap.omp.eu"); } |
|
19 | 19 | }; |
|
20 | 20 | |
|
21 | /// @return an AMDA server instance created from the name of the server passed in parameter. If the | |
|
22 | /// name does not match any known server, a default server instance is created | |
|
23 | std::unique_ptr<AmdaServer> createInstance(const QString &server) | |
|
24 | { | |
|
25 | if (server == QString{"amdatest"}) { | |
|
26 | return std::make_unique<AmdaTestServer>(); | |
|
27 | } | |
|
28 | else { | |
|
29 | if (server != QString{"default"}) { | |
|
30 | qCWarning(LOG_AmdaServer()) | |
|
31 | << QObject::tr("Unknown server '%1': default AMDA server will be used").arg(server); | |
|
32 | } | |
|
33 | ||
|
34 | return std::make_unique<AmdaDefaultServer>(); | |
|
35 | } | |
|
36 | } | |
|
37 | ||
|
21 | 38 | } // namespace |
|
22 | 39 | |
|
23 | 40 | AmdaServer &AmdaServer::instance() |
|
24 | 41 | { |
|
25 | /// @todo ALX | |
|
42 | // Creates instance depending on the SCIQLOP_AMDA_SERVER value at compile time | |
|
43 | static auto instance = createInstance(SCIQLOP_AMDA_SERVER); | |
|
44 | return *instance; | |
|
26 | 45 | } |
General Comments 0
You need to be logged in to leave comments.
Login now