Files
compute-runtime/offline_compiler/decoder/helper.h
Maciej Dziuban 0b5f810142 Do not print error messages from BinaryEncoder/BinaryDecoder in tests
Change-Id: I45d339c233f9a45724db8d84bf5c5bd66233dcab
Signed-off-by: Maciej Dziuban <maciej.dziuban@intel.com>
2019-03-29 09:09:38 +01:00

42 lines
985 B
C++

/*
* Copyright (C) 2018-2019 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include <exception>
#include <string>
#include <vector>
void addSlash(std::string &path);
std::vector<char> readBinaryFile(const std::string &fileName);
void readFileToVectorOfStrings(std::vector<std::string> &lines, const std::string &fileName, bool replaceTabs = false);
size_t findPos(const std::vector<std::string> &lines, const std::string &whatToFind);
class MessagePrinter {
public:
MessagePrinter() = default;
MessagePrinter(bool suppressMessages) : suppressMessages(suppressMessages) {}
void printf(const char *message) {
if (!suppressMessages) {
::printf("%s", message);
}
}
template <typename... Args>
void printf(const char *format, Args... args) {
if (!suppressMessages) {
::printf(format, std::forward<Args>(args)...);
}
}
private:
bool suppressMessages = false;
};