搭建代码框架并更新文档
This commit is contained in:
11
core/src/codec/codec_interface.cpp
Normal file
11
core/src/codec/codec_interface.cpp
Normal file
@@ -0,0 +1,11 @@
|
||||
#include "displayflow/core/codec/codec_interface.h"
|
||||
|
||||
namespace displayflow {
|
||||
namespace core {
|
||||
|
||||
// ICodec 接口实现
|
||||
// 目前只有头文件定义,此文件保留用于未来扩展
|
||||
|
||||
} // namespace core
|
||||
} // namespace displayflow
|
||||
|
||||
26
core/src/codec/codec_manager.cpp
Normal file
26
core/src/codec/codec_manager.cpp
Normal file
@@ -0,0 +1,26 @@
|
||||
#include "displayflow/core/codec/codec_manager.h"
|
||||
|
||||
namespace displayflow {
|
||||
namespace core {
|
||||
|
||||
CodecManager::CodecManager() {
|
||||
// TODO: 实现构造函数
|
||||
}
|
||||
|
||||
CodecManager::~CodecManager() {
|
||||
// TODO: 实现析构函数
|
||||
}
|
||||
|
||||
bool CodecManager::Initialize() {
|
||||
// TODO: 实现初始化逻辑
|
||||
return false;
|
||||
}
|
||||
|
||||
std::shared_ptr<ICodec> CodecManager::GetCodec(CodecType type) {
|
||||
// TODO: 实现获取编解码器逻辑
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
} // namespace core
|
||||
} // namespace displayflow
|
||||
|
||||
47
core/src/file_transfer/file_transfer_manager.cpp
Normal file
47
core/src/file_transfer/file_transfer_manager.cpp
Normal file
@@ -0,0 +1,47 @@
|
||||
#include "displayflow/core/file_transfer/file_transfer_manager.h"
|
||||
|
||||
namespace displayflow {
|
||||
namespace core {
|
||||
|
||||
FileTransferManager::FileTransferManager() {
|
||||
// TODO: 实现构造函数
|
||||
}
|
||||
|
||||
FileTransferManager::~FileTransferManager() {
|
||||
// TODO: 实现析构函数
|
||||
}
|
||||
|
||||
uint64_t FileTransferManager::SendFile(const std::string& filePath, SessionId sessionId) {
|
||||
// TODO: 实现发送文件逻辑
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint64_t FileTransferManager::ReceiveFile(const std::string& fileName, uint64_t fileSize,
|
||||
const std::string& savePath, SessionId sessionId) {
|
||||
// TODO: 实现接收文件逻辑
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool FileTransferManager::PauseTransfer(uint64_t transferId) {
|
||||
// TODO: 实现暂停传输逻辑
|
||||
return false;
|
||||
}
|
||||
|
||||
bool FileTransferManager::ResumeTransfer(uint64_t transferId) {
|
||||
// TODO: 实现恢复传输逻辑
|
||||
return false;
|
||||
}
|
||||
|
||||
bool FileTransferManager::CancelTransfer(uint64_t transferId) {
|
||||
// TODO: 实现取消传输逻辑
|
||||
return false;
|
||||
}
|
||||
|
||||
double FileTransferManager::GetTransferProgress(uint64_t transferId) const {
|
||||
// TODO: 实现获取传输进度逻辑
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
} // namespace core
|
||||
} // namespace displayflow
|
||||
|
||||
45
core/src/file_transfer/file_transfer_session.cpp
Normal file
45
core/src/file_transfer/file_transfer_session.cpp
Normal file
@@ -0,0 +1,45 @@
|
||||
#include "displayflow/core/file_transfer/file_transfer_session.h"
|
||||
|
||||
namespace displayflow {
|
||||
namespace core {
|
||||
|
||||
FileTransferSession::FileTransferSession(uint64_t id, TransferDirection direction)
|
||||
: id_(id), direction_(direction) {
|
||||
// TODO: 实现构造函数
|
||||
}
|
||||
|
||||
FileTransferSession::~FileTransferSession() {
|
||||
// TODO: 实现析构函数
|
||||
}
|
||||
|
||||
void FileTransferSession::Start() {
|
||||
// TODO: 实现启动传输逻辑
|
||||
status_ = TransferStatus::InProgress;
|
||||
}
|
||||
|
||||
void FileTransferSession::Pause() {
|
||||
// TODO: 实现暂停逻辑
|
||||
status_ = TransferStatus::Paused;
|
||||
}
|
||||
|
||||
void FileTransferSession::Resume() {
|
||||
// TODO: 实现恢复逻辑
|
||||
status_ = TransferStatus::InProgress;
|
||||
}
|
||||
|
||||
void FileTransferSession::Cancel() {
|
||||
// TODO: 实现取消逻辑
|
||||
status_ = TransferStatus::Cancelled;
|
||||
}
|
||||
|
||||
TransferProgress FileTransferSession::GetProgress() const {
|
||||
return progress_;
|
||||
}
|
||||
|
||||
void FileTransferSession::SetProgressCallback(std::function<void(const TransferProgress&)> callback) {
|
||||
progressCallback_ = callback;
|
||||
}
|
||||
|
||||
} // namespace core
|
||||
} // namespace displayflow
|
||||
|
||||
34
core/src/network/nat_traversal/candidate.cpp
Normal file
34
core/src/network/nat_traversal/candidate.cpp
Normal file
@@ -0,0 +1,34 @@
|
||||
#include "displayflow/core/network/nat_traversal/candidate.h"
|
||||
|
||||
namespace displayflow {
|
||||
namespace core {
|
||||
|
||||
uint32_t CalculateCandidatePriority(const Candidate& candidate) {
|
||||
// 根据 RFC 8445 计算候选地址优先级
|
||||
// priority = (2^24) * (type preference) + (2^8) * (local preference) + (2^0) * (component ID)
|
||||
|
||||
uint32_t typePreference = 0;
|
||||
switch (candidate.type) {
|
||||
case CandidateType::Host:
|
||||
typePreference = 126; // 最高优先级
|
||||
break;
|
||||
case CandidateType::ServerReflexive:
|
||||
typePreference = 100;
|
||||
break;
|
||||
case CandidateType::PeerReflexive:
|
||||
typePreference = 110;
|
||||
break;
|
||||
case CandidateType::Relayed:
|
||||
typePreference = 0; // 最低优先级
|
||||
break;
|
||||
}
|
||||
|
||||
uint32_t localPreference = 65535; // 默认值
|
||||
uint32_t componentId = 1; // 默认值
|
||||
|
||||
return (typePreference << 24) | (localPreference << 8) | componentId;
|
||||
}
|
||||
|
||||
} // namespace core
|
||||
} // namespace displayflow
|
||||
|
||||
69
core/src/network/nat_traversal/ice_agent.cpp
Normal file
69
core/src/network/nat_traversal/ice_agent.cpp
Normal file
@@ -0,0 +1,69 @@
|
||||
#include "displayflow/core/network/nat_traversal/ice_agent.h"
|
||||
|
||||
namespace displayflow {
|
||||
namespace core {
|
||||
|
||||
IceAgent::IceAgent() {
|
||||
// TODO: 实现构造函数
|
||||
}
|
||||
|
||||
IceAgent::~IceAgent() {
|
||||
// TODO: 实现析构函数
|
||||
}
|
||||
|
||||
bool IceAgent::Initialize(const IceConfig& config) {
|
||||
config_ = config;
|
||||
stunClient_.SetServer(config.stunServer);
|
||||
turnClient_.SetServer(config.turnServer);
|
||||
return true;
|
||||
}
|
||||
|
||||
std::vector<Candidate> IceAgent::GatherCandidates() {
|
||||
// TODO: 实现收集候选地址
|
||||
// 1. 收集本地网络接口地址
|
||||
// 2. 通过 STUN 获取服务器反射地址
|
||||
// 3. 通过 TURN 获取中继地址
|
||||
return {};
|
||||
}
|
||||
|
||||
void IceAgent::SetRemoteCandidates(const std::vector<Candidate>& candidates) {
|
||||
remoteCandidates_ = candidates;
|
||||
}
|
||||
|
||||
bool IceAgent::PerformConnectivityChecks() {
|
||||
// TODO: 实现连接检查
|
||||
// 1. 生成候选地址对
|
||||
// 2. 按优先级排序
|
||||
// 3. 执行连接检查
|
||||
// 4. 选择最佳路径
|
||||
return false;
|
||||
}
|
||||
|
||||
IceCandidatePair IceAgent::GetSelectedPair() const {
|
||||
return selectedPair_;
|
||||
}
|
||||
|
||||
std::string IceAgent::GetConnectionType() const {
|
||||
if (selectedPair_.valid) {
|
||||
switch (selectedPair_.local.type) {
|
||||
case CandidateType::Host:
|
||||
return "local";
|
||||
case CandidateType::ServerReflexive:
|
||||
return "stun";
|
||||
case CandidateType::Relayed:
|
||||
return "turn";
|
||||
default:
|
||||
return "unknown";
|
||||
}
|
||||
}
|
||||
return "unknown";
|
||||
}
|
||||
|
||||
void IceAgent::Cleanup() {
|
||||
// TODO: 实现清理逻辑
|
||||
turnClient_.ReleaseAllocation();
|
||||
}
|
||||
|
||||
} // namespace core
|
||||
} // namespace displayflow
|
||||
|
||||
32
core/src/network/nat_traversal/nat_type.cpp
Normal file
32
core/src/network/nat_traversal/nat_type.cpp
Normal file
@@ -0,0 +1,32 @@
|
||||
#include "displayflow/core/network/nat_traversal/nat_type.h"
|
||||
|
||||
namespace displayflow {
|
||||
namespace core {
|
||||
|
||||
const char* NatTypeToString(NatType type) {
|
||||
switch (type) {
|
||||
case NatType::Unknown:
|
||||
return "Unknown";
|
||||
case NatType::Open:
|
||||
return "Open";
|
||||
case NatType::FullCone:
|
||||
return "Full Cone";
|
||||
case NatType::RestrictedCone:
|
||||
return "Restricted Cone";
|
||||
case NatType::PortRestrictedCone:
|
||||
return "Port Restricted Cone";
|
||||
case NatType::Symmetric:
|
||||
return "Symmetric";
|
||||
default:
|
||||
return "Unknown";
|
||||
}
|
||||
}
|
||||
|
||||
bool IsNatTypeDirectConnectable(NatType type) {
|
||||
// 只有开放和完全锥形 NAT 可以直接连接
|
||||
return type == NatType::Open || type == NatType::FullCone;
|
||||
}
|
||||
|
||||
} // namespace core
|
||||
} // namespace displayflow
|
||||
|
||||
37
core/src/network/nat_traversal/stun_client.cpp
Normal file
37
core/src/network/nat_traversal/stun_client.cpp
Normal file
@@ -0,0 +1,37 @@
|
||||
#include "displayflow/core/network/nat_traversal/stun_client.h"
|
||||
|
||||
namespace displayflow {
|
||||
namespace core {
|
||||
|
||||
StunClient::StunClient() {
|
||||
// TODO: 实现构造函数
|
||||
}
|
||||
|
||||
StunClient::~StunClient() {
|
||||
// TODO: 实现析构函数
|
||||
}
|
||||
|
||||
void StunClient::SetServer(const StunServerConfig& config) {
|
||||
serverConfig_ = config;
|
||||
}
|
||||
|
||||
StunResponse StunClient::PerformBindingRequest(uint16_t localPort) {
|
||||
// TODO: 实现 STUN 绑定请求
|
||||
StunResponse response;
|
||||
response.success = false;
|
||||
return response;
|
||||
}
|
||||
|
||||
NatType StunClient::DetectNatType() {
|
||||
// TODO: 实现 NAT 类型检测
|
||||
return NatType::Unknown;
|
||||
}
|
||||
|
||||
std::string StunClient::GetPublicIp() {
|
||||
// TODO: 实现获取公网 IP
|
||||
return "";
|
||||
}
|
||||
|
||||
} // namespace core
|
||||
} // namespace displayflow
|
||||
|
||||
47
core/src/network/nat_traversal/turn_client.cpp
Normal file
47
core/src/network/nat_traversal/turn_client.cpp
Normal file
@@ -0,0 +1,47 @@
|
||||
#include "displayflow/core/network/nat_traversal/turn_client.h"
|
||||
|
||||
namespace displayflow {
|
||||
namespace core {
|
||||
|
||||
TurnClient::TurnClient() {
|
||||
// TODO: 实现构造函数
|
||||
}
|
||||
|
||||
TurnClient::~TurnClient() {
|
||||
// TODO: 实现析构函数
|
||||
}
|
||||
|
||||
void TurnClient::SetServer(const TurnServerConfig& config) {
|
||||
serverConfig_ = config;
|
||||
}
|
||||
|
||||
Candidate TurnClient::AllocateRelayAddress() {
|
||||
// TODO: 实现分配中继地址
|
||||
Candidate candidate;
|
||||
candidate.type = CandidateType::Relayed;
|
||||
return candidate;
|
||||
}
|
||||
|
||||
bool TurnClient::CreatePermission(const std::string& peerIp) {
|
||||
// TODO: 实现创建权限
|
||||
return false;
|
||||
}
|
||||
|
||||
bool TurnClient::SendData(const ByteArray& data, const std::string& peerIp, uint16_t peerPort) {
|
||||
// TODO: 实现发送数据
|
||||
return false;
|
||||
}
|
||||
|
||||
bool TurnClient::ReceiveData(ByteArray& data, std::string& peerIp, uint16_t& peerPort) {
|
||||
// TODO: 实现接收数据
|
||||
return false;
|
||||
}
|
||||
|
||||
void TurnClient::ReleaseAllocation() {
|
||||
// TODO: 实现释放分配
|
||||
allocated_ = false;
|
||||
}
|
||||
|
||||
} // namespace core
|
||||
} // namespace displayflow
|
||||
|
||||
11
core/src/network/network_interface.cpp
Normal file
11
core/src/network/network_interface.cpp
Normal file
@@ -0,0 +1,11 @@
|
||||
#include "displayflow/core/network/network_interface.h"
|
||||
|
||||
namespace displayflow {
|
||||
namespace core {
|
||||
|
||||
// NetworkInterface 结构体实现
|
||||
// 目前只有头文件定义,此文件保留用于未来扩展
|
||||
|
||||
} // namespace core
|
||||
} // namespace displayflow
|
||||
|
||||
35
core/src/network/network_manager.cpp
Normal file
35
core/src/network/network_manager.cpp
Normal file
@@ -0,0 +1,35 @@
|
||||
#include "displayflow/core/network/network_manager.h"
|
||||
|
||||
namespace displayflow {
|
||||
namespace core {
|
||||
|
||||
NetworkManager::NetworkManager() {
|
||||
// TODO: 实现构造函数
|
||||
}
|
||||
|
||||
NetworkManager::~NetworkManager() {
|
||||
// TODO: 实现析构函数
|
||||
}
|
||||
|
||||
bool NetworkManager::Initialize() {
|
||||
// TODO: 实现初始化逻辑
|
||||
return false;
|
||||
}
|
||||
|
||||
std::vector<NetworkInterface> NetworkManager::GetAvailableInterfaces() {
|
||||
// TODO: 实现获取可用网络接口
|
||||
return {};
|
||||
}
|
||||
|
||||
bool NetworkManager::Connect(const NetworkInterface& interface) {
|
||||
// TODO: 实现连接逻辑
|
||||
return false;
|
||||
}
|
||||
|
||||
void NetworkManager::Disconnect() {
|
||||
// TODO: 实现断开连接逻辑
|
||||
}
|
||||
|
||||
} // namespace core
|
||||
} // namespace displayflow
|
||||
|
||||
26
core/src/protocol/message_serializer.cpp
Normal file
26
core/src/protocol/message_serializer.cpp
Normal file
@@ -0,0 +1,26 @@
|
||||
#include "displayflow/core/protocol/message_serializer.h"
|
||||
|
||||
namespace displayflow {
|
||||
namespace core {
|
||||
|
||||
MessageSerializer::MessageSerializer() {
|
||||
// TODO: 实现构造函数
|
||||
}
|
||||
|
||||
MessageSerializer::~MessageSerializer() {
|
||||
// TODO: 实现析构函数
|
||||
}
|
||||
|
||||
ByteArray MessageSerializer::Serialize(const void* message) {
|
||||
// TODO: 实现序列化逻辑
|
||||
return {};
|
||||
}
|
||||
|
||||
bool MessageSerializer::Deserialize(const ByteArray& data, void* message) {
|
||||
// TODO: 实现反序列化逻辑
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace core
|
||||
} // namespace displayflow
|
||||
|
||||
21
core/src/protocol/protocol_handler.cpp
Normal file
21
core/src/protocol/protocol_handler.cpp
Normal file
@@ -0,0 +1,21 @@
|
||||
#include "displayflow/core/protocol/protocol_handler.h"
|
||||
|
||||
namespace displayflow {
|
||||
namespace core {
|
||||
|
||||
ProtocolHandler::ProtocolHandler() {
|
||||
// TODO: 实现构造函数
|
||||
}
|
||||
|
||||
ProtocolHandler::~ProtocolHandler() {
|
||||
// TODO: 实现析构函数
|
||||
}
|
||||
|
||||
bool ProtocolHandler::Initialize() {
|
||||
// TODO: 实现初始化逻辑
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace core
|
||||
} // namespace displayflow
|
||||
|
||||
33
core/src/role/client_role.cpp
Normal file
33
core/src/role/client_role.cpp
Normal file
@@ -0,0 +1,33 @@
|
||||
#include "displayflow/core/role/client_role.h"
|
||||
|
||||
namespace displayflow {
|
||||
namespace core {
|
||||
|
||||
ClientRole::ClientRole() {
|
||||
// TODO: 实现构造函数
|
||||
}
|
||||
|
||||
ClientRole::~ClientRole() {
|
||||
// TODO: 实现析构函数
|
||||
}
|
||||
|
||||
RoleType ClientRole::GetType() const {
|
||||
return RoleType::Client;
|
||||
}
|
||||
|
||||
bool ClientRole::Start(std::shared_ptr<Session> session) {
|
||||
// TODO: 实现启动逻辑
|
||||
return false;
|
||||
}
|
||||
|
||||
void ClientRole::Stop() {
|
||||
// TODO: 实现停止逻辑
|
||||
}
|
||||
|
||||
bool ClientRole::IsRunning() const {
|
||||
return isRunning_;
|
||||
}
|
||||
|
||||
} // namespace core
|
||||
} // namespace displayflow
|
||||
|
||||
33
core/src/role/host_role.cpp
Normal file
33
core/src/role/host_role.cpp
Normal file
@@ -0,0 +1,33 @@
|
||||
#include "displayflow/core/role/host_role.h"
|
||||
|
||||
namespace displayflow {
|
||||
namespace core {
|
||||
|
||||
HostRole::HostRole() {
|
||||
// TODO: 实现构造函数
|
||||
}
|
||||
|
||||
HostRole::~HostRole() {
|
||||
// TODO: 实现析构函数
|
||||
}
|
||||
|
||||
RoleType HostRole::GetType() const {
|
||||
return RoleType::Host;
|
||||
}
|
||||
|
||||
bool HostRole::Start(std::shared_ptr<Session> session) {
|
||||
// TODO: 实现启动逻辑
|
||||
return false;
|
||||
}
|
||||
|
||||
void HostRole::Stop() {
|
||||
// TODO: 实现停止逻辑
|
||||
}
|
||||
|
||||
bool HostRole::IsRunning() const {
|
||||
return isRunning_;
|
||||
}
|
||||
|
||||
} // namespace core
|
||||
} // namespace displayflow
|
||||
|
||||
33
core/src/role/peer_role.cpp
Normal file
33
core/src/role/peer_role.cpp
Normal file
@@ -0,0 +1,33 @@
|
||||
#include "displayflow/core/role/peer_role.h"
|
||||
|
||||
namespace displayflow {
|
||||
namespace core {
|
||||
|
||||
PeerRole::PeerRole() {
|
||||
// TODO: 实现构造函数
|
||||
}
|
||||
|
||||
PeerRole::~PeerRole() {
|
||||
// TODO: 实现析构函数
|
||||
}
|
||||
|
||||
RoleType PeerRole::GetType() const {
|
||||
return RoleType::Peer;
|
||||
}
|
||||
|
||||
bool PeerRole::Start(std::shared_ptr<Session> session) {
|
||||
// TODO: 实现启动逻辑(同时启动 Host 和 Client)
|
||||
return false;
|
||||
}
|
||||
|
||||
void PeerRole::Stop() {
|
||||
// TODO: 实现停止逻辑
|
||||
}
|
||||
|
||||
bool PeerRole::IsRunning() const {
|
||||
return isRunning_;
|
||||
}
|
||||
|
||||
} // namespace core
|
||||
} // namespace displayflow
|
||||
|
||||
26
core/src/role/role_manager.cpp
Normal file
26
core/src/role/role_manager.cpp
Normal file
@@ -0,0 +1,26 @@
|
||||
#include "displayflow/core/role/role_manager.h"
|
||||
|
||||
namespace displayflow {
|
||||
namespace core {
|
||||
|
||||
RoleManager::RoleManager() {
|
||||
// TODO: 实现构造函数
|
||||
}
|
||||
|
||||
RoleManager::~RoleManager() {
|
||||
// TODO: 实现析构函数
|
||||
}
|
||||
|
||||
bool RoleManager::RegisterRole(RoleType type, std::shared_ptr<IRole> role) {
|
||||
// TODO: 实现角色注册逻辑
|
||||
return false;
|
||||
}
|
||||
|
||||
bool RoleManager::SwitchRole(SessionId sessionId, RoleType newRole) {
|
||||
// TODO: 实现角色切换逻辑
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace core
|
||||
} // namespace displayflow
|
||||
|
||||
39
core/src/session/session.cpp
Normal file
39
core/src/session/session.cpp
Normal file
@@ -0,0 +1,39 @@
|
||||
#include "displayflow/core/session/session.h"
|
||||
|
||||
namespace displayflow {
|
||||
namespace core {
|
||||
|
||||
Session::Session(SessionId id, RoleType role)
|
||||
: id_(id), role_(role) {
|
||||
// TODO: 实现构造函数
|
||||
}
|
||||
|
||||
Session::~Session() {
|
||||
// TODO: 实现析构函数
|
||||
}
|
||||
|
||||
SessionId Session::GetId() const {
|
||||
return id_;
|
||||
}
|
||||
|
||||
RoleType Session::GetRole() const {
|
||||
return role_;
|
||||
}
|
||||
|
||||
bool Session::IsActive() const {
|
||||
return isActive_;
|
||||
}
|
||||
|
||||
void Session::Start() {
|
||||
// TODO: 实现启动逻辑
|
||||
isActive_ = true;
|
||||
}
|
||||
|
||||
void Session::Stop() {
|
||||
// TODO: 实现停止逻辑
|
||||
isActive_ = false;
|
||||
}
|
||||
|
||||
} // namespace core
|
||||
} // namespace displayflow
|
||||
|
||||
30
core/src/session/session_manager.cpp
Normal file
30
core/src/session/session_manager.cpp
Normal file
@@ -0,0 +1,30 @@
|
||||
#include "displayflow/core/session/session_manager.h"
|
||||
|
||||
namespace displayflow {
|
||||
namespace core {
|
||||
|
||||
SessionManager::SessionManager() {
|
||||
// TODO: 实现构造函数
|
||||
}
|
||||
|
||||
SessionManager::~SessionManager() {
|
||||
// TODO: 实现析构函数
|
||||
}
|
||||
|
||||
std::shared_ptr<Session> SessionManager::CreateSession(RoleType role) {
|
||||
// TODO: 实现会话创建逻辑
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void SessionManager::DestroySession(SessionId sessionId) {
|
||||
// TODO: 实现会话销毁逻辑
|
||||
}
|
||||
|
||||
std::shared_ptr<Session> SessionManager::GetSession(SessionId sessionId) {
|
||||
// TODO: 实现获取会话逻辑
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
} // namespace core
|
||||
} // namespace displayflow
|
||||
|
||||
22
core/src/utils/logger.cpp
Normal file
22
core/src/utils/logger.cpp
Normal file
@@ -0,0 +1,22 @@
|
||||
#include "displayflow/core/utils/logger.h"
|
||||
#include <iostream>
|
||||
|
||||
namespace displayflow {
|
||||
namespace core {
|
||||
|
||||
Logger::Logger() {
|
||||
// TODO: 实现构造函数
|
||||
}
|
||||
|
||||
Logger::~Logger() {
|
||||
// TODO: 实现析构函数
|
||||
}
|
||||
|
||||
void Logger::Log(LogLevel level, const std::string& message) {
|
||||
// TODO: 实现日志记录逻辑
|
||||
std::cout << "[" << static_cast<int>(level) << "] " << message << std::endl;
|
||||
}
|
||||
|
||||
} // namespace core
|
||||
} // namespace displayflow
|
||||
|
||||
23
core/src/utils/timer.cpp
Normal file
23
core/src/utils/timer.cpp
Normal file
@@ -0,0 +1,23 @@
|
||||
#include "displayflow/core/utils/timer.h"
|
||||
#include <chrono>
|
||||
|
||||
namespace displayflow {
|
||||
namespace core {
|
||||
|
||||
Timer::Timer() {
|
||||
// TODO: 实现构造函数
|
||||
}
|
||||
|
||||
Timer::~Timer() {
|
||||
// TODO: 实现析构函数
|
||||
}
|
||||
|
||||
uint64_t Timer::GetCurrentTimeMs() {
|
||||
auto now = std::chrono::steady_clock::now();
|
||||
auto duration = now.time_since_epoch();
|
||||
return std::chrono::duration_cast<std::chrono::milliseconds>(duration).count();
|
||||
}
|
||||
|
||||
} // namespace core
|
||||
} // namespace displayflow
|
||||
|
||||
Reference in New Issue
Block a user