84 lines
2.0 KiB
C++
84 lines
2.0 KiB
C++
/**
|
|
* @file mix_cc/ihyper_db/utility.h
|
|
* @brief ihyper_db 库的工具库声明
|
|
* @author Cat (null.null.null@qq.com)
|
|
* @version 0.1
|
|
* @date 2021-09-17
|
|
*
|
|
* Copyright: Baosight Co. Ltd.
|
|
* DO NOT COPY/USE WITHOUT PERMISSION
|
|
*
|
|
*/
|
|
#pragma once
|
|
#include <mix_cc/exception.h>
|
|
#include <mix_cc/type/range.h>
|
|
#include "ihdb_inc/error_code.h"
|
|
#include "ihdb_inc/data_types.h"
|
|
#include "ihdb_inc/hd3Enum.h"
|
|
#include "ihdb_inc/hd3MaskDefine.h"
|
|
#include "ihdb_inc/hd3Struct.h"
|
|
#include "ihdb_inc/hdKingAPI.h"
|
|
#include <chrono>
|
|
#include <map>
|
|
#include <memory>
|
|
#include <mutex>
|
|
#include <string>
|
|
#include <type_traits>
|
|
#include <typeinfo>
|
|
#include <vector>
|
|
|
|
namespace mix_cc {
|
|
namespace ihd {
|
|
|
|
using std::chrono::duration_cast;
|
|
using std::chrono::milliseconds;
|
|
using std::chrono::seconds;
|
|
using std::chrono::system_clock;
|
|
|
|
|
|
using TimePoint = system_clock::time_point;
|
|
using TimeDur = milliseconds;
|
|
|
|
|
|
/**
|
|
* @brief 把time_range_t 转化成ihdb自己的时间范围类型
|
|
* @param my_range My Param doc
|
|
* @return HD3TimeRegion
|
|
*/
|
|
HD3TimeRegion convert_to_hd_tr(const time_range_t& my_range);
|
|
|
|
/**
|
|
* @brief 把std::chrono::system_clock时间 转化成ihdb自己的时间类型
|
|
* @param time_point My Param doc
|
|
* @return HD3Time
|
|
*/
|
|
HD3Time convert_to_hd_tp(std::chrono::system_clock::time_point time_point);
|
|
|
|
/**
|
|
* @brief 把ihdb自己的时间范围类型 转换成time_range_t
|
|
* @param time_region My Param doc
|
|
* @return time_range_t
|
|
*/
|
|
time_range_t convert_to_tr(const HD3TimeRegion& time_region);
|
|
|
|
/**
|
|
* @brief 把ihdb自己的时间类型 system_clock
|
|
* @param time_region My Param doc
|
|
* @return time_range_t
|
|
*/
|
|
std::chrono::system_clock::time_point convert_to_tp(uint64_t nSec,
|
|
unsigned int nMsec);
|
|
|
|
/**
|
|
* @brief 把ihdb自己的时间类型 转换成毫秒值
|
|
* @param time_region My Param doc
|
|
* @return time_range_t
|
|
*/
|
|
template <typename T>
|
|
T ConvertHdTp2MilSec(uint64_t nSec, unsigned int nMsec) {
|
|
return (nSec * 1000 + nMsec);
|
|
}
|
|
} // namespace ihd
|
|
|
|
} // namespace mix_cc
|