Václav Kubernát | ab612e9 | 2019-11-26 19:51:31 +0100 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (C) 2019 CESNET, https://photonics.cesnet.cz/ |
| 3 | * |
| 4 | * Written by Václav Kubernát <kubernat@cesnet.cz> |
| 5 | * |
| 6 | */ |
| 7 | |
| 8 | #pragma once |
| 9 | |
| 10 | #include <boost/optional.hpp> |
| 11 | #include <map> |
| 12 | #include <memory> |
| 13 | #include <set> |
| 14 | #include "ast_values.hpp" |
| 15 | #include "datastore_access.hpp" |
| 16 | #include "schema.hpp" |
| 17 | |
| 18 | |
| 19 | /*! \class DataQuery |
| 20 | * \brief A class used for querying data from a datastore for usage in tab-completion. |
| 21 | * |
| 22 | */ |
| 23 | class DataQuery { |
| 24 | public: |
| 25 | DataQuery(DatastoreAccess& datastore); |
| 26 | /*! \brief Lists all possible instances of key/value pairs for a list specified by the arguments. |
| 27 | * \param location Location of the list. |
| 28 | * \param node Name (and optional module name) of the list. |
| 29 | * \return A vector of maps, which represent the instances. The map is keyed by the name of the list key. The values in the map, are values of the list keys. |
| 30 | */ |
| 31 | std::vector<ListInstance> listKeys(const dataPath_& location, const ModuleNodePair& node) const; |
| 32 | |
| 33 | private: |
| 34 | DatastoreAccess& m_datastore; |
| 35 | std::shared_ptr<Schema> m_schema; |
| 36 | }; |