ControlReference: move function bodies out of header

This commit is contained in:
Michael Maltese 2016-12-09 13:07:49 -08:00
parent a509f56116
commit 813a725f68
2 changed files with 30 additions and 14 deletions

View File

@ -36,6 +36,31 @@ void ControlReference::UpdateReference(ciface::Core::DeviceContainer& devices,
parse_error = ParseExpression(expression, finder, &parsed_expression); parse_error = ParseExpression(expression, finder, &parsed_expression);
} }
ControlReference::~ControlReference()
{
delete parsed_expression;
}
int ControlReference::BoundCount() const
{
if (parsed_expression)
return parsed_expression->num_controls;
else
return 0;
}
ControlReference::ControlReference(const bool _is_input)
: range(1), is_input(_is_input), parsed_expression(nullptr)
{
}
InputReference::InputReference() : ControlReference(true)
{
}
OutputReference::OutputReference() : ControlReference(false)
{
}
// //
// InputReference :: State // InputReference :: State
// //

View File

@ -22,10 +22,12 @@ class ControlReference
public: public:
static bool InputGateOn(); static bool InputGateOn();
virtual ~ControlReference();
virtual ControlState State(const ControlState state = 0) = 0; virtual ControlState State(const ControlState state = 0) = 0;
virtual ciface::Core::Device::Control* Detect(const unsigned int ms, virtual ciface::Core::Device::Control* Detect(const unsigned int ms,
ciface::Core::Device* const device) = 0; ciface::Core::Device* const device) = 0;
int BoundCount() const;
void UpdateReference(ciface::Core::DeviceContainer& devices, void UpdateReference(ciface::Core::DeviceContainer& devices,
const ciface::Core::DeviceQualifier& default_device); const ciface::Core::DeviceQualifier& default_device);
@ -34,19 +36,8 @@ public:
const bool is_input; const bool is_input;
ciface::ExpressionParser::ExpressionParseStatus parse_error; ciface::ExpressionParser::ExpressionParseStatus parse_error;
virtual ~ControlReference() { delete parsed_expression; }
int BoundCount()
{
if (parsed_expression)
return parsed_expression->num_controls;
else
return 0;
}
protected: protected:
ControlReference(const bool _is_input) : range(1), is_input(_is_input), parsed_expression(nullptr) ControlReference(const bool _is_input);
{
}
ciface::ExpressionParser::Expression* parsed_expression; ciface::ExpressionParser::Expression* parsed_expression;
}; };
@ -58,7 +49,7 @@ protected:
class InputReference : public ControlReference class InputReference : public ControlReference
{ {
public: public:
InputReference() : ControlReference(true) {} InputReference();
ControlState State(const ControlState state) override; ControlState State(const ControlState state) override;
ciface::Core::Device::Control* Detect(const unsigned int ms, ciface::Core::Device::Control* Detect(const unsigned int ms,
ciface::Core::Device* const device) override; ciface::Core::Device* const device) override;
@ -72,7 +63,7 @@ public:
class OutputReference : public ControlReference class OutputReference : public ControlReference
{ {
public: public:
OutputReference() : ControlReference(false) {} OutputReference();
ControlState State(const ControlState state) override; ControlState State(const ControlState state) override;
ciface::Core::Device::Control* Detect(const unsigned int ms, ciface::Core::Device::Control* Detect(const unsigned int ms,
ciface::Core::Device* const device) override; ciface::Core::Device* const device) override;