* Added VariableState to Plugin API documentation * More fixes for plugin documentation * Added ie_memory_state.hpp to documentation * Added proper dependencies between C++ and Plugin API targets * Fixed issues in public C++ API reference * Fixed issues in public C++ API reference: part 2 * Removed obsolete entries from EXCLUDE_SYMBOLS in doxygen config * Fixed path to examples, tag files for Plugin API doxygen file * Put impl to a private section for VariableStatebase * Fixed examples path to Plugin API: part 2 * Fixed path to examples in main ie_docs doxygen file * Replaced path to snippets; otherwise path depends on how cloned repo is named * Added path to snippets for ie_docs doxygen file as well * Great amount of fixes for documentation * Removed IE_SET_METRIC * Fixes for C API documentation * More fixes for documentation * Restored Transformations API as a part of Plugin API * Fixed tag files usage for Plugin API * Fixed link to FakeQuantize operation
70 lines
1.7 KiB
C++
70 lines
1.7 KiB
C++
// Copyright (C) 2018-2020 Intel Corporation
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
//
|
|
|
|
/**
|
|
* @brief This is a header file with common inference engine definitions
|
|
*
|
|
* @file ie_unicode.hpp
|
|
*/
|
|
#pragma once
|
|
|
|
#include <algorithm>
|
|
#include <cstdlib>
|
|
#include <memory>
|
|
#include <ostream>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#ifdef UNICODE
|
|
typedef wchar_t tchar;
|
|
typedef std::wstring file_name_t;
|
|
#else
|
|
typedef char tchar;
|
|
typedef std::string file_name_t;
|
|
#endif
|
|
|
|
namespace InferenceEngine {
|
|
|
|
/**
|
|
* @deprecated Use OS-native conversion utilities
|
|
* @brief Conversion from possibly-wide character string to a single-byte chain.
|
|
* @param str A possibly-wide character string
|
|
* @return A single-byte character string
|
|
*/
|
|
INFERENCE_ENGINE_DEPRECATED("Use OS-native conversion utilities")
|
|
inline std::string fileNameToString(const file_name_t& str) {
|
|
#ifdef UNICODE
|
|
size_t maxlen = (str.length() + 1) * sizeof(wchar_t) / sizeof(char);
|
|
std::vector<char> mbstr(maxlen);
|
|
mbstr[0] = 0;
|
|
std::wcstombs(&mbstr[0], str.c_str(), maxlen);
|
|
std::string res = std::string(&mbstr[0]);
|
|
return res;
|
|
#else
|
|
return str;
|
|
#endif
|
|
}
|
|
|
|
/**
|
|
* @deprecated Use OS-native conversion utilities
|
|
* @brief Conversion from single-byte character string to a possibly-wide one
|
|
* @param str A single-byte character string
|
|
* @return A possibly-wide character string
|
|
*/
|
|
INFERENCE_ENGINE_DEPRECATED("Use OS-native conversion utilities")
|
|
inline file_name_t stringToFileName(const std::string& str) {
|
|
#ifdef UNICODE
|
|
size_t maxlen = str.length() + 1;
|
|
std::vector<wchar_t> wcstr(maxlen);
|
|
wcstr[0] = 0;
|
|
std::mbstowcs(&wcstr[0], str.c_str(), maxlen);
|
|
file_name_t res = file_name_t(&wcstr[0]);
|
|
return res;
|
|
#else
|
|
return str;
|
|
#endif
|
|
}
|
|
|
|
} // namespace InferenceEngine
|