Apollo 10.0
自动驾驶开放平台
general_message_base.h
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2018 The Apollo Authors. All Rights Reserved.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *****************************************************************************/
16
17#ifndef TOOLS_CVT_MONITOR_GENERAL_MESSAGE_BASE_H_
18#define TOOLS_CVT_MONITOR_GENERAL_MESSAGE_BASE_H_
19
20#include <map>
21#include <utility>
22
23#include "cyber/cyber.h"
25
26class Screen;
27
29 protected:
30 static void PrintMessage(GeneralMessageBase* baseMsg,
31 const google::protobuf::Message& msg,
32 int* jump_lines, const Screen* s, int* line_no,
33 int indent);
34 static void PrintField(GeneralMessageBase* baseMsg,
35 const google::protobuf::Message& msg, int* jump_lines,
36 const Screen* s, int* line_no, int indent,
37 const google::protobuf::Reflection* ref,
38 const google::protobuf::FieldDescriptor* field,
39 int index);
40
41 static int LineCount(const google::protobuf::Message& msg, int screen_width);
42 static int LineCountOfField(const google::protobuf::Message& msg,
43 int screen_width,
44 const google::protobuf::FieldDescriptor* field,
45 const google::protobuf::Reflection* reflection,
46 bool is_folded = true);
47
49 children_map_.emplace(line_no, item);
50 }
51
52 RenderableMessage* Child(int line_no) const override;
53
57
58 void clear(void) {
59 for (auto& iter : children_map_) {
60 delete iter.second;
61 }
62
63 children_map_.clear();
64 }
65
68
69 std::map<const int, GeneralMessageBase*> children_map_;
70};
71
72#endif // TOOLS_CVT_MONITOR_GENERAL_MESSAGE_BASE_H_
RenderableMessage * Child(int line_no) const override
GeneralMessageBase & operator=(const GeneralMessageBase &)=delete
std::map< const int, GeneralMessageBase * > children_map_
static void PrintField(GeneralMessageBase *baseMsg, const google::protobuf::Message &msg, int *jump_lines, const Screen *s, int *line_no, int indent, const google::protobuf::Reflection *ref, const google::protobuf::FieldDescriptor *field, int index)
static int LineCount(const google::protobuf::Message &msg, int screen_width)
GeneralMessageBase(RenderableMessage *parent=nullptr)
static void PrintMessage(GeneralMessageBase *baseMsg, const google::protobuf::Message &msg, int *jump_lines, const Screen *s, int *line_no, int indent)
void InsertRepeatedMessage(int line_no, GeneralMessageBase *item)
static int LineCountOfField(const google::protobuf::Message &msg, int screen_width, const google::protobuf::FieldDescriptor *field, const google::protobuf::Reflection *reflection, bool is_folded=true)
GeneralMessageBase(const GeneralMessageBase &)=delete
RenderableMessage * parent(void) const