Ariles
reader.h
Go to the documentation of this file.
1 /**
2  @file
3  @author Alexander Sherikov
4 
5  @copyright 2020 Alexander Sherikov, Licensed under the Apache License, Version 2.0.
6  (see @ref LICENSE or http://www.apache.org/licenses/LICENSE-2.0)
7 
8  @brief
9 */
10 
11 #pragma once
12 
13 namespace ariles2
14 {
15  namespace ns_protobuf3
16  {
17  class Reader : public visitor::Base<Reader, visitor::Parameters>
18  {
19  public:
21 
22 
23  public:
24  /*
25  template <class t_Ariles>
26  const Parameters &getParameters(const t_Ariles &ariles_class) const
27  {
28  return (ariles_class.arilesGetParameters(*this));
29  }
30  */
31 
32 
33  template <class t_Left, class t_Right>
34  void visit(t_Left &left, const t_Right &right, const std::string &name, const Parameters &param)
35  {
37  try
38  {
39  this->visitMapEntry(left, right, name, param);
40  }
41  catch (std::exception &e)
42  {
43  CPPUT_THROW("Copying failed: ", e.what());
44  }
45  }
46 
47 
48  template <class t_Left, class t_Right>
49  void visitMapEntry(t_Left &left, const t_Right &right, const std::string &name, const Parameters &param)
50  {
52  CPPUT_TRACE_VALUE(name);
53  CPPUT_TRACE_TYPE(left);
54  CPPUT_TRACE_TYPE(right);
55 
56  try
57  {
58  copyfrom::apply_copyfrom(*this, left, right, param);
59  }
60  catch (const std::exception &e)
61  {
62  CPPUT_THROW("entry: ", name, " // ", e.what());
63  }
64  }
65  };
66  } // namespace ns_protobuf3
67 } // namespace ariles2
void visitMapEntry(t_Left &left, const t_Right &right, const std::string &name, const Parameters &param)
Definition: reader.h:49
void visit(t_Left &left, const t_Right &right, const std::string &name, const Parameters &param)
Definition: reader.h:34
#define CPPUT_THROW(...)
Definition: exception.h:19
void apply_copyfrom(t_Visitor &visitor, t_Left &left, const t_Right &right, const typename t_Visitor::Parameters &param)
Definition: basic.h:307
visitor::Parameters Parameters
Definition: count.h:26
Definition: basic.h:17
#define CPPUT_TRACE_FUNCTION
Definition: trace.h:126
#define CPPUT_TRACE_TYPE(type)
Definition: trace.h:128
#define CPPUT_TRACE_VALUE(value)
Definition: trace.h:127