SSP21-CPP
PrintHex.h
1 /*
2  * Copyright (c) 2016, Automatak LLC
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
6  * following conditions are met:
7  *
8  * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following
9  * disclaimer.
10  *
11  * 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following
12  * disclaimer in the documentation and/or other materials provided with the distribution.
13  *
14  * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote
15  * products derived from this software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
18  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
21  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
22  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
23  * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24  */
25 #ifndef SSP21_PRINTHEX_H
26 #define SSP21_PRINTHEX_H
27 
28 #include "ser4cpp/util/Uncopyable.h"
29 #include "ssp21/util/SequenceTypes.h"
30 
31 #include <iostream>
32 #include <iomanip>
33 #include <string>
34 
35 namespace ssp21
36 {
37  class PrintHex : private ser4cpp::StaticOnly
38  {
39 
40  public:
41 
42  static void print_line(const seq32_t& data)
43  {
44  for (uint32_t i = 0; i < data.length(); ++i)
45  {
46  std::cout << std::hex << std::setfill('0') << std::setw(2) << (int) data[i] << " ";
47  }
48 
49  std::cout << std::endl;
50  }
51 
52  };
53 
54 }
55 
56 #endif
SSP21-cpp main namespace.
Definition: BufferTypes.h:12