claraty::Power_Switch Class Reference
#include <power_switch.h>
Public Member Functions | |
| Power_Switch () | |
| virtual | ~Power_Switch () |
| bool | set (bool state) |
| bool | get () const |
| bool | is_switchable () const |
| virtual std::string | get_name () const |
| virtual bool | io (FDM_Map map) |
Protected Member Functions | |
| bool | _set (bool state) |
Private Attributes | |
| bool | _is_switchable |
| bool | _switch_on |
Detailed Description
Power_Switch_Func is an abstract base class for a power switch used by Device. A Power_Switch_Func supports the following methods:- Set the value, true to turn on, false to turn off
- Get the current state, true if currently on, false if currently off
- Get name, which is used by the device factory to instantiate from serialized attributes
- Ask the power switch if it can be turned off. This is needed because manual switches cannot be turned on and off but are read only switches
Definition at line 45 of file power_switch.h.
Constructor & Destructor Documentation
| claraty::Power_Switch::Power_Switch | ( | ) | [inline] |
| virtual claraty::Power_Switch::~Power_Switch | ( | ) | [inline, virtual] |
Member Function Documentation
| bool claraty::Power_Switch::set | ( | bool | state | ) | [inline] |
Definition at line 50 of file power_switch.h.
References _set(), and _switch_on.
Referenced by claraty::Device::off(), and claraty::Device::on().
00050 { _switch_on = state; return _set(state); }
Here is the call graph for this function:

| bool claraty::Power_Switch::get | ( | ) | const [inline] |
Definition at line 51 of file power_switch.h.
References _switch_on.
Referenced by claraty::Device::is_on().
00051 { return _switch_on; }
| bool claraty::Power_Switch::is_switchable | ( | ) | const [inline] |
Definition at line 52 of file power_switch.h.
References _is_switchable.
00052 { return _is_switchable; }
| virtual std::string claraty::Power_Switch::get_name | ( | ) | const [inline, virtual] |
| bool claraty::Power_Switch::io | ( | FDM_Map | map | ) | [inline, virtual] |
Maps the data members of the power switch function object for sending over a serial medium
- Parameters:
-
[out] map A serial object that contains the device data members.
- Returns:
- true if serialization succeeds, false otherwise.
Definition at line 79 of file power_switch.h.
References _is_switchable, _switch_on, and claraty::FDM_Map::field().
00080 { 00081 bool ok = true; 00082 ok &= map.field("has switch", _is_switchable); 00083 ok &= map.field("switch on", _switch_on); 00084 return ok; 00085 }
Here is the call graph for this function:

| bool claraty::Power_Switch::_set | ( | bool | state | ) | [inline, protected] |
Member Data Documentation
bool claraty::Power_Switch::_is_switchable [private] |
bool claraty::Power_Switch::_switch_on [private] |
The documentation for this class was generated from the following file: