Update sdv_packager (#6)

This commit is contained in:
tompzf
2026-03-27 14:12:49 +01:00
committed by GitHub
parent 234be8917f
commit aefefd52f7
717 changed files with 42252 additions and 11334 deletions

View File

@@ -1,13 +1,15 @@
/**
* @file tasktimer.h
* @author Sudipta Babu Durjoy FRD DISS21 (mailto:sudipta.durjoy@zf.com)
* @brief
* @version 1.0
* @date 2023-05-24
*
* @copyright Copyright ZF Friedrichshafen AG (c) 2023
*
*/
/********************************************************************************
* Copyright (c) 2025-2026 ZF Friedrichshafen AG
*
* This program and the accompanying materials are made available under the
* terms of the Apache License Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0
*
* SPDX-License-Identifier: Apache-2.0
*
* Contributors:
* Erik Verhoeven - initial API and implementation
********************************************************************************/
#ifndef TASK_TIMER_H
#define TASK_TIMER_H
@@ -19,6 +21,7 @@
#include <map>
#include <set>
#include <fstream>
#include <atomic>
#ifdef _WIN32
// Resolve conflict
@@ -93,10 +96,10 @@ private:
sdv::core::ITaskExecute* m_pExecute = nullptr; ///< Pointer to the execution callback interface.
#ifdef _WIN32
UINT m_uiTimerID = 0ul; ///< Timer ID
bool m_bPrioritySet = false; ///< When set, the priority of the task was increased.
std::atomic_bool m_bPrioritySet = false; ///< When set, the priority of the task was increased.
#elif defined __unix__
timer_t m_timerid = 0; ///< Timer ID.
bool m_bRunning = false; ///< When set, the timer is running.
std::atomic_bool m_bRunning = false; ///< When set, the timer is running.
std::mutex m_mtxExecution; ///< Prevent killing the timer when in execution.
#endif
};
@@ -104,7 +107,7 @@ private:
/**
* @brief Task timer class to execute task periodically
*/
class CTaskTimerService : public sdv::CSdvObject, public sdv::IObjectControl, public sdv::core::ITaskTimer
class CTaskTimerService : public sdv::CSdvObject, public sdv::core::ITaskTimer
{
public:
/**
@@ -119,41 +122,24 @@ public:
// Interface map
BEGIN_SDV_INTERFACE_MAP()
SDV_INTERFACE_ENTRY(sdv::IObjectControl)
SDV_INTERFACE_ENTRY(sdv::core::ITaskTimer)
END_SDV_INTERFACE_MAP()
// Object declarations
DECLARE_OBJECT_CLASS_TYPE(sdv::EObjectType::SystemObject)
DECLARE_OBJECT_CLASS_TYPE(sdv::EObjectType::system_object)
DECLARE_OBJECT_CLASS_NAME("TaskTimerService")
DECLARE_OBJECT_SINGLETON()
/**
* @brief Initialize the object. Overload of sdv::IObjectControl::Initialize.
* @param[in] ssObjectConfig Optional configuration string.
* @brief Initialization event, called after object configuration was loaded. Overload of sdv::CSdvObject::OnInitialize.
* @return Returns 'true' when the initialization was successful, 'false' when not.
*/
virtual void Initialize(/*in*/ const sdv::u8string& ssObjectConfig) override;
virtual bool OnInitialize() override;
/**
* @brief Get the current status of the object. Overload of sdv::IObjectControl::GetStatus.
* @return Return the current status of the object.
* @brief Shutdown the object. Overload of sdv::CSdvObject::OnShutdown.
*/
virtual sdv::EObjectStatus GetStatus() const override;
/**
* @brief Set the component operation mode. Overload of sdv::IObjectControl::SetOperationMode.
* @param[in] eMode The operation mode, the component should run in.
*/
virtual void SetOperationMode(/*in*/ sdv::EOperationMode eMode) override;
/**
* @brief Shutdown called before the object is destroyed. Overload of sdv::IObjectControl::Shutdown.
* @attention Implement calls to other SDV objects here as this is no longer considered safe during the destructor of the object!
* After a call to shutdown any threads/callbacks/etc that could call other SDV objects need to have been stopped.
* The SDV object itself is to remain in a state where it can respond to calls to its interfaces as other objects may still call it during the shutdown sequence!
* Any subsequent call to GetStatus should return EObjectStatus::destruction_pending
*/
virtual void Shutdown() override;
virtual void OnShutdown() override;
/**
* @brief Method to execute the user-defined task periodically until ShutdownTask is called.
@@ -171,9 +157,8 @@ public:
void RemoveTimer(CTimer* pTimer);
private:
sdv::EObjectStatus m_eObjectStatus = sdv::EObjectStatus::initialization_pending; ///< Object operation status
std::mutex m_mtxTasks; ///< Mutex for tasks
std::map<CTimer*, std::unique_ptr<CTimer>> m_mapTasks; ///< Set to get the active tasks
std::mutex m_mtxTasks; ///< Mutex for tasks
std::map<CTimer*, std::unique_ptr<CTimer>> m_mapTasks; ///< Set to get the active tasks
};
DEFINE_SDV_OBJECT(CTaskTimerService)