|
1 | 1 | /******************************************************************************** |
2 | 2 | * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * |
3 | 3 | * * |
4 | | - * This software is distributed under the terms of the * |
5 | | - * GNU Lesser General Public Licence version 3 (LGPL) version 3, * |
| 4 | + * This software is distributed under the terms of the * |
| 5 | + * GNU Lesser General Public Licence version 3 (LGPL) version 3, * |
6 | 6 | * copied verbatim in the file "LICENSE" * |
7 | 7 | ********************************************************************************/ |
8 | 8 | /** |
9 | 9 | * ConditionsMQClient.h |
10 | 10 | * |
11 | 11 | * @since 2016-01-11 |
12 | | - * @author R. Grosso, from examples/MQ/7-parameters/FairMQExample7Client.h |
| 12 | + * @author R. Grosso, C. Kouzinopoulos from examples/MQ/7-parameters/FairMQExample7Client.h |
13 | 13 | */ |
14 | 14 |
|
15 | 15 | #ifndef ALICEO2_CDB_CONDITIONSMQCLIENT_H_ |
|
22 | 22 | namespace AliceO2 { |
23 | 23 | namespace CDB { |
24 | 24 |
|
25 | | -class ConditionsMQClient : public FairMQDevice |
26 | | -{ |
27 | | - public: |
28 | | - enum |
29 | | - { |
30 | | - ParameterName = FairMQDevice::Last, |
31 | | - Last |
32 | | - }; |
| 25 | +class ConditionsMQClient : public FairMQDevice { |
| 26 | +public: |
| 27 | + enum { ParameterName = FairMQDevice::Last, OperationType, DataSource, ObjectPath, Last }; |
33 | 28 |
|
34 | | - ConditionsMQClient(); |
| 29 | + ConditionsMQClient(); |
35 | 30 |
|
36 | | - virtual ~ConditionsMQClient(); |
| 31 | + virtual ~ConditionsMQClient(); |
37 | 32 |
|
38 | | - static void CustomCleanup(void *data, void *hint); |
| 33 | + virtual void SetProperty(const int key, const std::string& value); |
| 34 | + virtual std::string GetProperty(const int key, const std::string& default_ = ""); |
| 35 | + virtual void SetProperty(const int key, const int value); |
| 36 | + virtual int GetProperty(const int key, const int default_ = 0); |
39 | 37 |
|
40 | | - virtual void SetProperty(const int key, const std::string &value); |
| 38 | +protected: |
| 39 | + virtual void Run(); |
41 | 40 |
|
42 | | - virtual std::string GetProperty(const int key, const std::string &default_ = ""); |
| 41 | +private: |
| 42 | + int fRunId; |
| 43 | + std::string fParameterName; |
| 44 | + std::string fOperationType; |
| 45 | + std::string fDataSource; |
| 46 | + std::string fObjectPath; |
43 | 47 |
|
44 | | - virtual void SetProperty(const int key, const int value); |
| 48 | + /// Serializes a key (and optionally value) to an std::string using Protocol Buffers |
| 49 | + void Serialize(std::string*& messageString, const std::string& key, const std::string& object = std::string()); |
45 | 50 |
|
46 | | - virtual int GetProperty(const int key, const int default_ = 0); |
| 51 | + /// Deserializes a message and stores the value to an std::string using Protocol Buffers |
| 52 | + void Deserialize(const std::string& messageString, std::string& object); |
47 | 53 |
|
48 | | - protected: |
49 | | - virtual void Run(); |
| 54 | + /// Run loop when an OCDB backend is chosen |
| 55 | + void RunOCDB(); |
50 | 56 |
|
51 | | - private: |
52 | | - int fRunId; |
53 | | - std::string fParameterName; |
| 57 | + /// Run loop when a Riak backend is chosen |
| 58 | + void RunRiak(); |
54 | 59 | }; |
55 | 60 | } |
56 | 61 | } |
|
0 commit comments