utils.h
Go to the documentation of this file.
00001 /******************************************************************************
00002  *   Copyright (C) 2013-2014 by Alexander Rykovanov                        *
00003  *   rykovanov.as@gmail.com                                                   *
00004  *                                                                            *
00005  *   This library is free software; you can redistribute it and/or modify     *
00006  *   it under the terms of the GNU Lesser General Public License as           *
00007  *   published by the Free Software Foundation; version 3 of the License.     *
00008  *                                                                            *
00009  *   This library is distributed in the hope that it will be useful,          *
00010  *   but WITHOUT ANY WARRANTY; without even the implied warranty of           *
00011  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            *
00012  *   GNU Lesser General Public License for more details.                      *
00013  *                                                                            *
00014  *   You should have received a copy of the GNU Lesser General Public License *
00015  *   along with this library; if not, write to the                            *
00016  *   Free Software Foundation, Inc.,                                          *
00017  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.                *
00018  ******************************************************************************/
00019 
00020 #pragma once
00021 
00022 #include <algorithm>
00023 #include <iostream>
00024 #include <vector>
00025 #include <algorithm>
00026 
00027 namespace OpcUa
00028 {
00029 
00030   inline void PrintBlob(const std::vector<char>& buf, std::size_t size)
00031   {
00032     size = std::min(size, buf.size());
00033     unsigned pos = 0;
00034     std::cout << "Data size: " << size << std::endl;
00035     while (pos < size)
00036     {
00037       if (pos)
00038         printf((pos % 16 == 0) ? "\n" : " ");
00039 
00040       const char letter = buf[pos];
00041       printf("%02x", (unsigned)letter & 0x000000FF);
00042 
00043       if (letter > ' ')
00044         std::cout << "(" << letter << ")";
00045       else
00046         std::cout << "   ";
00047 
00048       ++pos;
00049     }
00050 
00051     std::cout << std::endl << std::flush;
00052   }
00053 
00054   inline void PrintBlob(const std::vector<char>& buf)
00055   {
00056     PrintBlob(buf, buf.size());
00057   }
00058 
00059 
00060 }


ros_opcua_impl_freeopcua
Author(s): Denis Štogl
autogenerated on Sat Jun 8 2019 18:24:57