Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Pinoxchio
apollo
提交
dd63bfc0
A
apollo
项目概览
Pinoxchio
/
apollo
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
A
apollo
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
dd63bfc0
编写于
9月 28, 2018
作者:
G
gruminions
提交者:
fengqikai1414
9月 28, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
tools: cyber_monitor add support for display enum type
上级
f22d1e3a
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
47 addition
and
83 deletion
+47
-83
framework/cybertron/tools/cvt/monitor/general_message.cpp
framework/cybertron/tools/cvt/monitor/general_message.cpp
+31
-27
framework/cybertron/tools/cvt/monitor/general_message_base.cpp
...work/cybertron/tools/cvt/monitor/general_message_base.cpp
+16
-12
modules/tools/visualizer/CMakeLists.txt
modules/tools/visualizer/CMakeLists.txt
+0
-44
未找到文件。
framework/cybertron/tools/cvt/monitor/general_message.cpp
浏览文件 @
dd63bfc0
...
@@ -27,6 +27,7 @@ RenderableMessage* GeneralMessage::Child(int lineNo) const {
...
@@ -27,6 +27,7 @@ RenderableMessage* GeneralMessage::Child(int lineNo) const {
void
GeneralMessage
::
PrintRepeatedField
(
const
Screen
*
s
,
unsigned
&
lineNo
,
void
GeneralMessage
::
PrintRepeatedField
(
const
Screen
*
s
,
unsigned
&
lineNo
,
int
indent
,
int
index
,
int
jumpLines
)
{
int
indent
,
int
index
,
int
jumpLines
)
{
std
::
ostringstream
outStr
;
std
::
ostringstream
outStr
;
std
::
ios_base
::
fmtflags
old_flags
;
const
std
::
string
&
fieldName
=
field_
->
name
();
const
std
::
string
&
fieldName
=
field_
->
name
();
outStr
<<
fieldName
<<
": "
;
outStr
<<
fieldName
<<
": "
;
...
@@ -35,29 +36,33 @@ void GeneralMessage::PrintRepeatedField(const Screen* s, unsigned& lineNo,
...
@@ -35,29 +36,33 @@ void GeneralMessage::PrintRepeatedField(const Screen* s, unsigned& lineNo,
}
}
switch
(
field_
->
cpp_type
())
{
switch
(
field_
->
cpp_type
())
{
#define OUTPUT_FIELD(CPPTYPE, METHOD
)
\
#define OUTPUT_FIELD(CPPTYPE, METHOD
, PRECISION)
\
case google::protobuf::FieldDescriptor::CPPTYPE_##CPPTYPE: \
case google::protobuf::FieldDescriptor::CPPTYPE_##CPPTYPE: \
outStr << std::setprecision(64) << field_->is_repeated() \
old_flags = outStr.flags(); \
outStr << std::fixed << std::setprecision(PRECISION) \
<< field_->is_repeated() \
? reflection_ptr_->GetRepeated##METHOD(*message_ptr_, field_, index) \
? reflection_ptr_->GetRepeated##METHOD(*message_ptr_, field_, index) \
: reflection_ptr_->Get##METHOD(*message_ptr_, field_); \
: reflection_ptr_->Get##METHOD(*message_ptr_, field_); \
outStr.flags(old_flags); \
break
break
OUTPUT_FIELD
(
INT32
,
Int32
);
OUTPUT_FIELD
(
INT32
,
Int32
,
6
);
OUTPUT_FIELD
(
INT64
,
Int64
);
OUTPUT_FIELD
(
INT64
,
Int64
,
6
);
OUTPUT_FIELD
(
UINT32
,
UInt32
);
OUTPUT_FIELD
(
UINT32
,
UInt32
,
6
);
OUTPUT_FIELD
(
UINT64
,
UInt64
);
OUTPUT_FIELD
(
UINT64
,
UInt64
,
6
);
OUTPUT_FIELD
(
FLOAT
,
Float
);
OUTPUT_FIELD
(
FLOAT
,
Float
,
6
);
OUTPUT_FIELD
(
DOUBLE
,
Double
);
OUTPUT_FIELD
(
DOUBLE
,
Double
,
9
);
OUTPUT_FIELD
(
BOOL
,
Bool
);
OUTPUT_FIELD
(
BOOL
,
Bool
,
6
);
#undef OUTPUT_FIELD
#undef OUTPUT_FIELD
case
google
::
protobuf
::
FieldDescriptor
::
CPPTYPE_STRING
:
{
case
google
::
protobuf
::
FieldDescriptor
::
CPPTYPE_STRING
:
{
std
::
string
scratch
;
std
::
string
scratch
;
const
std
::
string
&
value
=
const
std
::
string
&
value
=
field_
->
is_repeated
()
?
reflection_ptr_
->
GetRepeatedStringReference
(
field_
->
is_repeated
()
*
message_ptr_
,
field_
,
index
,
&
scratch
)
?
reflection_ptr_
->
GetRepeatedStringReference
(
:
reflection_ptr_
->
GetStringReference
(
*
message_ptr_
,
field_
,
index
,
&
scratch
)
*
message_ptr_
,
field_
,
&
scratch
);
:
reflection_ptr_
->
GetStringReference
(
*
message_ptr_
,
field_
,
&
scratch
);
outStr
<<
value
.
substr
(
jumpLines
);
outStr
<<
value
.
substr
(
jumpLines
);
break
;
break
;
}
}
...
@@ -71,9 +76,9 @@ void GeneralMessage::PrintRepeatedField(const Screen* s, unsigned& lineNo,
...
@@ -71,9 +76,9 @@ void GeneralMessage::PrintRepeatedField(const Screen* s, unsigned& lineNo,
const
google
::
protobuf
::
EnumValueDescriptor
*
enum_desc
=
const
google
::
protobuf
::
EnumValueDescriptor
*
enum_desc
=
field_
->
enum_type
()
->
FindValueByNumber
(
enum_value
);
field_
->
enum_type
()
->
FindValueByNumber
(
enum_value
);
if
(
enum_desc
!=
nullptr
)
{
if
(
enum_desc
!=
nullptr
)
{
outStr
<<
enum_desc
->
name
()
<<
" "
<<
enum_value
;
outStr
<<
enum_desc
->
name
();
}
else
{
}
else
{
outStr
<<
enum_value
<<
" "
<<
enum_value
;
outStr
<<
enum_value
;
}
}
break
;
break
;
}
}
...
@@ -81,11 +86,10 @@ void GeneralMessage::PrintRepeatedField(const Screen* s, unsigned& lineNo,
...
@@ -81,11 +86,10 @@ void GeneralMessage::PrintRepeatedField(const Screen* s, unsigned& lineNo,
case
google
::
protobuf
::
FieldDescriptor
::
CPPTYPE_MESSAGE
:
case
google
::
protobuf
::
FieldDescriptor
::
CPPTYPE_MESSAGE
:
s
->
AddStr
(
indent
,
lineNo
++
,
outStr
.
str
().
c_str
());
s
->
AddStr
(
indent
,
lineNo
++
,
outStr
.
str
().
c_str
());
GeneralMessageBase
::
PrintMessage
(
GeneralMessageBase
::
PrintMessage
(
this
,
this
,
field_
->
is_repeated
()
field_
->
is_repeated
()
?
reflection_ptr_
->
GetRepeatedMessage
(
*
message_ptr_
,
field_
,
?
reflection_ptr_
->
GetRepeatedMessage
(
*
message_ptr_
,
field_
,
index
)
index
)
:
reflection_ptr_
->
GetMessage
(
*
message_ptr_
,
field_
),
:
reflection_ptr_
->
GetMessage
(
*
message_ptr_
,
field_
),
s
,
lineNo
,
indent
+
2
,
jumpLines
+
1
);
s
,
lineNo
,
indent
+
2
,
jumpLines
+
1
);
outStr
.
str
(
""
);
outStr
.
str
(
""
);
break
;
break
;
...
@@ -94,11 +98,10 @@ void GeneralMessage::PrintRepeatedField(const Screen* s, unsigned& lineNo,
...
@@ -94,11 +98,10 @@ void GeneralMessage::PrintRepeatedField(const Screen* s, unsigned& lineNo,
s
->
AddStr
(
indent
,
lineNo
++
,
outStr
.
str
().
c_str
());
s
->
AddStr
(
indent
,
lineNo
++
,
outStr
.
str
().
c_str
());
}
}
GeneralMessage
::
GeneralMessage
(
GeneralMessage
::
GeneralMessage
(
GeneralMessageBase
*
parent
,
GeneralMessageBase
*
parent
,
const
google
::
protobuf
::
Message
*
msg
,
const
google
::
protobuf
::
Message
*
const
google
::
protobuf
::
Reflection
*
reflection
,
msg
,
const
google
::
protobuf
::
Reflection
*
reflection
,
const
google
::
protobuf
::
FieldDescriptor
*
field
)
const
google
::
protobuf
::
FieldDescriptor
*
field
)
:
GeneralMessageBase
(
parent
),
:
GeneralMessageBase
(
parent
),
itemIndex_
(
0
),
itemIndex_
(
0
),
field_
(
field
),
field_
(
field
),
...
@@ -129,7 +132,7 @@ void GeneralMessage::Render(const Screen* s, int key) {
...
@@ -129,7 +132,7 @@ void GeneralMessage::Render(const Screen* s, int key) {
s
->
AddStr
(
0
,
lineNo
++
,
"FrameRatio: "
);
s
->
AddStr
(
0
,
lineNo
++
,
"FrameRatio: "
);
s
->
AddStr
(
outStr
.
str
().
c_str
());
s
->
AddStr
(
outStr
.
str
().
c_str
());
clear
();
clear
();
if
(
message_ptr_
&&
reflection_ptr_
)
{
if
(
message_ptr_
&&
reflection_ptr_
)
{
int
size
=
0
;
int
size
=
0
;
...
@@ -158,7 +161,8 @@ void GeneralMessage::Render(const Screen* s, int key) {
...
@@ -158,7 +161,8 @@ void GeneralMessage::Render(const Screen* s, int key) {
default:
;
default:
;
}
}
int
lcount
=
lineCountOfField
(
*
message_ptr_
,
s
->
Width
(),
field_
,
reflection_ptr_
);
int
lcount
=
lineCountOfField
(
*
message_ptr_
,
s
->
Width
(),
field_
,
reflection_ptr_
);
int
pageItemCount
=
s
->
Height
()
-
lineNo
;
int
pageItemCount
=
s
->
Height
()
-
lineNo
;
pages_
=
lcount
/
pageItemCount
+
1
;
pages_
=
lcount
/
pageItemCount
+
1
;
SplitPages
(
key
);
SplitPages
(
key
);
...
...
framework/cybertron/tools/cvt/monitor/general_message_base.cpp
浏览文件 @
dd63bfc0
...
@@ -108,6 +108,7 @@ void GeneralMessageBase::PrintMessage(GeneralMessageBase* baseMsg,
...
@@ -108,6 +108,7 @@ void GeneralMessageBase::PrintMessage(GeneralMessageBase* baseMsg,
}
}
std
::
ostringstream
outStr
;
std
::
ostringstream
outStr
;
std
::
ios_base
::
fmtflags
old_flags
;
for
(;
i
<
fields
.
size
();
++
i
)
{
for
(;
i
<
fields
.
size
();
++
i
)
{
const
google
::
protobuf
::
FieldDescriptor
*
field
=
fields
[
i
];
const
google
::
protobuf
::
FieldDescriptor
*
field
=
fields
[
i
];
const
std
::
string
&
fieldName
=
field
->
name
();
const
std
::
string
&
fieldName
=
field
->
name
();
...
@@ -124,18 +125,21 @@ void GeneralMessageBase::PrintMessage(GeneralMessageBase* baseMsg,
...
@@ -124,18 +125,21 @@ void GeneralMessageBase::PrintMessage(GeneralMessageBase* baseMsg,
}
else
{
}
else
{
switch
(
field
->
cpp_type
())
{
switch
(
field
->
cpp_type
())
{
#define OUTPUT_FIELD(CPPTYPE, METHOD) \
#define OUTPUT_FIELD(CPPTYPE, METHOD, PRECISION) \
case google::protobuf::FieldDescriptor::CPPTYPE_##CPPTYPE: \
case google::protobuf::FieldDescriptor::CPPTYPE_##CPPTYPE: \
outStr << std::setprecision(64) << reflection->Get##METHOD(msg, field); \
old_flags = outStr.flags(); \
outStr << std::fixed << std::setprecision(PRECISION) \
<< reflection->Get##METHOD(msg, field); \
outStr.flags(old_flags); \
break
break
OUTPUT_FIELD
(
INT32
,
Int32
);
OUTPUT_FIELD
(
INT32
,
Int32
,
6
);
OUTPUT_FIELD
(
INT64
,
Int64
);
OUTPUT_FIELD
(
INT64
,
Int64
,
6
);
OUTPUT_FIELD
(
UINT32
,
UInt32
);
OUTPUT_FIELD
(
UINT32
,
UInt32
,
6
);
OUTPUT_FIELD
(
UINT64
,
UInt64
);
OUTPUT_FIELD
(
UINT64
,
UInt64
,
6
);
OUTPUT_FIELD
(
FLOAT
,
Float
);
OUTPUT_FIELD
(
FLOAT
,
Float
,
6
);
OUTPUT_FIELD
(
DOUBLE
,
Double
);
OUTPUT_FIELD
(
DOUBLE
,
Double
,
9
);
OUTPUT_FIELD
(
BOOL
,
Bool
);
OUTPUT_FIELD
(
BOOL
,
Bool
,
6
);
#undef OUTPUT_FIELD
#undef OUTPUT_FIELD
case
google
::
protobuf
::
FieldDescriptor
::
CPPTYPE_ENUM
:
{
case
google
::
protobuf
::
FieldDescriptor
::
CPPTYPE_ENUM
:
{
...
@@ -144,9 +148,9 @@ void GeneralMessageBase::PrintMessage(GeneralMessageBase* baseMsg,
...
@@ -144,9 +148,9 @@ void GeneralMessageBase::PrintMessage(GeneralMessageBase* baseMsg,
const
google
::
protobuf
::
EnumValueDescriptor
*
enum_desc
=
const
google
::
protobuf
::
EnumValueDescriptor
*
enum_desc
=
field
->
enum_type
()
->
FindValueByNumber
(
enum_value
);
field
->
enum_type
()
->
FindValueByNumber
(
enum_value
);
if
(
enum_desc
!=
nullptr
)
{
if
(
enum_desc
!=
nullptr
)
{
outStr
<<
enum_desc
->
name
()
<<
" "
<<
enum_value
;
outStr
<<
enum_desc
->
name
();
}
else
{
}
else
{
outStr
<<
enum_value
<<
" "
<<
enum_value
;
outStr
<<
enum_value
;
}
}
break
;
break
;
}
}
...
...
modules/tools/visualizer/CMakeLists.txt
已删除
100644 → 0
浏览文件 @
f22d1e3a
cmake_minimum_required
(
VERSION 2.8.12
)
project
(
cyber_visualizer
)
set
(
CMAKE_INCLUDE_CURRENT_DIR ON
)
set
(
CMAKE_AUTOMOC ON
)
set
(
CMAKE_PREFIX_PATH
${
CMAKE_SOURCE_DIR
}
/third_party/Qt5.5.1/5.5/gcc_64
)
find_package
(
Qt5 REQUIRED COMPONENTS Gui Widgets Core
)
set
(
OUTTER_LIBRARIES
cybertron
cybertron_proto
cybertron_common
sensor_msgs
fastrtps
console_bridge
protobuf
glog
pthread
GL
)
include_directories
(
.
)
file
(
GLOB SOURCES
${
CMAKE_CURRENT_SOURCE_DIR
}
/*.cc
)
file
(
GLOB HEADERS
${
CMAKE_CURRENT_SOURCE_DIR
}
/*.h
)
file
(
GLOB UIS
${
CMAKE_CURRENT_SOURCE_DIR
}
/uis/*.ui
)
file
(
GLOB RESOURCE
${
CMAKE_CURRENT_SOURCE_DIR
}
/*.qrc
)
qt5_wrap_ui
(
WRAP_UIS
${
UIS
}
)
#qt5_wrap_cpp(MOC widget.h)
qt5_add_resources
(
RCC
${
RESOURCE
}
)
add_executable
(
${
PROJECT_NAME
}
${
SOURCES
}
${
HEADERS
}
${
UIS
}
${
RCC
}
)
target_link_libraries
(
${
PROJECT_NAME
}
Qt5::Widgets
)
target_link_libraries
(
${
PROJECT_NAME
}
Qt5::Gui
)
target_link_libraries
(
${
PROJECT_NAME
}
Qt5::Core
)
target_link_libraries
(
${
PROJECT_NAME
}
${
OUTTER_LIBRARIES
}
)
target_include_directories
(
${
PROJECT_NAME
}
PUBLIC
${
PROTO_SRC_DIR
}
)
install
(
TARGETS
${
PROJECT_NAME
}
DESTINATION
${
CMAKE_INSTALL_PREFIX
}
/bin
)
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录