Apollo  6.0
Open source self driving car software
renderable_message.h
Go to the documentation of this file.
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_RENDERABLE_MESSAGE_H_
18 #define TOOLS_CVT_MONITOR_RENDERABLE_MESSAGE_H_
19 
20 #include <string>
21 
22 class Screen;
23 
25  public:
26  static constexpr int FrameRatio_Precision = 2;
27 
29  int line_no = 0)
30  : line_no_(line_no),
31  pages_(1),
32  page_index_(0),
33  page_item_count_(24),
34  parent_(parent),
35  frame_ratio_(0.0) {}
36 
37  virtual ~RenderableMessage() { parent_ = nullptr; }
38 
39  virtual int Render(const Screen* s, int key) = 0;
40  virtual RenderableMessage* Child(int /* line_no */) const = 0;
41 
42  virtual double frame_ratio(void) { return frame_ratio_; }
43 
44  RenderableMessage* parent(void) const { return parent_; }
46  if (parent == parent_) {
47  return;
48  }
49  parent_ = parent;
50  }
51 
52  int page_item_count(void) const { return page_item_count_; }
53 
54  protected:
55  int* line_no(void) { return &line_no_; }
57  void reset_line_page(void) {
58  line_no_ = 0;
59  page_index_ = 0;
60  }
61  void SplitPages(int key);
62 
63  int line_no_;
64  int pages_;
68  double frame_ratio_;
69 
70  friend class Screen;
71 }; // RenderableMessage
72 
73 #endif // TOOLS_CVT_MONITOR_RENDERABLE_MESSAGE_H_
Definition: screen.h:30
virtual RenderableMessage * Child(int) const =0
Definition: renderable_message.h:24
virtual double frame_ratio(void)
Definition: renderable_message.h:42
int page_item_count_
Definition: renderable_message.h:66
virtual ~RenderableMessage()
Definition: renderable_message.h:37
RenderableMessage(RenderableMessage *parent=nullptr, int line_no=0)
Definition: renderable_message.h:28
int pages_
Definition: renderable_message.h:64
void set_line_no(int line_no)
Definition: renderable_message.h:56
void set_parent(RenderableMessage *parent)
Definition: renderable_message.h:45
int page_item_count(void) const
Definition: renderable_message.h:52
void SplitPages(int key)
int line_no_
Definition: renderable_message.h:63
int page_index_
Definition: renderable_message.h:65
int * line_no(void)
Definition: renderable_message.h:55
RenderableMessage * parent(void) const
Definition: renderable_message.h:44
double frame_ratio_
Definition: renderable_message.h:68
RenderableMessage * parent_
Definition: renderable_message.h:67
void reset_line_page(void)
Definition: renderable_message.h:57
static constexpr int FrameRatio_Precision
Definition: renderable_message.h:26
virtual int Render(const Screen *s, int key)=0