blob: 8a7a3932eb88cc0902b720b4c6c7349eb60e74ad [file] [log] [blame]
anjana_sreekumar@infosys.com991c2062020-01-08 11:42:57 +05301/*
2 * Copyright (c) 2019, Infosys Ltd.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef DEBUG_H_
18#define DEBUG_H_
19
20#include <iostream>
21#include <sstream>
22#include <stdint.h>
23
24using namespace std;
25
26namespace cmn
27{
28namespace utils
29{
30typedef enum{
31 LEVEL_1,
32 LEVEL_2,
33 LEVEL_3,
34 LEVEL_4
35 }DebugLevel;
36
37
38class Debug{
39public:
40 Debug();
41 ~Debug();
42
43 void printDebugStream();
44 void printDebugStreamToFile();
45
46 void add(char* data);
47 void add(uint8_t data);
48 void add(uint16_t data);
49 void add(uint32_t data);
50 void add(uint64_t data);
51
52 void endOfLine();
53 void startNewLine();
54 void incrIndent();
55 void decrIndent();
56
57 void clearStream();
58
59 void setHexOutput();
60 void unsetHexOutput();
61
62private:
63
64 ostringstream stream;
65 uint8_t indent;
66 bool newLine;
67};
68};
69};
70
71#endif /* DEBUGUTILS_H_ */
72