Mcalc  0.1
a machinist's calculator
Public Member Functions | List of all members
mc::Output Class Reference

#include <output.hpp>

Inheritance diagram for mc::Output:
Inheritance graph
[legend]
Collaboration diagram for mc::Output:
Collaboration graph
[legend]

Public Member Functions

 Output (BaseObjectType *cobject, const Glib::RefPtr< Gtk::Builder > &refGlade)
 
 ~Output ()
 
void notify (Event *e)
 
void broadcast ()
 
void set_references (std::vector< mc::Interface * > r)
 
void set_calculator (std::function< double(std::vector< mc::Interface * >)> f)
 
std::string get_value ()
 
void set_value (double v)
 
void set_value (std::string s)
 
- Public Member Functions inherited from mc::Interface
 Interface ()
 
virtual ~Interface ()
 
void set_column (std::string n)
 
std::string get_column ()
 
- Public Member Functions inherited from mc::Subscriber
 Subscriber ()
 
virtual ~Subscriber ()
 

Additional Inherited Members

- Protected Attributes inherited from mc::Interface
Broadcasterbroadcaster
 
DataStoredata
 
std::string column_name
 

Detailed Description

The Output class wraps a Gtk::Label in the UI and uses a provided lambda function to calculate a display value.

Constructor & Destructor Documentation

mc::Output::Output ( BaseObjectType *  cobject,
const Glib::RefPtr< Gtk::Builder > &  refGlade 
)

Constructor for the Gtk::Builder

Parameters
cobjectA base object typedef
refGladeA reference to the builder.
mc::Output::~Output ( )

Destructor

Member Function Documentation

void mc::Output::broadcast ( )

Generates a change event and sends it to Broadcaster.

std::string mc::Output::get_value ( )
virtual

Returns a string representation of the current value of the Interface.

Implements mc::Interface.

void mc::Output::notify ( Event e)
virtual

Update the Interface about change events. Used by broadcaster.

Parameters
eThe event object

Implements mc::Subscriber.

void mc::Output::set_calculator ( std::function< double(std::vector< mc::Interface * >)>  f)

Set the calculating function that will be used to generate output given the current state of the references.

Parameters
fA function that will be used to calculate output.
void mc::Output::set_references ( std::vector< mc::Interface * >  r)

Add references to the interface that will trigger the Output to update when they change.

Parameters
rA vector of Interfaces to use as a reference
void mc::Output::set_value ( double  v)

Sets the value of the output.

Parameters
vA double value to set in the ui.
void mc::Output::set_value ( std::string  s)
virtual

Sets the current value of the interface.

Parameters
sThe string value to set.

Implements mc::Interface.


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