PDI 1.1.0

Data exchange made easy

context_proxy.h
1 /*******************************************************************************
2  * Copyright (C) 2019 Institute of Bioorganic Chemistry Polish Academy of Science (PSNC)
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  * * Redistributions of source code must retain the above copyright
8  * notice, this list of conditions and the following disclaimer.
9  * * Redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution.
12  * * Neither the name of CEA nor the names of its contributors may be used to
13  * endorse or promote products derived from this software without specific
14  * prior written permission.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22  * THE SOFTWARE.
23  ******************************************************************************/
24 
25 #ifndef PDI_CONTEXT_PROXY_H_
26 #define PDI_CONTEXT_PROXY_H_
27 
28 #include <pdi/pdi_fwd.h>
29 #include <pdi/context.h>
30 #include <pdi/callbacks.h>
31 
32 #include <functional>
33 #include <string>
34 
35 namespace PDI {
36 
37 class PDI_EXPORT Context_proxy : public Context
38 {
39  Context& m_real_context;
40  Logger_sptr m_plugin_logger;
41 public:
42  Context_proxy(Context& ctx, std::string plugin_name, PC_tree_t logging_tree);
43 
46  Data_descriptor& desc(const std::string& name) override;
47 
50  Data_descriptor& desc(const char* name) override;
51 
54  Data_descriptor& operator[](const std::string& name) override;
55 
58  Data_descriptor& operator[](const char* name) override;
59 
62  Iterator begin() override;
63 
66  Iterator end() override;
67 
70  void event(const char* name) override;
71 
74  Logger_sptr logger() const override;
75 
78  Logger_sptr pdi_core_logger() const;
79 
82  Datatype_template_uptr datatype(PC_tree_t node) override;
83 
86  void add_datatype(const std::string& name, Datatype_template_parser parser) override;
87 
90  Callbacks& callbacks() override;
91 
92  void finalize_and_exit() override;
93 };
94 
95 } //namespace PDI
96 
97 #endif // PDI_CONTEXT_PROXY_H_
Definition: context.h:42
std::shared_ptr< spdlog::logger > Logger_sptr
A shared pointer to a logger instance.
Definition: pdi_fwd.h:83
std::unique_ptr< Datatype_template > Datatype_template_uptr
Definition: pdi_fwd.h:74
Definition: callbacks.h:38
Definition: context_proxy.h:37
Definition: data_descriptor.h:39
An iterator used to go through the descriptor store.
Definition: context.h:47
Definition: array_datatype.h:37
std::function< Datatype_template_uptr(Context &, PC_tree_t)> Datatype_template_parser
A function that parses a PC_tree_t to create a datatype_template.
Definition: context.h:63