Removed pointer from ov::get_openvino_version (#8687)

* Removed pointer from ov::get_openvino_version

* Fixed issues with version print

* Clang-format
This commit is contained in:
Ilya Lavrenov
2021-11-22 15:21:09 +03:00
committed by GitHub
parent b05d90032b
commit 7c10998cf8
14 changed files with 39 additions and 40 deletions

View File

@@ -24,6 +24,7 @@
#include <vector>
#include "openvino/openvino.hpp"
#include "slog.hpp"
#ifndef UNUSED
# if defined(_MSC_VER) && !defined(__clang__)
@@ -101,7 +102,7 @@ inline std::string& trim(std::string& s) {
* @param filepath - full file name
* @return filename without extension
*/
static UNUSED std::string fileNameNoExt(const std::string& filepath) {
inline std::string fileNameNoExt(const std::string& filepath) {
auto pos = filepath.rfind('.');
if (pos == std::string::npos)
return filepath;
@@ -120,46 +121,40 @@ inline std::string fileExt(const std::string& filename) {
return filename.substr(pos + 1);
}
inline std::ostream& operator<<(std::ostream& os, const InferenceEngine::Version& version) {
os << "\t" << version.description << " version ......... ";
os << IE_VERSION_MAJOR << "." << IE_VERSION_MINOR << "." << IE_VERSION_PATCH;
inline slog::LogStream& operator<<(slog::LogStream& os, const InferenceEngine::Version& version) {
os << version.description << " version ......... ";
os << IE_VERSION_MAJOR << "." << IE_VERSION_MINOR << "." << IE_VERSION_PATCH << slog::endl;
os << "\n\tBuild ........... ";
os << version.buildNumber;
os << "Build ........... ";
os << version.buildNumber << slog::endl;
return os;
}
inline std::ostream& operator<<(std::ostream& os, const ov::Version& version) {
os << "\t" << version.description << " version ......... ";
os << OPENVINO_VERSION_MAJOR << "." << OPENVINO_VERSION_MINOR << "." << OPENVINO_VERSION_PATCH;
inline slog::LogStream& operator<<(slog::LogStream& os, const ov::Version& version) {
os << version.description << " version ......... ";
os << OPENVINO_VERSION_MAJOR << "." << OPENVINO_VERSION_MINOR << "." << OPENVINO_VERSION_PATCH << slog::endl;
os << "\n\tBuild ........... ";
os << version.buildNumber;
os << "Build ........... ";
os << version.buildNumber << slog::endl;
return os;
}
inline std::ostream& operator<<(std::ostream& os, const InferenceEngine::Version* version) {
if (nullptr != version) {
os << std::endl << *version;
}
return os;
}
inline std::ostream& operator<<(std::ostream& os, const std::map<std::string, InferenceEngine::Version>& versions) {
inline slog::LogStream& operator<<(slog::LogStream& os,
const std::map<std::string, InferenceEngine::Version>& versions) {
for (auto&& version : versions) {
os << "\t" << version.first << std::endl;
os << version.second << std::endl;
os << version.first << slog::endl;
os << version.second << slog::endl;
}
return os;
}
inline std::ostream& operator<<(std::ostream& os, const std::map<std::string, ov::Version>& versions) {
inline slog::LogStream& operator<<(slog::LogStream& os, const std::map<std::string, ov::Version>& versions) {
for (auto&& version : versions) {
os << "\t" << version.first << std::endl;
os << version.second << std::endl;
os << version.first << slog::endl;
os << version.second << slog::endl;
}
return os;

View File

@@ -18,6 +18,8 @@ LogStream::LogStream(const std::string& prefix, std::ostream& log_stream) : _pre
// Specializing for LogStreamEndLine to support slog::endl
LogStream& LogStream::operator<<(const LogStreamEndLine& /*arg*/) {
if (_new_line)
(*_log_stream) << "[ " << _prefix << " ] ";
_new_line = true;
(*_log_stream) << std::endl;