PDI 1.4.3

the PDI data interface

context_proxy.h
1 /*******************************************************************************
2  * Copyright (C) 2019-2021 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 #include <pdi/logger.h>
32 
33 #include <functional>
34 #include <string>
35 
36 namespace PDI {
37 
38 class PDI_EXPORT Context_proxy : public Context
39 {
41  Context& m_real_context;
42 
44  Logger m_plugin_logger;
45 public:
49  Context_proxy(Context& ctx);
50 
56  Context_proxy(Context& ctx, const std::string& logger_name, PC_tree_t logging_tree);
57 
62  void setup_logger(const std::string& logger_name, PC_tree_t logging_tree);
63 
66  Data_descriptor& desc(const std::string& name) override;
67 
70  Data_descriptor& desc(const char* name) override;
71 
74  Data_descriptor& operator[](const std::string& name) override;
75 
78  Data_descriptor& operator[](const char* name) override;
79 
82  Iterator begin() override;
83 
86  Iterator end() override;
87 
92  void event(const char* name) override;
93 
98  Logger& logger() override;
99 
104  Logger& pdi_core_logger();
105 
108  Datatype_template_uptr datatype(PC_tree_t node) override;
109 
112  void add_datatype(const std::string& name, Datatype_template_parser parser) override;
113 
116  Callbacks& callbacks() override;
117 
118  void finalize_and_exit() override;
119 };
120 
121 } //namespace PDI
122 
123 #endif // PDI_CONTEXT_PROXY_H_
Definition: context.h:44
Wrapper for spdlog::logger with additional pattern getter method.
Definition: logger.h:41
std::unique_ptr< Datatype_template > Datatype_template_uptr
Definition: pdi_fwd.h:70
Definition: callbacks.h:38
Definition: context_proxy.h:38
Definition: data_descriptor.h:39
An iterator used to go through the descriptor store.
Definition: context.h:49
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:65