C++ DevKit
C++ set of OOP library
Loading...
Searching...
No Matches
Model Class Reference

This is the Model abstract class of Model_View_Control design pattern. More...

#include <ui_core.h>

Inheritance diagram for Model:
Inheritance graph
Collaboration diagram for Model:
Collaboration graph

Public Member Functions

 Model ()
 Construct the Model object.
 
 ~Model ()
 Destroy the Model object.
 
void update_attached_widgets (Widget *new_widget)
 add a new widget to the set of attached_widgets
 
int get_number_of_attached_widget ()
 get the number of attached widgets
 
bool has_changed ()
 get the change flag status
 
void set_change_flag ()
 Set the change flag object to true.
 
void draw_widget_done ()
 Set the change flag object to false.
 
uint32_t get_time_since_last_change ()
 compute time since the last status change
 
virtual void draw_refresh_all_attached_widgets ()
 update drawing for each attached widgets
 

Protected Attributes

std::set< Widget * > attached_widgets
 the set of widgets that are in charge of viewing this model.
 

Private Attributes

uint32_t last_change_time
 the time in microseconds since the last status has changed
 
int change_flag
 The semaphore used to trigger the actual drawing of the widget on the screen. It is set with the number of widget attached to this model. Doing so, each time an attached widget is refreshed, the the change_flag is decrement by 1. When all attached widget are done, the change_flag = 0 (i.e. false).
 

Detailed Description

This is the Model abstract class of Model_View_Control design pattern.

It handles change_flag, a semaphore used to indicate that a redraw is required for all attached widgets.

The controller or any other entities that modify the model must set the change_flag and the widget in charge of its screen representation must clear the change_flag

Member Function Documentation

◆ get_number_of_attached_widget()

int Model::get_number_of_attached_widget ( )

get the number of attached widgets

Returns

◆ get_time_since_last_change()

uint32_t Model::get_time_since_last_change ( )

compute time since the last status change

Returns
this time in microsecond
Here is the caller graph for this function:

◆ has_changed()

bool Model::has_changed ( )

get the change flag status

Returns
true means the redraw is required

◆ update_attached_widgets()

void Model::update_attached_widgets ( Widget * new_widget)

add a new widget to the set of attached_widgets

Parameters
new_widget
Here is the caller graph for this function:

Member Data Documentation

◆ attached_widgets

std::set<Widget *> Model::attached_widgets
protected

the set of widgets that are in charge of viewing this model.

Note
USAGE: Used to count the number of widget that need to be refreshed

The documentation for this class was generated from the following files: