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.
 

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: