From 3753716e04e5d339df70a444cc7891506b9f19eb Mon Sep 17 00:00:00 2001 From: Povilas Kanapickas Date: Sun, 12 Jan 2020 10:57:04 +0200 Subject: [PATCH] genesys: Add a class to move common command set functions to --- backend/Makefile.am | 1 + backend/genesys/command_set_common.cpp | 31 +++++++++++++++++++ backend/genesys/command_set_common.h | 41 ++++++++++++++++++++++++++ backend/genesys/gl124.h | 4 +-- backend/genesys/gl646.h | 4 +-- backend/genesys/gl841.h | 4 +-- backend/genesys/gl843.h | 4 +-- backend/genesys/gl846.h | 4 +-- backend/genesys/gl847.h | 4 +-- 9 files changed, 85 insertions(+), 12 deletions(-) create mode 100644 backend/genesys/command_set_common.cpp create mode 100644 backend/genesys/command_set_common.h diff --git a/backend/Makefile.am b/backend/Makefile.am index 1dc1a58e4..b0c7e182c 100644 --- a/backend/Makefile.am +++ b/backend/Makefile.am @@ -504,6 +504,7 @@ libgenesys_la_SOURCES = genesys/genesys.cpp genesys/genesys.h \ genesys/buffer.h genesys/buffer.cpp \ genesys/calibration.h \ genesys/command_set.h \ + genesys/command_set_common.h genesys/command_set_common.cpp \ genesys/conv.h genesys/conv.cpp \ genesys/device.h genesys/device.cpp \ genesys/enums.h genesys/enums.cpp \ diff --git a/backend/genesys/command_set_common.cpp b/backend/genesys/command_set_common.cpp new file mode 100644 index 000000000..5f52248c8 --- /dev/null +++ b/backend/genesys/command_set_common.cpp @@ -0,0 +1,31 @@ +/* sane - Scanner Access Now Easy. + + Copyright (C) 2019 Povilas Kanapickas + + This file is part of the SANE package. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. +*/ + +#define DEBUG_DECLARE_ONLY + +#include "command_set_common.h" + +namespace genesys { + +CommandSetCommon::~CommandSetCommon() = default; + +} // namespace genesys diff --git a/backend/genesys/command_set_common.h b/backend/genesys/command_set_common.h new file mode 100644 index 000000000..e17286976 --- /dev/null +++ b/backend/genesys/command_set_common.h @@ -0,0 +1,41 @@ +/* sane - Scanner Access Now Easy. + + Copyright (C) 2019 Povilas Kanapickas + + This file is part of the SANE package. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. +*/ + +#ifndef BACKEND_GENESYS_COMMAND_SET_COMMON_H +#define BACKEND_GENESYS_COMMAND_SET_COMMON_H + +#include "command_set.h" + +namespace genesys { + + +/** Common command set functionality + */ +class CommandSetCommon : public CommandSet +{ +public: + ~CommandSetCommon() override; +}; + +} // namespace genesys + +#endif // BACKEND_GENESYS_COMMAND_SET_COMMON_H diff --git a/backend/genesys/gl124.h b/backend/genesys/gl124.h index cdf8faf5a..7e31d39fe 100644 --- a/backend/genesys/gl124.h +++ b/backend/genesys/gl124.h @@ -45,7 +45,7 @@ #define BACKEND_GENESYS_GL124_H #include "genesys.h" -#include "command_set.h" +#include "command_set_common.h" namespace genesys { namespace gl124 { @@ -112,7 +112,7 @@ static Memory_layout layouts[]={ static void gl124_send_slope_table(Genesys_Device* dev, int table_nr, const std::vector& slope_table, int steps); -class CommandSetGl124 : public CommandSet +class CommandSetGl124 : public CommandSetCommon { public: ~CommandSetGl124() override = default; diff --git a/backend/genesys/gl646.h b/backend/genesys/gl646.h index afcfa0588..ca62c1b9b 100644 --- a/backend/genesys/gl646.h +++ b/backend/genesys/gl646.h @@ -48,7 +48,7 @@ #define BACKEND_GENESYS_GL646_H #include "genesys.h" -#include "command_set.h" +#include "command_set_common.h" #include "motor.h" namespace genesys { @@ -436,7 +436,7 @@ static Motor_Master motor_master[] = { MotorSlope::create_from_steps(2000, 300, 255), 146}, /* 5500 guessed */ }; -class CommandSetGl646 : public CommandSet +class CommandSetGl646 : public CommandSetCommon { public: ~CommandSetGl646() override = default; diff --git a/backend/genesys/gl841.h b/backend/genesys/gl841.h index 5e24249db..50a21f60a 100644 --- a/backend/genesys/gl841.h +++ b/backend/genesys/gl841.h @@ -42,7 +42,7 @@ */ #include "genesys.h" -#include "command_set.h" +#include "command_set_common.h" #ifndef BACKEND_GENESYS_GL841_H #define BACKEND_GENESYS_GL841_H @@ -50,7 +50,7 @@ namespace genesys { namespace gl841 { -class CommandSetGl841 : public CommandSet +class CommandSetGl841 : public CommandSetCommon { public: ~CommandSetGl841() override = default; diff --git a/backend/genesys/gl843.h b/backend/genesys/gl843.h index 9f0a9e9d3..b33b516fc 100644 --- a/backend/genesys/gl843.h +++ b/backend/genesys/gl843.h @@ -42,7 +42,7 @@ */ #include "genesys.h" -#include "command_set.h" +#include "command_set_common.h" #ifndef BACKEND_GENESYS_GL843_H #define BACKEND_GENESYS_GL843_H @@ -50,7 +50,7 @@ namespace genesys { namespace gl843 { -class CommandSetGl843 : public CommandSet +class CommandSetGl843 : public CommandSetCommon { public: ~CommandSetGl843() override = default; diff --git a/backend/genesys/gl846.h b/backend/genesys/gl846.h index 258015aa2..6de1d3b69 100644 --- a/backend/genesys/gl846.h +++ b/backend/genesys/gl846.h @@ -42,7 +42,7 @@ */ #include "genesys.h" -#include "command_set.h" +#include "command_set_common.h" #ifndef BACKEND_GENESYS_GL846_H #define BACKEND_GENESYS_GL846_H @@ -125,7 +125,7 @@ static Memory_layout layouts[]={ { nullptr, 0, 0, 0, 0, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0} } }; -class CommandSetGl846 : public CommandSet +class CommandSetGl846 : public CommandSetCommon { public: ~CommandSetGl846() override = default; diff --git a/backend/genesys/gl847.h b/backend/genesys/gl847.h index a51c2936f..a420445f8 100644 --- a/backend/genesys/gl847.h +++ b/backend/genesys/gl847.h @@ -45,7 +45,7 @@ #define BACKEND_GENESYS_GL847_H #include "genesys.h" -#include "command_set.h" +#include "command_set_common.h" namespace genesys { namespace gl847 { @@ -113,7 +113,7 @@ static Memory_layout layouts[]={ } }; -class CommandSetGl847 : public CommandSet +class CommandSetGl847 : public CommandSetCommon { public: ~CommandSetGl847() override = default;