00001 // this is for emacs file handling -*- mode: c++; indent-tabs-mode: nil -*- 00002 00003 // -- BEGIN LICENSE BLOCK ---------------------------------------------- 00004 // This file is part of the SCHUNK SVH Driver suite. 00005 // 00006 // This program is free software licensed under the LGPL 00007 // (GNU LESSER GENERAL PUBLIC LICENSE Version 3). 00008 // You can find a copy of this license in LICENSE folder in the top 00009 // directory of the source code. 00010 // 00011 // © Copyright 2014 SCHUNK Mobile Greifsysteme GmbH, Lauffen/Neckar Germany 00012 // © Copyright 2014 FZI Forschungszentrum Informatik, Karlsruhe, Germany 00013 // 00014 // -- END LICENSE BLOCK ------------------------------------------------ 00015 00016 //---------------------------------------------------------------------- 00028 //---------------------------------------------------------------------- 00029 #ifndef SVHENCODERSETTINGS_H 00030 #define SVHENCODERSETTINGS_H 00031 00032 00033 namespace driver_svh { 00034 00038 struct SVHEncoderSettings { 00039 00041 std::vector<uint32_t> scalings; 00042 00043 // TODO Provide a constructor that allows for seperate encoder settings in the hardware 00048 SVHEncoderSettings(uint32_t _scaling = 1): 00049 scalings(9,_scaling) 00050 {} 00051 00053 bool operator == (const SVHEncoderSettings& other) const 00054 { 00055 return (scalings == other.scalings); 00056 } 00057 }; 00058 00059 00061 inline icl_comm::ArrayBuilder& operator << (icl_comm::ArrayBuilder& ab, const SVHEncoderSettings& data) 00062 { 00063 // Trivial as the vector slicing is already done by the arraybuilder 00064 ab << data.scalings; 00065 return ab; 00066 } 00067 00069 inline icl_comm::ArrayBuilder& operator >> (icl_comm::ArrayBuilder& ab, SVHEncoderSettings& data) 00070 { 00071 ab >> data.scalings; 00072 return ab; 00073 } 00074 00075 00077 inline std::ostream& operator << (std::ostream& o, const SVHEncoderSettings& es) 00078 { 00079 o << "Scalings: "; 00080 for (size_t i = 0; i < es.scalings.size(); i++) 00081 { 00082 o << (int)i << ":" <<es.scalings[i] << " "; 00083 } 00084 00085 o << std::endl; 00086 return o; 00087 } 00088 00089 } 00090 #endif // SVHENCODERSETTINGS_H