Program Listing for File SVHEncoderSettings.h
↰ Return to documentation for file (/tmp/ws/src/schunk_svh_library/include/schunk_svh_library/control/SVHEncoderSettings.h
)
//
// © Copyright 2022 SCHUNK Mobile Greifsysteme GmbH, Lauffen/Neckar Germany
// © Copyright 2022 FZI Forschungszentrum Informatik, Karlsruhe, Germany
//
// This file is part of the Schunk SVH Library.
//
// The Schunk SVH Library 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 3 of the License, or (at your
// option) any later version.
//
// The Schunk SVH Library 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
// the Schunk SVH Library. If not, see <https://www.gnu.org/licenses/>.
//
//----------------------------------------------------------------------
//----------------------------------------------------------------------
#ifndef SVHENCODERSETTINGS_H
#define SVHENCODERSETTINGS_H
#include <schunk_svh_library/serial/ByteOrderConversion.h>
namespace driver_svh {
struct SVHEncoderSettings
{
std::vector<uint32_t> scalings;
// TODO Provide a constructor that allows for seperate encoder settings in the hardware
SVHEncoderSettings(uint32_t scaling = 1)
: scalings(9, scaling)
{
}
bool operator==(const SVHEncoderSettings& other) const { return (scalings == other.scalings); }
};
inline driver_svh::ArrayBuilder& operator<<(driver_svh::ArrayBuilder& ab,
const SVHEncoderSettings& data)
{
// Trivial as the vector slicing is already done by the arraybuilder
ab << data.scalings;
return ab;
}
inline driver_svh::ArrayBuilder& operator>>(driver_svh::ArrayBuilder& ab, SVHEncoderSettings& data)
{
ab >> data.scalings;
return ab;
}
inline std::ostream& operator<<(std::ostream& o, const SVHEncoderSettings& es)
{
o << "Scalings: ";
for (size_t i = 0; i < es.scalings.size(); i++)
{
o << (int)i << ":" << es.scalings[i] << " ";
}
o << std::endl;
return o;
}
} // namespace driver_svh
#endif // SVHENCODERSETTINGS_H