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,18 +1,22 @@
/**
* @file app.idl
* @brief This file provides the core interface definitions SDV framework administration.
* @version 0.1
* @date 2024.04.11
* @author erik.verhoeven@zf.com
* @copyright Copyright ZF Friedrichshaven AG (c) 2023-2025
*/
/********************************************************************************
* 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
********************************************************************************/
#include "core.idl"
#include "toml.idl"
/**
* @brief Software Defined Vehicle framework.
*/
* @brief Software Defined Vehicle framework.
*/
module sdv
{
/**

View File

@@ -1,19 +1,21 @@
/**
* @file can.idl
* @author Erik Verhoeven FRD DISS2 (mailto:erik.verhoeven@zf.com)
* @brief This file provides the CAN abstraction interfaces
* @version 1.0
* @date 2024-02-07
*
* @copyright Copyright ZF Friedrichshafen AG (c) 2024
*
*/
/********************************************************************************
* 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
********************************************************************************/
#include "core.idl"
/**
* @brief Software Defined Vehicle framework.
*/
* @brief Software Defined Vehicle framework.
*/
module sdv
{
/**

View File

@@ -1,12 +1,15 @@
/**
* @file com.idl
* @author Erik Verhoeven FRD DISDS1 (mailto:erik.verhoeven@zf.com) & Steffen Altmeier FRD DISS21 (mailto:steffen.altmeier@zf.com)
* @brief This file includes all the interfaces used by the communication control service
* @version 1.0
* @date 2024-08-12
/********************************************************************************
* Copyright (c) 2025-2026 ZF Friedrichshafen AG
*
* @copyright Copyright ZF Friedrichshafen AG (c) 2024
*/
* 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
********************************************************************************/
#include "core.idl"
#include "core_ps.idl"

View File

@@ -1,24 +1,27 @@
/**
* @file app.idl
* @brief This file provides the core interface definitions SDV framework administration.
* @version 0.1
* @date 2024.04.11
* @author erik.verhoeven@zf.com
* @copyright Copyright ZF Friedrichshaven AG (c) 2023-2025
*/
/********************************************************************************
* 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
********************************************************************************/
#include "core.idl"
/**
* @brief Software Defined Vehicle framework.
*/
#verbatim_begin
#include "../support/string.h"
#verbatim_end
/**
* @brief Software Defined Vehicle framework.
*/
module sdv
{
#verbatim_begin
#include "../support/string.h"
#verbatim_end
/**
* @brief Failed to open a file.
*/
@@ -153,13 +156,27 @@ module sdv
/**
* @brief Save a configuration file pointed to by the provided file path. All components are saved that were added after
* the last baseline with the configuration specific settings.
* @attention Configuration changes can only occur when the system is in configuration mode.
* @remarks The function will only save when the configuration has changed.
* @param[in] ssConfigPath Path to the file containing the configuration (TOML). The path can be an absolute as well as a
* relative path. In case a relative path is provided, the configuration is stored relative to the executable directory.
* @return Returns 'true' on success; 'false' otherwise.
* @return Returns 'true' on success (or no changes detected); 'false' otherwise.
*/
boolean SaveConfig(in u8string ssConfigPath) const;
/**
* @brief Generate the configuration TOML string.
* @return The generated configuration string.
*/
u8string GenerateConfigString() const;
/**
* @brief Close the current configuration.
* @details This will close und unload the components and modules from the current configuration as well as dependent
* components that builds on top of the components being closed. Components that the current configuration depends on
* are not closed.
*/
void CloseConfig();
/**
* @brief Add a search path to a folder where a config file can be found.
* @param[in] ssDir Relative or absolute path to an existing folder.
@@ -174,7 +191,7 @@ module sdv
*/
void ResetConfigBaseline();
};
}; // module core
}; // module core
/**
* @brief Installation module.

View File

@@ -1,11 +1,17 @@
/**
* @file core.idl
* @brief This file provides the core interface definitions of the core SDV framework.
* @version 0.1
* @date 2023.04.26
* @author erik.verhoeven@zf.com
* @copyright Copyright ZF Friedrichshaven 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
*
* This file provides the core interface definitions of the core SDV framework.
*
* Contributors:
* Erik Verhoeven - initial API and implementation
********************************************************************************/
#include "core_types.idl"
@@ -25,8 +31,8 @@
#verbatim_end
/**
* @brief Software Defined Vehicle framework.
*/
* @brief Software Defined Vehicle framework.
*/
module sdv
{
/**
@@ -61,14 +67,20 @@ module sdv
*/
enum EObjectType : uint32
{
SystemObject = 0, ///< System object
Device = 10, ///< Abstract device
BasicService = 20, ///< Basic service
ComplexService = 21, ///< Complex service
Application = 30, ///< Application
Proxy = 100, ///< Proxy object
Stub = 101, ///< Stub object
Utility = 1000, ///< Utility object
undefined = 0, ///< Not defined
system_object = 1, ///< System object
device = 10, ///< Device category 10..19
platform_abstraction = 11, ///< Platform abstraction object
vehicle_bus = 12, ///< Vehicle bus object
basic_service = 20, ///< Basic service category 20..29
sensor = 21, ///< Sensor object
actuator = 22, ///< Actuator object
complex_service = 30, ///< Complex service category 30..39
vehicle_function = 31, ///< Vehicle function
application = 50, ///< Application
proxy = 100, ///< Proxy object
stub = 101, ///< Stub object
utility = 1000, ///< Utility object
};
/**
@@ -85,9 +97,10 @@ module sdv
struct SClassInfo
{
u8string ssModulePath; ///< Path to the module that contains the class.
u8string ssClassName; ///< String representing the class name.
u8string ssName; ///< String representing the class name.
sequence<u8string> seqClassAliases; ///< Sequence with class name aliases.
u8string ssDefaultObjectName; ///< The default object name.
u8string ssDefaultConfig; ///< The configuration TOML. Currently only "Parameters" table is supported.
EObjectType eType; ///< Type of object.
uint32 uiFlags; ///< Zero or more object flags from EObjectFlags.
sequence<u8string> seqDependencies; ///< Sequence with object class names this object is dependent on.
@@ -98,6 +111,19 @@ module sdv
*/
interface IObjectFactory
{
/**
* @brief The object class names implemented in the object.
* @return Sequence with object class names string.
*/
sequence<u8string> GetClassNames() const;
/**
* @brief Get the class information.
* @param[in] ssClassName The name of the class object to get the class information for.
* @return Returns the class information struct.
*/
SClassInfo GetClassInfo(in u8string ssClassName) const;
/**
* @brief Create or get the object using the name from the object class info.
* @attention The objects lifetime is ended by a call to the DestroyObject function or the unloading of the module.
@@ -119,9 +145,9 @@ module sdv
};
/**
* @brief Object status enumeration
* @brief Object state enumeration
*/
enum EObjectStatus : uint32
enum EObjectState : uint32
{
initialization_pending = 0, ///< constructor called, but no call to initialize yet
initializing = 10, ///< Initialize was called and is being executed.
@@ -158,10 +184,10 @@ module sdv
void Initialize(in u8string ssObjectConfig);
/**
* @brief Get the current status of the object.
* @return Return the current status of the object.
* @brief Get the current state of the object.
* @return Return the current state of the object.
*/
EObjectStatus GetStatus() const;
EObjectState GetObjectState() const;
/**
* @brief Set the component operation mode.
@@ -169,12 +195,18 @@ module sdv
*/
void SetOperationMode(in EOperationMode eMode);
/**
* @brief Get the object configuration for persistence.
* @return The object configuration as TOML string.
*/
u8string GetObjectConfig() const;
/**
* @brief Shutdown called before the object is destroyed.
* @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
* Any subsequent call to GetObjectState should return EObjectState::destruction_pending
*/
void Shutdown();
};

View File

@@ -1,16 +1,20 @@
/**
* @file core_idl.idl
* @brief This file provides all interface definitions for generator of the IDL compiler as part of the core SDV framework.
* @version 0.1
* @date 2023.06.29
* @author erik.verhoeven@zf.com
* @copyright Copyright ZF Friedrichshaven AG (c) 2022-2025
*/
/********************************************************************************
* 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
********************************************************************************/
#include "core.idl"
#include "mem.idl"
/**
/**
* @brief Software Defined Vehicle framework.
*/
module sdv

View File

@@ -1,16 +1,20 @@
/**
* @file core_ps.idl
* @brief This file provides the marshalling interface definitions of the core SDV framework.
* @version 0.1
* @date 2023.05.10
* @author erik.verhoeven@zf.com
* @copyright Copyright ZF Friedrichshaven 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
********************************************************************************/
#include "core.idl"
#include "process.idl"
/**
/**
* @brief Software Defined Vehicle framework.
*/
module sdv

View File

@@ -1,10 +1,18 @@
/********************************************************************************
* 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
********************************************************************************/
/**
* @file core_types.idl
* @brief This file provides all data types for the core SDV framework.
* @version 0.1
* @date 2023.05.08
* @author erik.verhoeven@zf.com
* @copyright Copyright ZF Friedrichshaven AG (c) 2023
*/
/**
@@ -56,8 +64,8 @@ const uint32 SDVFrameworkSubbuildVersion = 100;
#verbatim_end
/**
* @brief Software Defined Vehicle framework.
*/
* @brief Software Defined Vehicle framework.
*/
module sdv
{
/**

View File

@@ -1,13 +1,16 @@
/**
*
* @file dispatch.idl
* @brief This file provides interfaces related to the data dispatch service.
* @version 1.0
* @date 2024.01.12
* @author Erik Verhoeven
* @copyright Copyright ZF Friedrichshaven AG (c) 2024
*
*/
/********************************************************************************
* 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
********************************************************************************/
#include "core.idl"
/**

View File

@@ -1,18 +1,21 @@
/**
* @file hw_ident.idl
* @author Erik Verhoeven DISDS1 (mailto:erik.verhoeven@zf.com)
* @brief This file includes all the interfaces used for hardware identification.
* @version 1.0
* @date 2024-05-09
/********************************************************************************
* Copyright (c) 2025-2026 ZF Friedrichshafen AG
*
* @copyright Copyright ZF Friedrichshafen AG (c) 2023-2025
*/
* 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
********************************************************************************/
#include "core.idl"
/**
* @brief Software Defined Vehicle framework.
*/
/**
* @brief Software Defined Vehicle framework.
*/
module sdv
{
/**

View File

@@ -1,12 +1,15 @@
/**
* @file ipc.idl
* @author Erik Verhoeven DISDS1 (mailto:erik.verhoeven@zf.com)
* @brief This file includes all the interfaces used for interpprocess communication.
* @version 1.0
* @date 2024-05-09
/********************************************************************************
* Copyright (c) 2025-2026 ZF Friedrichshafen AG
*
* @copyright Copyright ZF Friedrichshafen AG (c) 2023-2025
*/
* 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
********************************************************************************/
#include "core.idl"

View File

@@ -1,12 +1,15 @@
/**
* @file log.idl
* @author Erik Verhoeven DISDS1 (mailto:erik.verhoeven@zf.com)
* @brief This file includes all the interfaces used for logging information.
* @version 1.0
* @date 2024-05-09
/********************************************************************************
* Copyright (c) 2025-2026 ZF Friedrichshafen AG
*
* @copyright Copyright ZF Friedrichshafen AG (c) 2023-2025
*/
* 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
********************************************************************************/
#include "core.idl"
#include "process.idl"

View File

@@ -1,15 +1,19 @@
/**
* @file mem.idl
* @brief This file provides the memory management interface definitions of the core SDV framework.
* @version 0.1
* @date 2023.05.22
* @author erik.verhoeven@zf.com
* @copyright Copyright ZF Friedrichshaven 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
********************************************************************************/
#include "core.idl"
/**
/**
* @brief Software Defined Vehicle framework.
*/
module sdv

View File

@@ -1,19 +1,21 @@
/**
* @file module.idl
* @author Erik Verhoeven FRD DISDS1 (mailto:erik.verhoeven@zf.com)
* @brief This file includes all the interfaces used for module management
* @version 1.0
* @date 2024-05-02
/********************************************************************************
* Copyright (c) 2025-2026 ZF Friedrichshafen AG
*
* @copyright Copyright ZF Friedrichshafen AG (c) 2023-2025
* 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
********************************************************************************/
#include "core.idl"
/**
* @brief Software Defined Vehicle framework.
*/
/**
* @brief Software Defined Vehicle framework.
*/
module sdv
{
/**

177
export/interfaces/param.idl Normal file
View File

@@ -0,0 +1,177 @@
/********************************************************************************
* Copyright (c) 2025-2026 Contributors to the Eclipse Foundation
*
* 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
********************************************************************************/
#include "core.idl"
/**
* @brief Software Defined Vehicle framework.
*/
module sdv
{
/**
* @brief Parameter bitmask flags.
*/
enum EParamFlags : uint32
{
mask = 0xff, ///< Flags for the setting the parameter attributes
read_write = 0x00, ///< Read/write access to the parameter.
read_only = 0x01, ///< The parameter is read only.
temporary = 0x20, ///< The parameter is marked as a temporary parameter.
state_mask = 0xff00, ///< Flags for the parameter states
dirty = 0x0100, ///< Parameter has changed.
locked = 0x0400, ///< When set, the parameter is not writable.
};
/**
* @brief Parameter type.
*/
enum EParamType
{
boolean_param, ///< The parameter is a boolean.
number_param, ///< The parameter is a number (integral or floating point).
string_param, ///< The parameter is a string.
enum_param, ///< The parameter is an enumeration value.
bitmask_param ///< The parameter is a bitmask value.
};
/**
* @brief Specific number information.
*/
struct SNumberInfo
{
any anyLowerLimit; ///< Optional lower limit value.
boolean bIncludeLowerLinit; ///< When set, low <= val, otherwise low < val.
any anyUpperLimit; ///< Optional upper limit value.
boolean bIncludeUpperLimit; ///< When set, val >= upper, otherwise val > upper.
};
/**
* @brief Specific string information.
*/
struct SStringInfo
{
u8string ssPattern; ///< Regular expression pattern describing the allowed pattern.
};
/**
* @brief Specific label information for enumerations and bitmasks.
*/
struct SLabelInfo
{
/**
* @brief Each label is described by a value and label text.
*/
struct SLabel
{
any anyValue; ///< Label value (must be an integral number)
u8string ssLabel; ///< Label text
};
sequence<SLabel> seqLabels; ///< Sequence of element labels
};
/**
* @brief Structure to represent parameter information.
*/
struct SParamInfo
{
EParamType eType; ///< Parameter type
uint32 uiFlags; ///< Parameter flags containing one or more values of the EParamFlags enumeration.
u8string ssName; ///< The name of the parameter.
u8string ssGroup; ///< Optional group name for this parameter. Can contain sub-groups separated by a dot.
u8string ssUnit; ///< Optional parameter unit.
u8string ssDescription; ///< Optional parameter description.
any anyDefaultVal; ///< Default value
/// Union holding extended parameter information.
union switch (eType)
{
case EParamType::number_param:
SNumberInfo sNumberInfo; ///< Additional information for number types
case EParamType::string_param:
SStringInfo sStringInfo; ///< Additional information for string types.
case EParamType::enum_param:
SLabelInfo sEnumInfo; ///< Additional information for enumeration types.
case EParamType::bitmask_param:
SLabelInfo sBitmaskInfo; ///< Additional information for bitmask types.
} uExtInfo; ///< Extended parameter information.
};
/**
* @brief Interface to access parameters.
*/
interface IParameters
{
/**
* @brief Return a sequence with parameter paths. Each path is unique and can be used to get and set the parameter value.
* @return Sequence containing parameter paths. Parameter paths are composed from group/sub-groups and the parameter name,
* separated by a dot.
*/
sequence<u8string> GetParamPaths() const;
/**
* @brief Returns the parameter value.
* @param[in] ssPath Path of the parameter. The parameter path is composed from group/sub-groups and the parameter name,
* separated by a dot.
* @return Returns the parameter value. Returns an 'empty' parameter value when not successful or the parameter is not set.
*/
any GetParam(in u8string ssPath) const;
/**
* @brief Set the parameter value.
* @param[in] ssPath Path of the parameter. The parameter path is composed from group/sub-groups and the parameter name,
* separated by a dot.
* @param[in] anyValue Reference to the parameter value to set.
* @return Returns 'true' on success or 'false' when parameter could not be set (e.g. the parameter is read-only) or the
* index is larger than the amount of parameters being available.
*/
boolean SetParam(in u8string ssPath, in any anyValue);
/**
* @brief Get parameter information.
* @param[in] ssPath Path of the parameter. The parameter path is composed from group/sub-groups and the parameter name,
* separated by a dot.
* @return Return the parameter information for the requested parameter or an empty structure when no parameter information
* is available or the parameter is not available.
*/
SParamInfo GetParamInfo(in u8string ssPath) const;
/**
* @brief Is the parameter dirty (was it changed)? Checks the parameter dirty flag.
* @param[in] ssPath Path of the parameter. The parameter path is composed from group/sub-groups and the parameter name,
* separated by a dot.
* @return Returns whether the parameter was changed either by an explicit call to the SetParam function or internally by
* the
* object itself.
*/
boolean IsParamDirty(in u8string ssPath) const;
/**
* @brief Reset the dirty flag for the parameter.
* @param[in] ssPath Path of the parameter. The parameter path is composed from group/sub-groups and the parameter name,
* separated by a dot.
*/
void ResetParamDirtyFlag(in u8string ssPath);
/**
* @brief Is there at least one parameter with a dirty flag?
* @return Returns whether at least one parameter has its dirty flag enabled.
*/
boolean IsParamMapDirty() const;
/**
* @brief Reset the dirty flag for all parameters.
*/
void ResetParamMapDirtyFlags();
};
}; // sdv

View File

@@ -1,12 +1,15 @@
/**
* @file process.idl
* @author Erik Verhoeven DISDS1 (mailto:erik.verhoeven@zf.com)
* @brief This file includes all the interfaces used for process creation.
* @version 1.0
* @date 2024-05-09
/********************************************************************************
* Copyright (c) 2025-2026 ZF Friedrichshafen AG
*
* @copyright Copyright ZF Friedrichshafen AG (c) 2023-2025
*/
* 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
********************************************************************************/
#include "core.idl"

View File

@@ -1,19 +1,22 @@
/**
/********************************************************************************
* Copyright (c) 2025-2026 ZF Friedrichshafen AG
*
* @file repository.idl
* @brief This file provides interfaces related to the repository service
* @version 0.1
* @date 2022.11.21
* @author steffen.altmeier@zf.com
* @copyright Copyright ZF Friedrichshaven AG (c) 2022
* 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
********************************************************************************/
#include "core.idl"
#include "module.idl"
/**
* @brief Software Defined Vehicle framework.
*/
/**
* @brief Software Defined Vehicle framework.
*/
module sdv
{
/**
@@ -110,6 +113,7 @@ module sdv
/**
* @brief Interface used to control object creation and destruction.
* @remarks This interface is exposed by the repository on for standalone, essential and isolated applications.
*/
interface IRepositoryControl
{
@@ -128,8 +132,7 @@ module sdv
* @param[in] ssObjectName Name of the object, required to be unique. For standalone and essential applications, the
* name string can be empty, in which case the object might either provide a name proposal or the name is the same as
* the class name. Use the returned object ID to request the name of the object.
* @param[in] ssObjectConfig Optional configuration handed over to the object upon creation via IObjectControl. Only
* valid for standalone, essential and isolated applications.
* @param[in] ssObjectConfig Optional configuration handed over to the object upon creation via IObjectControl.
* @return Returns the object ID when the object creation was successful or 0 when not. On success the object is
* available through the IObjectAccess interface. If the object already exists (class and object names are identical),
* the object ID of the existing object is returned.

View File

@@ -1,12 +1,15 @@
/**
* @file timer.idl
* @author Erik Verhoeven DISDS1 (mailto:erik.verhoeven@zf.com)
* @brief This file includes all the interfaces used for timer creation.
* @version 1.0
* @date 2024-05-09
/********************************************************************************
* Copyright (c) 2025-2026 ZF Friedrichshafen AG
*
* @copyright Copyright ZF Friedrichshafen AG (c) 2023-2025
*/
* 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
********************************************************************************/
#include "core.idl"

View File

@@ -1,13 +1,16 @@
/**
*
* @file dispatch.idl
* @brief This file provides interfaces related to the data dispatch service.
* @version 1.0
* @date 2024.01.12
* @author Erik Verhoeven
* @copyright Copyright ZF Friedrichshaven AG (c) 2024
*
*/
/********************************************************************************
* 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
********************************************************************************/
#include "core.idl"
/**
@@ -102,13 +105,9 @@ module sdv
u8string GetTOML() const;
/**
* @brief Comment access flags.
* @details The comment access flags contain the comment code snippet index (0..15) as well as flags to receive the
* comments in interpreted or raw form. For comment code snippets are defined for all nodes, the comments before and
* after the node not related to the node and the comments before and after the node related to the node. Comment or
* whitespace in between the node tokens are part of the other 11 indices (each node interprets this differently).
* @brief Node comment type.
*/
enum ECommentFlags
enum ECommentType
{
comment_before = 0, ///< The comment before the node. This will insert a newline and the comment
///< text preceded by the '#' character.
@@ -118,169 +117,47 @@ module sdv
///< node and is separated by an extra newline.
out_of_scope_comment_behind = 3, ///< An independent comment behind the node. This comment is not part of the
///< node and is separated by an extra newline.
comment_index_mask = 15, ///< Comment type mask to be used ot filter the comment type.
raw_comment = 8, ///< Store the comment exactly as provided (whitespace and comments).
replace_whitespace = 16, ///< When set, the comment will replace the current whitespace as well.
///< Used with SetComment function. Automatically enabled for raw comments.
};
/**
* @brief Set or replace a comment for the node.
* @remarks This function can also be used to insert whitespace (with or without comments) when used in raw mode.
* Set the comment text for the node. If a comment is proided as text (normal behavior), the comment text will be
* formatted automatically when generating the TOML text. If the comment is provided as raw comment, the text should
* contain all whitespace and the comment '#' character before the comment text.
* Comments inserted before the enode will be inserted on the line before the node uness the comment is provided in raw
* format and is ended with a newline and optionally whitespace. Comment inserted behind the node will be inserted on
* @details Set the comment text for the node. If a comment is provided as text (normal behavior), the comment text will
* be formatted automatically when generating the TOML text. If the comment text should not contain the comment
* character '#' before the comment text.
* Comments inserted before the node will be inserted on the line before the node unless the comment is provided in raw
* format and is ended with a line-break and optionally whitespace. Comment inserted behind the node will be inserted on
* the same line as the node.
* Comments provided as text is automatically wrapped to 80 characters if possible. Newlines in the text will cause a
* new comment line to start.
* @param[in] ssComment String containing the comment text or the raw comment string to set.
* @param[in] uiFlags One or more ECommentFlags flags influencing the behavior of the comment.
* Comments provided as text is automatically wrapped to 132 characters if possible. Line-breaks in the text will cause
* a new comment line to start.
* @param[in] eType The comment type to set the comment text for.
* @param[in] ssComment String containing the comment text to set.
*/
void SetComment(in u8string ssComment, in uint32 uiFlags);
void SetComment(in ECommentType eType, in u8string ssComment);
/**
* Get the current comment for the node.
* @remarks To receive the whitespace formatting the node, use this function in raw mode.
* @param[in] uiFlags One or more ECommentFlags flags identifying the string format of the comment to return.
* @param[in] eType The comment type to get the comment text of.
* @return String with the comment text or an empty string if no comment is available.
*/
u8string GetComment(in uint32 uiFlags);
u8string GetComment(in ECommentType eType);
/**
* @brief Format the node automatically. This will remove the whitespace between the elements within the node. Comments
* will not be changed.
*/
void AutomaticFormat();
};
/**
* @brief Interface allowing access to table and array nodes.
*/
interface INodeCollection
{
/**
* @brief Returns the amount of nodes.
* @return The amount of nodes.
*/
uint32 GetCount() const;
/**
* @brief Get the node.
* @param[in] uiIndex Index of the node to get.
* @return Interface to the node object.
* @brief Is the node inline?
* @return Returns whether the node is defined as inline node.
*/
IInterfaceAccess GetNode(in uint32 uiIndex) const;
boolean IsInline() const;
/**
* @brief Searches a node by its key in the parse tree
* @details Elements of tables can be accessed and traversed by using '.' to separated the parent name from child
* name. E.g. 'parent.child' would access the 'child' element of the 'parent' table. Elements of arrays can be
* accessed and traversed by using the index number in brackets. E.g. 'array[3]' would access the fourth element of
* the array 'array'. These access conventions can also be chained like 'table.array[2][1].subtable.integerElement'.
* @attention Array indexing starts with 0!
* @param[in] ssPath The path of the Node to searched for.
* @return Returns an interface the requested node if available.
* @brief Is the node defined as standard node?
* @return Returns whether the node is defined as standard node.
*/
IInterfaceAccess GetNodeDirect(in u8string ssPath) const;
};
/**
* @brief Extend the collection node with values, arrays and tables.
*/
interface INodeCollectionInsert
{
/**
* @brief Insert a value into the collection at the location before the supplied index.
* @param[in] uiIndex The insertion location to insert the node before. Can be npos or any value larger than the
* collection count to insert the node at the end of the collection. Value nodes cannot be inserted behind external
* tables and table arrays. If the index is referencing a position behind an external table or a table array, the index
* is automatically corrected.
* @param[in] ssName Name of the node to insert. Will be ignored for an array collection. The name must adhere to the
* key names defined by the TOML specification. Defining the key multiple times is not allowed. Quotation of key names
* is done automatically; the parser decides itself whether the key is bare-key, a literal key or a quoted key.
* @param[in] anyValue The value of the node, being either an integer, floating point number, boolean value or a string.
* Conversion is automatically done to int64, double float, bool or u8string.
* @return On success the interface to the newly inserted node is returned or NULL otherwise.
*/
IInterfaceAccess InsertValue(in uint32 uiIndex, in u8string ssName, in any anyValue);
/**
* @brief Insert an array into the collection at the location before the supplied index.
* @param[in] uiIndex The insertion location to insert the node before. Can be npos or any value larger than the
* collection count to insert the node at the end of the collection. Array nodes cannot be inserted behind external
* tables and table arrays. If the index is referencing a position behind an external table or a table array, the index
* is automatically corrected.
* @param[in] ssName Name of the array node to insert. Will be ignored if the current node is also an array collection.
* The name must adhere to the key names defined by the TOML specification. Defining the key multiple times is not
* allowed. Quotation of key names is done automatically; the parser decides itself whether the key is bare-key, a
* literal key or a quoted key.
* @return On success the interface to the newly inserted node is returned or NULL otherwise.
*/
IInterfaceAccess InsertArray(in uint32 uiIndex, in u8string ssName);
/**
* @brief Insert a table into the collection at the location before the supplied index.
* @param[in] uiIndex The insertion location to insert the node before. Can be npos or any value larger than the
* collection count to insert the node at the end of the collection. Table nodes cannot be inserted before value nodes
* or arrays. If the index is referencing a position before a value node or an array, the index is automatically
* corrected.
* @param[in] ssKeyName Name of the table node to insert. Will be ignored if the current node is an array collection.
* The name must adhere to the key names defined by the TOML specification. Defining the key multiple times is not
* allowed. Quotation of key names is done automatically; the parser decides itself whether the key is bare-key, a
* literal key or a quoted key.
* @return On success the interface to the newly inserted node is returned or NULL otherwise.
*/
IInterfaceAccess InsertTable(in uint32 uiIndex, in u8string ssKeyName);
/**
* @brief Insert a table array into the collection at the location before the supplied index.
* @param[in] uiIndex The insertion location to insert the node before. Can be npos or any value larger than the
* collection count to insert the node at the end of the collection. Table array nodes cannot be inserted before value
* nodes or arrays. If the index is referencing a position before a value node or an array, the index is automatically
* corrected.
* @param[in] ssName Name of the array node to insert. Will be ignored if the current node is also an array collection.
* The name must adhere to the key names defined by the TOML specification. Defining the key multiple times is not
* allowed. Quotation of key names is done automatically; the parser decides itself whether the key is bare-key, a
* literal key or a quoted key.
* @return On success the interface to the newly inserted node is returned or NULL otherwise.
*/
IInterfaceAccess InsertTableArray(in uint32 uiIndex, in u8string ssName);
/**
* @brief The result of the TOML string to insert.
*/
enum EInsertResult : uint32
{
invalid_TOML, ///< The TOML string was invalid or didn't fit the collection node it was to be inserted.
insert_partly_success, ///< Part, but not all nodes could be inserted (duplicate nodes are not inserted).
insert_success, ///< All nodes could be inserted or the TOML didn't contain any nodes.
};
/**
* @brief Insert a TOML string as a child of the current collection node. If the collection is a table, the TOML string
* should contain values and inline/external/array-table nodes with names. If the collection is an array, the TOML
* string should contain and inline table nodes without names.
* @param[in] ssTOML The TOML string to insert.
* @param[in] bRollbackOnPartly If only part of the nodes could be inserted, no node will be inserted.
* @return The result of the insertion.
*/
EInsertResult InsertTOML(in u8string ssTOML, in boolean bRollbackOnPartly);
};
/**
* @brief Remove the current node.
* @remarks The root node cannot be deleted.
*/
interface INodeDelete
{
/**
* @brief Delete the current node.
* @attention A successful deletion will cause all interfaces to the current node to become inoperable.
* @return Returns whether the deletion was successful.
*/
boolean DeleteNode();
boolean IsStandard() const;
};
/**
@@ -322,6 +199,176 @@ module sdv
* @return Returns whether the move was successful.
*/
boolean MoveDown();
/**
* @brief Delete the current node.
* @attention A successful deletion will cause all interfaces to the current node to become inoperable.
* @return Returns whether the deletion was successful.
*/
boolean DeleteNode();
};
/**
* @brief Interface allowing access to table and array nodes.
*/
interface INodeCollection
{
/**
* @brief Returns the amount of nodes.
* @return The amount of nodes.
*/
uint32 GetCount() const;
/**
* @brief Get the node.
* @param[in] uiIndex Index of the node to get.
* @return Interface to the node object.
*/
IInterfaceAccess GetNode(in uint32 uiIndex) const;
/**
* @brief Searches a node by its key in the parse tree
* @details Elements of tables can be accessed and traversed by using '.' to separated the parent name from child
* name. E.g. 'parent.child' would access the 'child' element of the 'parent' table. Elements of arrays can be
* accessed and traversed by using the index number in brackets. E.g. 'array[3]' would access the fourth element of
* the array 'array'. These access conventions can also be chained like 'table.array[2][1].subtable.integerElement'.
* @attention Array indexing starts with 0!
* @param[in] ssPath The path of the Node to searched for.
* @return Returns an interface the requested node if available.
*/
IInterfaceAccess GetNodeDirect(in u8string ssPath) const;
};
/**
* @brief Convert between inline and standard definitions.
*/
interface INodeCollectionConvert
{
/**
* @brief Can the node convert to an inline definition?
* @return Returns whether the conversion to inline is possible. Returns 'true' when the node is already inline.
*/
boolean CanMakeInline() const;
/**
* @brief Convert the node to an inline node.
* @return Returns whether the conversion was successful. Returns 'true' when the node was already inline.
*/
boolean MakeInline();
/**
* @brief Can the node convert to a standard definition?
* @return Returns whether the conversion to standard is possible. Returns 'true' when the node is already defined as
* standard node.
*/
boolean CanMakeStandard() const;
/**
* @brief Convert the node to a standard node.
* @return Returns whether the conversion was successful. Returns 'true' when the node was already defined as standard
* node.
*/
boolean MakeStandard();
};
/**
* @brief Extend the collection node with values, arrays and tables.
*/
interface INodeCollectionInsert
{
/**
* @brief Insert a value into the collection at the location before the supplied index.
* @param[in] uiIndex The insertion location to insert the node before. Can be npos or any value larger than the
* collection count to insert the node at the end of the collection. Value nodes cannot be inserted behind external
* tables and table arrays. If the index is referencing a position behind an external table or a table array, the index
* is automatically corrected.
* @param[in] ssName Name of the node to insert. Will be ignored for an array collection. The name must adhere to the
* key names defined by the TOML specification. Defining the key multiple times is not allowed. Quotation of key names
* is done automatically; the parser decides itself whether the key is bare-key, a literal key or a quoted key.
* @param[in] anyValue The value of the node, being either an integer, floating point number, boolean value or a string.
* Conversion is automatically done to int64, double float, bool or u8string.
* @return On success the interface to the newly inserted node is returned or NULL otherwise.
*/
IInterfaceAccess InsertValue(in uint32 uiIndex, in u8string ssName, in any anyValue);
/**
* @brief Insert an array into the collection at the location before the supplied index.
* @param[in] uiIndex The insertion location to insert the node before. Can be npos or any value larger than the
* collection count to insert the node at the end of the collection. Array nodes cannot be inserted behind external
* tables and table arrays. If the index is referencing a position behind an external table or a table array, the index
* is automatically corrected.
* @param[in] ssName Name of the array node to insert. Will be ignored if the current node is also an array collection.
* The name must adhere to the key names defined by the TOML specification. Defining the key multiple times is not
* allowed. Quotation of key names is done automatically; the parser decides itself whether the key is bare-key, a
* literal key or a quoted key.
* @return On success the interface to the newly inserted node is returned or NULL otherwise.
*/
IInterfaceAccess InsertArray(in uint32 uiIndex, in u8string ssName);
/**
* @brief Insertion preference for tables and table arrays, being standard or inline.
*/
enum EInsertPreference
{
prefer_standard = 0, ///< When the parent node is not inline, the node will be inserted as standard node.
prefer_inline = 1, ///< The node will be inserted as inline node.
};
/**
* @brief Insert a table into the collection at the location before the supplied index.
* @param[in] uiIndex The insertion location to insert the node before. Can be npos or any value larger than the
* collection count to insert the node at the end of the collection. Table nodes cannot be inserted before value nodes
* or arrays. If the index is referencing a position before a value node or an array, the index is automatically
* corrected.
* @param[in] ssName Name of the table node to insert. Will be ignored if the parent node is an array collection.
* The name must adhere to the key names defined by the TOML specification. Defining the key multiple times is not
* allowed. Quotation of key names is done automatically; the parser decides itself whether the key is bare-key, a
* literal key or a quoted key.
* @param[in] ePreference The preferred form of the node to be inserted.
* @return On success the interface to the newly inserted node is returned or NULL otherwise.
*/
IInterfaceAccess InsertTable(in uint32 uiIndex, in u8string ssName, in EInsertPreference ePreference);
/**
* @brief Insert a table array into the collection at the location before the supplied index.
* @param[in] uiIndex The insertion location to insert the node before. Can be npos or any value larger than the
* collection count to insert the node at the end of the collection. Table array nodes cannot be inserted before value
* nodes or arrays. If the index is referencing a position before a value node or an array, the index is automatically
* corrected.
* @param[in] ssName Name of the array node to insert. Will be ignored if the parent node is also an array collection.
* The name must adhere to the key names defined by the TOML specification. Defining the key multiple times is not
* allowed. Quotation of key names is done automatically; the parser decides itself whether the key is bare-key, a
* literal key or a quoted key.
* @param[in] ePreference The preferred form of the node to be inserted.
* @return On success the interface to the newly inserted node is returned or NULL otherwise.
*/
IInterfaceAccess InsertTableArray(in uint32 uiIndex, in u8string ssName, in EInsertPreference ePreference);
/**
* @brief The result of the TOML string to insert.
*/
enum EInsertResult : uint32
{
insert_fail, ///< The TOML string was invalid or didn't fit the collection node it was to be inserted.
insert_partly_success, ///< Part, but not all nodes could be inserted (duplicate nodes are not inserted).
insert_success, ///< All nodes could be inserted or the TOML didn't contain any nodes.
};
/**
* @brief Insert a TOML string as a child of the current collection node. If the collection is a table, the TOML string
* should contain values and inline/external/array-table nodes with names. If the collection is an array, the TOML
* string should contain and inline table nodes without names.
* @attention Even though the TOML might be defining the node(s) in standard form, if the parent node is an inline node,
* the node will be inserted as inline node.
* @param[in] uiIndex The insertion location to insert the node before. Can be npos or any value larger than the
* collection count to insert the node at the end of the collection. Table array nodes cannot be inserted before value
* nodes or arrays. If the index is referencing a position before a value node or an array, the index is automatically
* corrected.
* @param[in] ssTOML The TOML string to insert. This string can hold one or more nodes that should be inserted.
* @param[in] bRollbackOnFailure If only part of the nodes could be inserted, no node will be inserted.
* @return The result of the insertion.
*/
EInsertResult InsertTOML(in uint32 uiIndex, in u8string ssTOML, in boolean bRollbackOnFailure);
};
/**

View File

@@ -1,3 +1,16 @@
/********************************************************************************
* 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 SDV_ANY_H
#define SDV_ANY_H
@@ -93,62 +106,148 @@ namespace sdv
/**
* @brief Assignment constructor.
* @param[in] tVal The value to assign.
* @param[in] bVal The value to assign.
*/
any_t(bool bVal);
/**
* @{
* @brief Assignment constructor.
* @param[in] iVal The value to assign.
*/
any_t(int8_t iVal);
any_t(int16_t iVal);
any_t(int32_t iVal);
#ifdef _WIN32
any_t(long iVal);
#endif
any_t(int64_t iVal);
#ifdef __linux__
any_t(long long int iVal);
#endif
/**
* @}
*/
/**
* @{
* @brief Assignment constructor.
* @param[in] uiVal The value to assign.
*/
any_t(uint8_t uiVal);
any_t(uint16_t uiVal);
any_t(uint32_t uiVal);
#ifdef _WIN32
any_t(unsigned long uiVal);
#endif
any_t(uint64_t uiVal);
#ifdef __linux__
any_t(unsigned long long int uiVal);
#endif
/**
* @}
*/
/**
* @{
* @brief Assignment constructor.
* @param[in] cVal The value to assign.
*/
any_t(char cVal);
any_t(char16_t cVal);
any_t(char32_t cVal);
any_t(wchar_t cVal);
/**
* @}
*/
/**
* @{
* @brief Assignment constructor.
* @param[in] fVal The value to assign.
*/
any_t(float fVal);
any_t(double fVal);
any_t(long double fVal);
/**
* @}
*/
template <typename TType>
explicit any_t(TType tVal);
/**
* @{
* @brief SDV string constructors.
* @param[in] rssVal Reference to the string object.
*/
explicit any_t(const string& rssVal);
explicit any_t(const u8string& rssVal);
explicit any_t(const u16string& rssVal);
explicit any_t(const u32string& rssVal);
explicit any_t(const wstring& rssVal);
any_t(const string& rssVal);
any_t(const u8string& rssVal);
any_t(const u16string& rssVal);
any_t(const u32string& rssVal);
any_t(const wstring& rssVal);
/**
* @}
*/
* @}
*/
/**
* @{
* @brief C-style string constructors.
* @param[in] sz Zero terminated string.
* @param[in] szVal Zero terminated string.
*/
any_t(const char* sz);
any_t(const char* szVal);
any_t(const char16_t* szVal);
any_t(const char32_t* szVal);
any_t(const wchar_t* szVal);
/**
* @brief C-style string constructors.
* @param[in] sz Zero terminated string.
* @}
*/
any_t(const char16_t* sz);
/**
* @brief C-style string constructors.
* @param[in] sz Zero terminated string.
*/
any_t(const char32_t* sz);
/**
* @brief C-style string constructors.
* @param[in] sz Zero terminated string.
*/
any_t(const wchar_t* sz);
/**
* @{
* @brief STD string constructors.
* @param[in] rssVal Reference to the string object.
*/
explicit any_t(const std::string& rssVal);
explicit any_t(const std::u16string& rssVal);
explicit any_t(const std::u32string& rssVal);
explicit any_t(const std::wstring& rssVal);
any_t(const std::string& rssVal);
any_t(const std::u16string& rssVal);
any_t(const std::u32string& rssVal);
any_t(const std::wstring& rssVal);
/**
* @}
*/
/**
* @brief STD path constructor (will be stored as u8string).
* @param[in] rpathVal Reference to the path object.
*/
any_t(const std::filesystem::path& rpathVal);
/**
* @brief Interface constructor.
* @param[in] ifcVal Interface pointer.
*/
any_t(interface_t ifcVal);
// Assignment already covered by any_t(uint64)
///**
// * brief Interface ID constructor.
// * param[in] idIfcVal Interface ID.
// */
//any_t(interface_id idIfcVal);
// Assignment already covered by any_t(uint64)
///**
// * brief Exception ID constructor.
// * param[in] idExceptVal Exception ID.
// */
//any_t(exception_id idExceptVal);
/**
* @brief Enum constructor.
* @tparam TEnum Type of enum.
* @tparam TEnable Enable the function if the TType is an enum.
* @param eVal The eunm value.
*/
template <typename TEnum, typename TEnable = std::enable_if_t<std::is_enum_v<TEnum>>>
explicit any_t(TEnum eVal);
/**
* @brief Assignment constructor.
* @param[in] tVal The value to assign.
@@ -171,11 +270,158 @@ namespace sdv
/**
* @brief Assignment operator.
* @param[in] tVal The value to assign.
* @param[in] bVal The value to assign.
* @return Reference to this class.
*/
template <typename TType>
any_t& operator=(TType tVal);
any_t& operator=(bool bVal);
/**
* @{
* @brief Assignment operator.
* @param[in] iVal The value to assign.
* @return Reference to this class.
*/
any_t& operator=(int8_t iVal);
any_t& operator=(int16_t iVal);
any_t& operator=(int32_t iVal);
#ifdef _WIN32
any_t& operator=(long iVal);
#endif
any_t& operator=(int64_t iVal);
#ifdef __linux__
any_t& operator=(long long int iVal);
#endif
/**
* @}
*/
/**
* @{
* @brief Assignment operator.
* @param[in] uiVal The value to assign.
* @return Reference to this class.
*/
any_t& operator=(uint8_t uiVal);
any_t& operator=(uint16_t uiVal);
any_t& operator=(uint32_t uiVal);
#ifdef _WIN32
any_t& operator=(unsigned long uiVal);
#endif
any_t& operator=(uint64_t uiVal);
#ifdef __linux__
any_t& operator=(unsigned long long int uiVal);
#endif
/**
* @}
*/
/**
* @{
* @brief Assignment operator.
* @param[in] cVal The value to assign.
* @return Reference to this class.
*/
any_t& operator=(char cVal);
any_t& operator=(char16_t cVal);
any_t& operator=(char32_t cVal);
any_t& operator=(wchar_t cVal);
/**
* @}
*/
/**
* @{
* @brief Assignment operator.
* @param[in] fVal The value to assign.
* @return Reference to this class.
*/
any_t& operator=(float fVal);
any_t& operator=(double fVal);
any_t& operator=(long double fVal);
/**
* @}
*/
/**
* @{
* @brief SDV string assignment operator.
* @param[in] rssVal Reference to the string object.
* @return Reference to this class.
*/
any_t& operator=(const string& rssVal);
any_t& operator=(const u8string& rssVal);
any_t& operator=(const u16string& rssVal);
any_t& operator=(const u32string& rssVal);
any_t& operator=(const wstring& rssVal);
/**
* @}
*/
/**
* @{
* @brief C-style string assignment operator.
* @param[in] szVal Zero terminated string.
* @return Reference to this class.
*/
any_t& operator=(const char* szVal);
any_t& operator=(const char16_t* szVal);
any_t& operator=(const char32_t* szVal);
any_t& operator=(const wchar_t* szVal);
/**
* @}
*/
/**
* @{
* @brief STD string assignment operator.
* @param[in] rssVal Reference to the string object.
* @return Reference to this class.
*/
any_t& operator=(const std::string& rssVal);
any_t& operator=(const std::u16string& rssVal);
any_t& operator=(const std::u32string& rssVal);
any_t& operator=(const std::wstring& rssVal);
/**
* @}
*/
/**
* @brief STD path assignment operator (will be stored as u8string).
* @param[in] rpathVal Reference to the path object.
* @return Reference to this class.
*/
any_t& operator=(const std::filesystem::path& rpathVal);
/**
* @brief Interface assignment operator.
* @param[in] ifcVal Interface pointer.
* @return Reference to this class.
*/
any_t& operator=(interface_t ifcVal);
// Assignment already covered by operator=(uint64)
///**
// * brief Interface ID operator.
// * param[in] idIfcVal Interface ID.
// */
//any_t& operator=(interface_id idIfcVal);
// Assignment already covered by operator=(uint64)
///**
// * brief Exception ID operator.
// * param[in] idExceptVal Exception ID.
// */
//any_t& operator=(exception_id idExceptVal);
/**
* @brief Enum assignment operator.
* tparam TEnum Enum type.
* @tparam TEnable Enable the function if the TType is an enum.
* @param[in] eVal Enum value.
* @return Reference to this class.
*/
template <typename TEnum, typename TEnable = std::enable_if_t<std::is_enum_v<TEnum>>>
any_t& operator=(TEnum eVal);
/**
* @brief Copy assignment operator.
@@ -231,6 +477,7 @@ namespace sdv
operator std::u16string() const;
operator std::u32string() const;
operator std::wstring() const;
operator std::filesystem::path() const;
/**
* @}
*/
@@ -247,12 +494,148 @@ namespace sdv
void clear();
/**
* @brief Assign the value to the any. The any takes the value type based on the value.
* @tparam TType The type of the value to set.
* @param[in] tVal The value to set.
* @brief Assignment function.
* @param[in] bVal The value to assign.
*/
template <typename TType>
void set(TType tVal);
void set(bool bVal);
/**
* @{
* @brief Assignment function.
* @param[in] iVal The value to assign.
*/
void set(int8_t iVal);
void set(int16_t iVal);
void set(int32_t iVal);
#ifdef _WIN32
void set(long iVal);
#endif
void set(int64_t iVal);
#ifdef __linux__
void set(long long int iVal);
#endif
/**
* @}
*/
/**
* @{
* @brief Assignment function.
* @param[in] uiVal The value to assign.
*/
void set(uint8_t uiVal);
void set(uint16_t uiVal);
void set(uint32_t uiVal);
#ifdef _WIN32
void set(unsigned long uiVal);
#endif
void set(uint64_t uiVal);
#ifdef __linux__
void set(unsigned long long int uiVal);
#endif
/**
* @}
*/
/**
* @{
* @brief Assignment function.
* @param[in] cVal The value to assign.
*/
void set(char cVal);
void set(char16_t cVal);
void set(char32_t cVal);
void set(wchar_t cVal);
/**
* @}
*/
/**
* @{
* @brief Assignment function.
* @param[in] fVal The value to assign.
*/
void set(float fVal);
void set(double fVal);
void set(long double fVal);
/**
* @}
*/
/**
* @{
* @brief SDV string assignment function.
* @param[in] rssVal Reference to the string object.
*/
void set(const string& rssVal);
void set(const u8string& rssVal);
void set(const u16string& rssVal);
void set(const u32string& rssVal);
void set(const wstring& rssVal);
/**
* @}
*/
/**
* @{
* @brief C-style string assignment function.
* @param[in] szVal Zero terminated string.
*/
void set(const char* szVal);
void set(const char16_t* szVal);
void set(const char32_t* szVal);
void set(const wchar_t* szVal);
/**
* @}
*/
/**
* @{
* @brief STD string assignment function.
* @param[in] rssVal Reference to the string object.
*/
void set(const std::string& rssVal);
void set(const std::u16string& rssVal);
void set(const std::u32string& rssVal);
void set(const std::wstring& rssVal);
/**
* @}
*/
/**
* @brief STD path assignment function (will be stored as u8string).
* @param[in] rpathVal Reference to the path object.
*/
void set(const std::filesystem::path& rpathVal);
/**
* @brief Interface assignment function.
* @param[in] ifcVal Interface pointer.
*/
void set(interface_t ifcVal);
// Assignment already covered by set(uint64)
///**
// * brief Interface ID assignment function.
// * param[in] idIfcVal Interface ID.
// */
//void set(interface_id idIfcVal);
// Assignment already covered by set(uint64)
///**
// * brief Exception ID assignment function.
// * param[in] idExceptVal Exception ID.
// */
//void set(exception_id idExceptVal);
/**
* @brief Enum assignment function.
* tparam TEnum Enum type.
* @tparam TEnable Enable the function if the TType is an enum.
* @param[in] eVal Enum value.
*/
template <typename TEnum, typename TEnable = std::enable_if_t<std::is_enum_v<TEnum>>>
void set(TEnum eVal);
/**
* @brief Assign the value to the any. The value will be converted to the provided value type.
@@ -273,7 +656,7 @@ namespace sdv
/**
* @brief Comparison type.
*/
*/
enum class ECompareType
{
compare_equal,

File diff suppressed because it is too large Load Diff

View File

@@ -1,3 +1,16 @@
/********************************************************************************
* 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 SDV_APP_CONTROL_H
#define SDV_APP_CONTROL_H
@@ -18,8 +31,8 @@ namespace sdv
{
public:
/**
* @brief Default constructor; doesn't start the application control.
*/
* @brief Default constructor; doesn't start the application control.
*/
CAppControl() = default;
/**
@@ -256,7 +269,7 @@ namespace sdv
/**
* @brief Get the application context.
* @return The application context.
*/
*/
EAppContext GetAppContext() const
{
return m_eContext;
@@ -265,7 +278,7 @@ namespace sdv
/**
* @brief Get the core instance ID.
* @return The core instance ID.
*/
*/
uint32_t GetInstanceID() const
{
return m_uiInstanceID;
@@ -292,9 +305,9 @@ namespace sdv
}
/**
* @brief Set the operation to config mode.
* @pre The system is operating in running mode.
*/
* @brief Set the operation to config mode.
* @pre The system is operating in running mode.
*/
void SetConfigMode()
{
IAppOperation* pAppOperation = core::GetObject<IAppOperation>("AppControlService");
@@ -330,7 +343,7 @@ namespace sdv
* @param[in] ssFilename Path to the file containing the configuration (TOML). The path can be absolute as well as relative.
* In case a relative path is provided, the current directory is searched as well as all directories supplied through
* the AddConfigSearchDir function.
* @return Returns 'true' on success; 'false' otherwise.
* @return Returns a config process result enum value.
*/
core::EConfigProcessResult LoadConfig(/*in*/ const sdv::u8string& ssFilename)
{
@@ -346,6 +359,52 @@ namespace sdv
return eResult;
}
/**
* @brief Save a configuration file pointed to by the provided file path. All components are saved that were added after
* the last baseline with the configuration specific settings.
* @remarks The function will only save when the configuration has changed.
* @param[in] ssConfigPath Path to the file containing the configuration (TOML). The path can be an absolute as well as
* a relative path. In case a relative path is provided, the configuration is stored relative to the executable
* directory.
* @return Returns 'true' on success (or no changes detected); 'false' otherwise.
*/
bool SaveConfig(/*in*/ sdv::u8string ssConfigPath) const
{
const core::IConfig* pAppConfig = nullptr;
sdv::TInterfaceAccessPtr ptrConfigObj = core::GetObject("ConfigService");
if (ptrConfigObj) pAppConfig = ptrConfigObj.GetInterface<core::IConfig>();
if (!pAppConfig) return false;
return pAppConfig->SaveConfig(ssConfigPath);
}
/**
* @brief Generate the configuration TOML string.
* @return The generated configuration string.
*/
sdv::u8string GenerateConfigString() const
{
const core::IConfig* pAppConfig = nullptr;
sdv::TInterfaceAccessPtr ptrConfigObj = core::GetObject("ConfigService");
if (ptrConfigObj) pAppConfig = ptrConfigObj.GetInterface<core::IConfig>();
if (!pAppConfig) return {};
return pAppConfig->GenerateConfigString();
}
/**
* @brief Close the current configuration.
* @details This will close und unload the components and modules from the current configuration as well as dependent
* components that builds on top of the components being closed. Components that the current configuration depends on
* are not closed.
*/
void CloseConfig()
{
core::IConfig* pAppConfig = nullptr;
sdv::TInterfaceAccessPtr ptrConfigObj = core::GetObject("ConfigService");
if (ptrConfigObj) pAppConfig = ptrConfigObj.GetInterface<core::IConfig>();
if (!pAppConfig) return;
pAppConfig->CloseConfig();
}
/**
* @brief Add a search path to a folder where a config file can be found.
* @param[in] rpathDir Reference to the relative or absolute path to an existing folder.

File diff suppressed because it is too large Load Diff

View File

@@ -1,3 +1,16 @@
/********************************************************************************
* 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 SDV_CRC_H
#define SDV_CRC_H
@@ -12,7 +25,7 @@ namespace sdv
* @tparam T The type to use for bit reflection.
* @param[in] tValue The value to reflect. Must be a arithmetic or boolean type.
* @return The reflected value.
*/
*/
template <typename T>
constexpr T reflect(T tValue)
{
@@ -53,7 +66,7 @@ namespace sdv
* @param[in] pData Pointer to the value buffer.
* @param[in] nCount Amount of values in the buffer.
* @return The calculated CRC checksum.
*/
*/
template <typename T>
TCRCType calc_checksum(const T* pData, size_t nCount) noexcept;
@@ -62,25 +75,25 @@ namespace sdv
* @remarks The CRC calculation occurs byte-wise regardless of the endianness of the the processor architecture.
* @tparam T Type of the value buffer to calculate the CRC for.
* @param[in] tValue The value to add to the calculation.
*/
*/
template <typename T>
void add(T tValue) noexcept;
/**
* @brief Get the currently calculated checksum.
* @return The CRC checksum.
*/
*/
TCRCType get_checksum() const noexcept;
/**
* @brief Set a CRC checksum to continue the calculation with additional data.
* @param[in] tCrcValue The previously calculated CRC value.
*/
*/
void set_checksum(TCRCType tCrcValue) noexcept;
/**
* @brief Reset the current calculation (resets the CRC value to its initial value).
*/
*/
void reset() noexcept;
private:

View File

@@ -1,3 +1,16 @@
/********************************************************************************
* 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 SDV_EXCEPT_H
#define SDV_EXCEPT_H
@@ -11,15 +24,15 @@
namespace sdv
{
/**
* @brief exception ID type
*/
* @brief exception ID type
*/
using exception_id = uint64_t;
/**
* @brief Get the exception ID.
* @tparam TException The exception type
* @return The ID of the exception
*/
* @brief Get the exception ID.
* @tparam TException The exception type
* @return The ID of the exception
*/
template <typename TExcept>
constexpr inline exception_id GetExceptionId() noexcept
{

View File

@@ -1,3 +1,16 @@
/********************************************************************************
* 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 SDV_INTERFACE_H
#define SDV_INTERFACE_H
@@ -8,6 +21,8 @@
#define interface struct
#endif
namespace sdv
{
/**

View File

@@ -1,8 +1,21 @@
/********************************************************************************
* 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 SDV_INTERFACE_INL
#define SDV_INTERFACE_INL
#ifndef SDV_INTERFACE_H
#error Do not include "interface.inl" directly. Include "interface.h" instead!
#include "interface.h"
#endif //!defined SDV_INTERFACE_H
#include <cstddef>

View File

@@ -1,13 +1,16 @@
/**
/********************************************************************************
* Copyright (c) 2025-2026 ZF Friedrichshafen AG
*
* @file interface_ptr.h
* @brief This file provides all necessary definitions to use and implement interface maps.
* @version 0.1
* @date 2022.11.14
* @author Thomas.pfleiderer@zf.com
* @copyright Copyright ZF Friedrichshaven AG (c) 2022
* 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 INTERFACE_IMPL_H
#define INTERFACE_IMPL_H
@@ -79,10 +82,24 @@ namespace sdv
int m_uiUseSection = -1; ///< The number of the section to process the interface table entries for.
int m_uiSection = -1; ///< The number of the section the interface table entries belong to.
};
/**
* @brief Helper struct for type reporting during static_assert.
* @tparam T Type to report for the always_false struct.
*/
template <typename T>
struct always_false : std::false_type
{};
/**
* @brief Variable for the always_false struct.
* @tparam T Type to report for the always_false struct.
*/
template <typename T>
constexpr bool always_false_v = always_false<T>::value;
}
}
/**
* @brief Interface map containing the supported interface definitions.
* @pre The class using the interface map should derive from IInterfaceAccess.
@@ -171,17 +188,16 @@ namespace sdv
/**
* @brief Conditional check; when true continue the checking for interfaces.
* @param condition The condition to be checked. When 'false' processing will be stopped; otherwise processing
* continues. Example: @code SDV_INTERFACE_CHECK_CONDITION(CheckFunc()) @endcode
* @param condition The condition to be checked. When 'false' processing will be stopped; otherwise processing continues.
* Example: @code SDV_INTERFACE_CHECK_CONDITION(CheckFunc()) @endcode
*/
#define SDV_INTERFACE_CHECK_CONDITION(condition) \
if (!(condition)) \
return nullptr;
if (!(condition)) return nullptr;
/**
* @brief Use the condition, to select a section to process.
* @param condition Condition to be checked. When 'true' processing will be limited to the section.
* Example: @code SDV_INTERFACE_PROCESS_SECTION(CheckFunc(), 1) @endcode
* Example: @code SDV_INTERFACE_SET_SECTION_CONDITION(CheckFunc(), 1) @endcode
* @param section_number The section to be processed when the condition is true.
*/
#define SDV_INTERFACE_SET_SECTION_CONDITION(condition, section_number) \
@@ -311,6 +327,26 @@ namespace sdv
return *this;
}
/**
* @brief Compare the interface pointer with an interface.
* @param[in] pInterface Pointer to the interface.
* @return Returns whether the interfaces are equal.
*/
bool operator==(const IInterfaceAccess* pInterface) const
{
return static_cast<const IInterfaceAccess*>(m_pInterface) == pInterface;
}
/**
* @brief Compare the interface pointer with an interface.
* @param[in] pInterface Pointer to the interface.
* @return Returns whether the interfaces are not equal.
*/
bool operator!=(const IInterfaceAccess* pInterface) const
{
return static_cast<const IInterfaceAccess*>(m_pInterface) == pInterface;
}
/**
* @brief Get a pointer to the interface
*/
@@ -392,7 +428,7 @@ namespace sdv
return rtMember.GetInterface(idInterface);
}
// Warning of cppchgeck for a potential const variable cannot be applied due to the non-const nature of interfaces. Suppress
// Warning of cppcheck for a potential const variable cannot be applied due to the non-const nature of interfaces. Suppress
// warning.
// cppcheck-suppress constParameterReference
/**

View File

@@ -1,3 +1,16 @@
/********************************************************************************
* 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 SDV_ITERATOR_H
#define SDV_ITERATOR_H
@@ -15,7 +28,7 @@ namespace sdv
* @tparam TContainer Container type to use for this iterator.
* @tparam bConstIterator When set, the iterator is a const iterator not allowing to change values within the container.
* @tparam bReserseIterator When set, the iterator starts at the end instead of at the beginning and decreases the location.
*/
*/
template <class TContainer, bool bConstIterator, bool bReverseIterator>
class index_iterator
{

View File

@@ -1,3 +1,16 @@
/********************************************************************************
* 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 LOCAL_SERVICE_ACCESS_H
#define LOCAL_SERVICE_ACCESS_H

View File

@@ -1,3 +1,16 @@
/********************************************************************************
* 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 MEM_SUPPORT_H
#define MEM_SUPPORT_H

1541
export/support/param_impl.h Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,732 @@
/********************************************************************************
* 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 PARAM_IMPL_INL
#define PARAM_IMPL_INL
#ifndef PARAM_IMPL_H
#include "param_impl.h"
#endif //! defined PARAM_IMPL_H
#include <regex>
#include <set>
/**
* @brief Software Defined Vehicle framework.
*/
namespace sdv
{
template <typename TVar, typename TDefaultType>
inline CSdvParamInfo::CSdvParamInfo(TVar&, const std::string& rssName, TDefaultType tDefaultVal, const std::string& rssUnit,
const std::string& rssCategory, const std::string& rssDescription, uint32_t uiFlagsParam)
{
EParamType eTypeLocal = EParamType::boolean_param;
if constexpr (std::is_same_v<TVar, bool>)
eTypeLocal = EParamType::boolean_param;
else if constexpr (std::is_arithmetic_v<TVar>)
eTypeLocal = EParamType::number_param; // No number limitation
else if constexpr (TypeIsString<TVar>())
eTypeLocal = EParamType::string_param; // No pattern
else if constexpr (std::is_enum_v<TVar>)
eTypeLocal = EParamType::enum_param; // No enumerator labels
else
static_assert(sdv::internal::always_false_v<TVar>, "The parameter type is not supported!");
any_t anyDefaultValLocal;
if constexpr (std::is_enum_v<TVar>)
{
static_assert(std::is_same_v<std::remove_reference_t<std::remove_const_t<TVar>>, TDefaultType>,
"The enum types of the value and the default value must be identical!");
anyDefaultValLocal = static_cast<std::underlying_type_t<TVar>>(tDefaultVal);
}
else
anyDefaultValLocal = tDefaultVal;
uint32_t uiFlagsLocal = uiFlagsParam;
if (TypeIsReadOnly<TVar>())
uiFlagsLocal |= static_cast<uint32_t>(EParamFlags::read_only);
if (uiFlagsLocal & static_cast<uint32_t>(EParamFlags::read_only))
uiFlagsLocal &= ~static_cast<uint32_t>(EParamFlags::locked); // Readonly cannot write
Init(eTypeLocal, rssName, anyDefaultValLocal, rssUnit, rssCategory, rssDescription, uiFlagsLocal);
if constexpr (std::is_enum_v<TVar>)
uExtInfo.sEnumInfo.seqLabels = internal::GetLabelMapHelper().GetLabelMap<TVar>();
}
template <typename TVar, typename TDefaultType>
inline CSdvParamInfo::CSdvParamInfo(TVar&, const std::string& rssName, TDefaultType tDefaultVal, const any_t& ranyLimitLow,
bool bIncludeLow, const any_t& ranyLimitHigh, bool bIncludeHigh, const std::string& rssUnit, const std::string& rssCategory,
const std::string& rssDescription, uint32_t uiFlagsParam)
{
static_assert(std::is_arithmetic_v<TVar> && !std::is_same_v<TVar, bool>,
"The construct function for numeric types expects the type to be numeric.");
uint32_t uiFlagsLocal = uiFlagsParam;
if (TypeIsReadOnly<TVar>())
uiFlagsLocal |= static_cast<uint32_t>(EParamFlags::read_only);
if (uiFlagsLocal & static_cast<uint32_t>(EParamFlags::read_only))
uiFlagsLocal &= ~static_cast<uint32_t>(EParamFlags::locked); // Readonly cannot write
Init(EParamType::number_param, rssName, tDefaultVal, rssUnit, rssCategory, rssDescription, uiFlagsLocal);
uExtInfo.sNumberInfo.anyLowerLimit = ranyLimitLow;
uExtInfo.sNumberInfo.bIncludeLowerLinit = bIncludeLow;
uExtInfo.sNumberInfo.anyUpperLimit = ranyLimitHigh;
uExtInfo.sNumberInfo.bIncludeUpperLimit = bIncludeHigh;
}
template <typename TVar, typename TDefaultType>
inline CSdvParamInfo::CSdvParamInfo(TVar&, const std::string& rssName, TDefaultType tDefaultVal, const std::string& rssPattern,
const std::string& rssUnit, const std::string& rssCategory, const std::string& rssDescription, uint32_t uiFlagsParam)
{
static_assert(TypeIsString<TVar>(), "The construct function for string types expects the type to be a string.");
uint32_t uiFlagsLocal = uiFlagsParam;
if (TypeIsReadOnly<TVar>())
uiFlagsLocal |= static_cast<uint32_t>(EParamFlags::read_only);
if (uiFlagsLocal & static_cast<uint32_t>(EParamFlags::read_only))
uiFlagsLocal &= ~static_cast<uint32_t>(EParamFlags::locked); // Readonly cannot write
Init(EParamType::string_param, rssName, tDefaultVal, rssUnit, rssCategory, rssDescription, uiFlagsLocal);
uExtInfo.sStringInfo.ssPattern = rssPattern;
}
template <typename TVar, typename TDefaultType>
inline CSdvParamInfo::CSdvParamInfo(TVar&, const std::string& rssName, TDefaultType tDefaultVal,
const sequence<SLabelInfo::SLabel>& rseqLabels, const std::string& rssCategory, const std::string& rssDescription,
uint32_t uiFlagsParam)
{
static_assert(std::is_enum_v<TVar> || (std::is_integral_v<TVar> && !std::is_same_v<TVar, bool>),
"The construct function for enumerators and bitmasks expects the type to be an enum or an integral type.");
uint32_t uiFlagsLocal = uiFlagsParam;
if (TypeIsReadOnly<TVar>())
uiFlagsLocal |= static_cast<uint32_t>(EParamFlags::read_only);
if (uiFlagsLocal & static_cast<uint32_t>(EParamFlags::read_only))
uiFlagsLocal &= ~static_cast<uint32_t>(EParamFlags::locked); // Readonly cannot write
if constexpr (std::is_enum_v<TVar>)
{
Init(EParamType::enum_param, rssName, static_cast<std::underlying_type_t<TVar>>(tDefaultVal), "",
rssCategory, rssDescription, uiFlagsLocal);
uExtInfo.sEnumInfo.seqLabels = rseqLabels;
}
else
{
Init(EParamType::bitmask_param, rssName, tDefaultVal, "", rssCategory, rssDescription, uiFlagsLocal);
uExtInfo.sBitmaskInfo.seqLabels = rseqLabels;
}
}
inline CSdvParamInfo::CSdvParamInfo(const SParamInfo& rInfo) : SParamInfo(rInfo)
{}
inline CSdvParamInfo::CSdvParamInfo(SParamInfo&& rInfo) : SParamInfo(std::move(rInfo))
{}
inline CSdvParamInfo& CSdvParamInfo::operator=(const SParamInfo& rsInfo)
{
static_cast<SParamInfo&>(*this) = rsInfo;
return *this;
}
inline CSdvParamInfo& CSdvParamInfo::operator=(SParamInfo&& rsInfo)
{
static_cast<SParamInfo&>(*this) = std::move(rsInfo);
return *this;
}
inline SParamInfo CSdvParamInfo::InfoStruct() const
{
return *this;
}
inline const u8string& CSdvParamInfo::Name() const
{
return SParamInfo::ssName;
}
inline u8string CSdvParamInfo::Path() const
{
sdv::u8string ssPath;
if (!SParamInfo::ssGroup.empty())
ssPath += ssGroup + ".";
ssPath += ssName;
return ssPath;
}
inline const any_t& CSdvParamInfo::DefaultVal() const
{
return SParamInfo::anyDefaultVal;
}
inline const u8string& CSdvParamInfo::Group() const
{
return SParamInfo::ssGroup;
}
inline const u8string& CSdvParamInfo::Description() const
{
return SParamInfo::ssDescription;
}
inline const u8string& CSdvParamInfo::Unit() const
{
return SParamInfo::ssUnit;
}
inline uint32_t CSdvParamInfo::Flags() const
{
return uiFlags;
}
inline bool CSdvParamInfo::ReadOnly() const
{
return (uiFlags & static_cast<uint32_t>(EParamFlags::read_only)) ? true : false;
}
inline bool CSdvParamInfo::Temporary() const
{
return (uiFlags & static_cast<uint32_t>(EParamFlags::temporary)) ? true : false;
}
inline bool CSdvParamInfo::Dirty() const
{
return (uiFlags & static_cast<uint32_t>(EParamFlags::dirty)) ? true : false;
}
inline bool CSdvParamInfo::Locked() const
{
return (uiFlags & static_cast<uint32_t>(EParamFlags::locked)) ? true : false;
}
inline bool CSdvParamInfo::Boolean() const
{
return get_switch() == EParamType::boolean_param;
}
inline bool CSdvParamInfo::Numeric() const
{
return get_switch() == EParamType::number_param;
}
inline bool CSdvParamInfo::String() const
{
return get_switch() == EParamType::string_param;
}
inline bool CSdvParamInfo::Enum() const
{
return get_switch() == EParamType::enum_param;
}
inline bool CSdvParamInfo::Bitmask() const
{
return get_switch() == EParamType::bitmask_param;
}
inline std::pair<any_t, bool> CSdvParamInfo::NumericLimitLow() const
{
if (!Numeric()) return {};
return std::make_pair(uExtInfo.sNumberInfo.anyLowerLimit, uExtInfo.sNumberInfo.bIncludeLowerLinit);
}
inline std::pair<any_t, bool> CSdvParamInfo::NumericLimitHigh() const
{
if (!Numeric()) return {};
return std::make_pair(uExtInfo.sNumberInfo.anyUpperLimit, uExtInfo.sNumberInfo.bIncludeUpperLimit);
}
inline std::string CSdvParamInfo::StringPattern() const
{
if (!String()) return {};
return uExtInfo.sStringInfo.ssPattern;
}
inline sequence<SLabelInfo::SLabel> CSdvParamInfo::EnumBitmaskLabels() const
{
if (Enum())
return uExtInfo.sEnumInfo.seqLabels;
else if (Bitmask())
return uExtInfo.sBitmaskInfo.seqLabels;
else
return {};
}
inline void CSdvParamInfo::Init(EParamType eTypeParam, const std::string& rssName, const any_t& ranyDefaultVal,
const std::string& rssUnit, const std::string& rssCategory, const std::string& rssDescription, uint32_t uiFlagsParam)
{
switch_to(eTypeParam);
uiFlags = uiFlagsParam;
ssName = rssName;
anyDefaultVal = ranyDefaultVal;
ssUnit = rssUnit;
ssGroup = rssCategory;
ssDescription = rssDescription;
}
namespace internal
{
template <typename... TInfoConstruct>
inline CParamGuardian::CParamGuardian(bool bLockable, bool bAutoDirty, TInfoConstruct... tConstruct) :
CSdvParamInfo(tConstruct...), m_bLockable(bLockable), m_bAutoDirty(bAutoDirty)
{}
inline SParamInfo CParamGuardian::InfoStruct() const
{
sdv::SParamInfo sInfo = CSdvParamInfo::InfoStruct();
sInfo.uiFlags = Flags();
return sInfo;
}
inline uint32_t CParamGuardian::Flags() const
{
uint32_t uiFlagsTemp = CSdvParamInfo::Flags() & ~static_cast<uint32_t>(EParamFlags::state_mask);
if (m_bLocked)
uiFlagsTemp |= static_cast<uint32_t>(EParamFlags::locked);
if (m_bDirty)
uiFlagsTemp |= static_cast<uint32_t>(EParamFlags::dirty);
return uiFlagsTemp;
}
inline bool CParamGuardian::UpdateDirty(const sdv::any_t& ranyValue)
{
if (!m_bAutoDirty) return false;
bool bDirty = m_bDirty;
m_bDirty |= ranyValue != m_anyStored;
m_anyStored = ranyValue;
return m_bDirty != bDirty;
}
inline bool CParamGuardian::SetDirty()
{
bool bDirty = m_bDirty;
m_bDirty = true;
return m_bDirty != bDirty;
}
inline bool CParamGuardian::ResetDirty()
{
bool bDirty = m_bDirty;
m_bDirty = false;
return m_bDirty != bDirty;
}
inline bool CParamGuardian::Dirty() const
{
return m_bDirty;
}
inline bool CParamGuardian::Lockable() const
{
return m_bLockable;
}
inline bool CParamGuardian::Lock()
{
if (!m_bLockable)
return false;
bool bLocked = m_bLocked;
m_bLocked = true;
return m_bLocked != bLocked;
}
inline bool CParamGuardian::Unlock()
{
if (!m_bLockable)
return false;
bool bLocked = m_bLocked;
m_bLocked = false;
return m_bLocked != bLocked;
}
inline bool CParamGuardian::Locked() const
{
return m_bLocked;
}
inline bool CParamGuardian::CheckRestrictions(const any_t& ranyValue)
{
if (Numeric())
{
// Check for lower limit
auto prLimitLow = NumericLimitLow();
if (!prLimitLow.first.empty())
{
if (prLimitLow.second)
{
if (ranyValue < prLimitLow.first) return false;
} else
{
if (ranyValue <= prLimitLow.first) return false;
}
}
// Check for higher limit
auto prLimitHigh = NumericLimitHigh();
if (!prLimitHigh.first.empty())
{
if (prLimitHigh.second)
{
if (ranyValue > prLimitHigh.first) return false;
}
else
{
if (ranyValue >= prLimitHigh.first) return false;
}
}
}
else if (String())
{
// Check for compatibility to the regular expression pattern.
if (!StringPattern().empty())
{
std::regex regexPattern(StringPattern());
if (!std::regex_match(static_cast<std::string>(ranyValue), regexPattern)) return false;
}
}
else if (Enum())
{
// Check for occurrence in the label sequence
auto seqLabels = EnumBitmaskLabels();
if (std::find_if(seqLabels.begin(), seqLabels.end(), [&](const auto& rsLabel)
{ return ranyValue == rsLabel.anyValue; }) == seqLabels.end()) return false;
}
else if (Bitmask())
{
// Check for the occurence of each set bit in the label sequence
auto seqLabels = EnumBitmaskLabels();
uint64_t uiBitmask = ranyValue;
for (const auto& rsLabel : seqLabels)
uiBitmask &= ~static_cast<uint64_t>(rsLabel.anyValue);
if (uiBitmask) return false;
}
// All okay; restrictions were checked
return true;
}
template <typename TVar>
template <typename... TInfoConstruct>
inline CParamValue<TVar>::CParamValue(TVar& rtVar, bool bLockable, bool bAutoDirty, TInfoConstruct... tConstruct) :
CParamGuardian(bLockable, bAutoDirty, rtVar, tConstruct...), m_rtVar(rtVar)
{
// Assign the default value
if constexpr (!CSdvParamInfo::TypeIsReadOnly<TVar>())
{
m_rtVar = DefaultVal().get<TVar>();
UpdateDirty(DefaultVal());
ResetDirty();
}
}
template <typename TVar>
inline bool CParamValue<TVar>::Set(const any_t& ranyValue)
{
// Assign the value
if constexpr (!CSdvParamInfo::TypeIsReadOnly<TVar>())
{
if (!Locked() && !ReadOnly() && CheckRestrictions(ranyValue))
{
m_rtVar = ranyValue.get<TVar>();
UpdateDirty(ranyValue);
return true;
}
}
return false;
}
template <typename TVar>
inline any_t CParamValue<TVar>::Get() const
{
// Remarks: in case of an enum, an explicit construction is needed.
return sdv::any_t(m_rtVar);
}
} // namespace internal
inline std::shared_ptr<internal::CParamGuardian> CSdvParamMap::FindParamObject(const sdv::u8string& rssPath)
{
// Iterate through the registrations
for (const SParamRegistration& rsRegistration : m_vecParamMapRegistration)
{
// Member parameter map entry
if (rsRegistration.MemberMap() && rsRegistration.MemberMap()->Access())
{
auto ptrParameter = rsRegistration.MemberMap()->Access()->FindParamObject(rssPath);
if (ptrParameter) return ptrParameter;
}
// Parameter entry
if (rsRegistration.Parameter() && rsRegistration.Parameter()->Path() == rssPath)
return rsRegistration.Parameter();
}
return {};
}
inline std::shared_ptr<const internal::CParamGuardian> CSdvParamMap::FindParamObject(const sdv::u8string& rssPath) const
{
// Iterate through the registrations
for (const SParamRegistration& rsRegistration : m_vecParamMapRegistration)
{
// Member parameter map entry
if (rsRegistration.MemberMap() && rsRegistration.MemberMap()->Access())
{
auto ptrParameter = rsRegistration.MemberMap()->Access()->FindParamObject(rssPath);
if (ptrParameter)
return ptrParameter;
}
// Parameter entry
if (rsRegistration.Parameter() && rsRegistration.Parameter()->Path() == rssPath)
return rsRegistration.Parameter();
}
return {};
}
inline sequence<u8string> CSdvParamMap::GetParamPaths() const
{
// Split path function (splits the group from the parameter names)
auto fnSplitPath = [](const sdv::u8string& rssPath) -> std::pair<sdv::u8string, sdv::u8string>
{
size_t nPos = rssPath.find_last_of('.');
if (nPos == sdv::u8string::npos)
return std::make_pair("", rssPath);
return std::make_pair(rssPath.substr(0, nPos), rssPath.substr(nPos + 1));
};
std::set<u8string> setOneTime;
sequence<u8string> seqPaths;
for (const auto& rsRegistration : m_vecParamMapRegistration)
{
// Add a path to the sequence.
auto fnAddPath = [&](const u8string& rssPath)
{
// Check if already present in the list
if (setOneTime.find(rssPath) != setOneTime.end()) return;
setOneTime.insert(rssPath);
// Sort the paths per group, so all paths belonging to one group is returned together.
// Find thee first location where the group is larger than the one of this path.
auto prPath = fnSplitPath(rssPath);
auto itPos = seqPaths.begin();
while (itPos != seqPaths.end())
{
auto prStoredPath = fnSplitPath(*itPos);
if (prPath.first.compare(prStoredPath.first) < 0) break;
++itPos;
}
// Insert into the sequence
seqPaths.insert(itPos, rssPath);
};
// Add the chained member to the list
if (rsRegistration.MemberMap() && rsRegistration.MemberMap()->Access())
{
auto seqNamesMemberMap = rsRegistration.MemberMap()->Access()->GetParamPaths();
for (const auto& rssPath : seqNamesMemberMap)
fnAddPath(rssPath);
}
// Add the parameter to the list
if (rsRegistration.Parameter())
fnAddPath(rsRegistration.Parameter()->Path());
}
return seqPaths;
}
inline any_t CSdvParamMap::GetParam(const u8string& rssPath) const
{
auto ptrParam = FindParamObject(rssPath);
if (!ptrParam) return {};
return ptrParam->Get();
}
inline bool CSdvParamMap::SetParam(const u8string& rssPath, any_t ranyValue)
{
auto ptrParam = FindParamObject(rssPath);
if (!ptrParam) return false;
return ptrParam->Set(ranyValue);
}
inline SParamInfo CSdvParamMap::GetParamInfo(const u8string& rssPath) const
{
auto ptrParamInfo = FindParamObject(rssPath);
if (!ptrParamInfo) return {};
return ptrParamInfo.get()->InfoStruct();
}
inline bool CSdvParamMap::IsParamDirty(const u8string& rssPath) const
{
auto ptrParam = FindParamObject(rssPath);
if (!ptrParam) return false;
return ptrParam->Dirty();
}
inline void CSdvParamMap::SetParamDirtyFlag(const std::string& rssPath)
{
auto ptrParam = FindParamObject(rssPath);
if (!ptrParam) return;
ptrParam->SetDirty();
}
inline void CSdvParamMap::ResetParamDirtyFlag(const u8string& rssPath)
{
auto ptrParam = FindParamObject(rssPath);
if (!ptrParam) return;
ptrParam->ResetDirty();
}
inline bool CSdvParamMap::IsParamMapDirty() const
{
std::set<u8string> setOneTime;
for (const auto& rsRegistration : m_vecParamMapRegistration)
{
// Member parameter map entry
if (rsRegistration.MemberMap() && rsRegistration.MemberMap()->Access())
{
if (rsRegistration.MemberMap()->Access()->IsParamMapDirty())
return true;
continue;
}
// Parameter entry
if (rsRegistration.Parameter())
{
// Check if already present in the list
if (setOneTime.find(rsRegistration.Parameter()->Name()) != setOneTime.end())
continue;
setOneTime.insert(rsRegistration.Parameter()->Name());
// Check for dirtiness
if (rsRegistration.Parameter()->Dirty())
return true;
}
}
return false;
}
inline void CSdvParamMap::ResetParamMapDirtyFlags()
{
std::set<u8string> setOneTime;
for (const auto& rsRegistration : m_vecParamMapRegistration)
{
// Member parameter map entry
if (rsRegistration.MemberMap() && rsRegistration.MemberMap()->Access())
{
rsRegistration.MemberMap()->Access()->ResetParamMapDirtyFlags();
continue;
}
// Parameter entry
if (rsRegistration.Parameter())
{
// Check if already present in the list
if (setOneTime.find(rsRegistration.Parameter()->Name()) != setOneTime.end())
continue;
setOneTime.insert(rsRegistration.Parameter()->Name());
// Reset dirtiness
rsRegistration.Parameter()->ResetDirty();
}
}
}
inline void CSdvParamMap::LockParamMap()
{
for (const auto& rsRegistration : m_vecParamMapRegistration)
{
// Member parameter map entry
if (rsRegistration.MemberMap() && rsRegistration.MemberMap()->Access())
{
rsRegistration.MemberMap()->Access()->LockParamMap();
continue;
}
// Parameter entry
if (rsRegistration.Parameter())
{
// Lock
rsRegistration.Parameter()->Lock();
}
}
}
inline void CSdvParamMap::UnlockParamMap()
{
for (const auto& rsRegistration : m_vecParamMapRegistration)
{
// Member parameter map entry
if (rsRegistration.MemberMap() && rsRegistration.MemberMap()->Access())
{
rsRegistration.MemberMap()->Access()->UnlockParamMap();
continue;
}
// Parameter entry
if (rsRegistration.Parameter())
{
// Lock
rsRegistration.Parameter()->Unlock();
}
}
}
template <typename TVar, typename... TConstruct>
inline std::shared_ptr<CSdvParamInfo> CSdvParamMap::RegisterParameter(TVar& rtVar, bool bLockable, bool bAutoDirty,
TConstruct... tConstruct)
{
auto ptrParam = std::make_shared<internal::CParamValue<TVar>>(rtVar, bLockable, bAutoDirty, tConstruct...);
m_vecParamMapRegistration.push_back(SParamRegistration(ptrParam));
return ptrParam;
}
inline void CSdvParamMap::RegisterMemberMap(const std::shared_ptr<internal::SMemberMapAccess>& rptrMember)
{
m_vecParamMapRegistration.push_back(SParamRegistration(rptrMember));
}
inline void CSdvParamMap::InitParamMap()
{
// Nothing to do here.
}
inline bool CSdvParamMap::BuildNecessary() const
{
return m_vecParamMapRegistration.empty();
}
template <typename TType>
constexpr bool CSdvParamInfo::TypeIsString()
{
using TType2 = std::remove_cv_t<TType>;
using TRoot = std::remove_cv_t<std::remove_pointer_t<std::remove_extent_t<TType2>>>;
constexpr bool bArray = std::is_array_v<TType2>;
constexpr bool bPointer = std::is_pointer_v<TType2>;
constexpr bool bCharacter = std::is_same_v<TRoot, char> || std::is_same_v<TRoot, char16_t> ||
std::is_same_v<TRoot, char32_t> || std::is_same_v<TRoot, wchar_t>;
constexpr bool bStdString = std::is_same_v<TType2, std:: string> || std::is_same_v<TType2, std::u16string> ||
std::is_same_v<TType2, std::u32string> || std::is_same_v<TType2, std::wstring>;
constexpr bool bSdvString = std::is_same_v<TType2, string> || std::is_same_v<TType2, u8string> ||
std::is_same_v<TType2, u16string> || std::is_same_v<TType2, u32string> || std::is_same_v<TType2, wstring>;
constexpr bool bStdPath = std::is_same_v<TType2, std::filesystem::path>;
return bStdString || bSdvString || (bArray && bCharacter) || (bPointer && bCharacter) || bStdPath;
}
template <typename TType>
constexpr bool CSdvParamInfo::TypeIsReadOnly()
{
using TType2 = std::remove_cv_t<TType>;
constexpr bool bArray = std::is_array_v<TType2>;
constexpr bool bPointer = std::is_pointer_v<TType2>;
return bArray || bPointer || std::is_const_v<TType>;
}
}; // namespace sdv
#endif // !defined PARAM_IMPL_INL

View File

@@ -1,3 +1,16 @@
/********************************************************************************
* 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 SDV_PTR_H
#define SDV_PTR_H

View File

@@ -1,3 +1,16 @@
/********************************************************************************
* 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 SDV_PTR_INL
#define SDV_PTR_INL
@@ -6,8 +19,8 @@
#endif
#ifndef SDV_PTR_H
#error Do not include "pointer.inl" directly. Include "pointer.h" instead!
#endif //!defined SDV_PTR_H
#include "pointer.h"
#endif //! defined SDV_PTR_H
#include "pointer.h"
#include <iostream>

View File

@@ -1,3 +1,16 @@
/********************************************************************************
* 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 SDV_PS_SUPPORT_H
#define SDV_PS_SUPPORT_H
@@ -330,13 +343,12 @@ namespace sdv
// Interface map
BEGIN_SDV_INTERFACE_MAP()
SDV_INTERFACE_CHAIN_BASE(sdv::CSdvObject)
SDV_INTERFACE_ENTRY(IMarshallObjectIdent)
SDV_INTERFACE_ENTRY(IMarshallLink)
END_SDV_INTERFACE_MAP()
// Object class type
DECLARE_OBJECT_CLASS_TYPE(sdv::EObjectType::Proxy)
DECLARE_OBJECT_CLASS_TYPE(sdv::EObjectType::proxy)
/**
* @brief Set the identification. Overload of IMarshallObjectIdent::SetIdentification.
@@ -396,13 +408,12 @@ namespace sdv
// Interface map
BEGIN_SDV_INTERFACE_MAP()
SDV_INTERFACE_CHAIN_BASE(sdv::CSdvObject)
SDV_INTERFACE_ENTRY(IMarshallObjectIdent)
SDV_INTERFACE_ENTRY(IMarshall)
END_SDV_INTERFACE_MAP()
// Object class type
DECLARE_OBJECT_CLASS_TYPE(sdv::EObjectType::Stub)
DECLARE_OBJECT_CLASS_TYPE(sdv::EObjectType::stub)
protected:
/**

View File

@@ -1,9 +1,22 @@
/********************************************************************************
* 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 SDV_PS_SUPPORT_INL
#define SDV_PS_SUPPORT_INL
#ifndef SDV_PS_SUPPORT_H
#error Do not include "pssup.inl" directly. Include "pssup.h" instead!
#endif //!defined SDV_PS_SUPPORT_H
#include "pssup.h"
#endif //! defined SDV_PS_SUPPORT_H
#include "../interfaces/core_ps.h"
#include "../interfaces/serdes/core_ps_serdes.h"
@@ -23,8 +36,8 @@
namespace serdes
{
/**
* @brief Specialization of serializer/deserializer class for sdv::interface_t.
*/
* @brief Specialization of serializer/deserializer class for sdv::interface_t.
*/
template <>
class CSerdes<sdv::interface_t>
{

View File

@@ -1,3 +1,16 @@
/********************************************************************************
* 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 SDV_CORE_H
#define SDV_CORE_H
@@ -48,6 +61,87 @@
namespace sdv
{
/**
* @brief Get the object type string from the type
* @param[in] eType The object type to get the string from.
* @return The object type string.
*/
inline std::string ObjectType2String(sdv::EObjectType eType)
{
switch (eType)
{
case EObjectType::system_object:
return "SystemObject";
case EObjectType::device:
return "Device";
case EObjectType::platform_abstraction:
return "PlatformAbstraction";
case EObjectType::vehicle_bus:
return "VehicleBus";
case EObjectType::basic_service:
return "BasicService";
case EObjectType::sensor:
return "Sensor";
case EObjectType::actuator:
return "Actuator";
case EObjectType::complex_service:
return "ComplexService";
case EObjectType::vehicle_function:
return "VehicleFunction";
case EObjectType::application:
return "Application";
case EObjectType::proxy:
return "Proxy";
case EObjectType::stub:
return "Stub";
case EObjectType::utility:
return "Utility";
default:
return "Unknown";
}
}
/**
* @brief Get the object type from the string
* @param[in] rssType Reference to the string identifying the object type.
* @return The object type or sdv::EObjectType::Undefined.
*/
inline EObjectType String2ObjectType(const std::string& rssType)
{
if (rssType == "SystemObject")
return EObjectType::system_object;
if (rssType == "Device")
return EObjectType::device;
if (rssType == "PlatformAbstraction")
return EObjectType::platform_abstraction;
if (rssType == "VehicleBus")
return EObjectType::vehicle_bus;
if (rssType == "BasicService")
return EObjectType::basic_service;
if (rssType == "Sensor")
return EObjectType::sensor;
if (rssType == "Actuator")
return EObjectType::actuator;
if (rssType == "ComplexService")
return EObjectType::complex_service;
if (rssType == "VehicleFunction")
return EObjectType::complex_service;
if (rssType == "Application")
return EObjectType::application;
if (rssType == "Proxy")
return EObjectType::proxy;
if (rssType == "Stub")
return EObjectType::stub;
if (rssType == "Utility")
return EObjectType::utility;
return EObjectType::undefined;
}
} // namespace sdv
#ifndef SDV_NO_LOADER
namespace sdv{
namespace core
{
namespace internal
@@ -345,6 +439,6 @@ namespace sdv
#endif
}
}
#endif // !defined SDV_NO_LOADER
#endif // !define SDV_CORE_H

View File

@@ -1,3 +1,16 @@
/********************************************************************************
* 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 SDV_SEQUENCE_H
#define SDV_SEQUENCE_H

View File

@@ -1,9 +1,22 @@
/********************************************************************************
* 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 SDV_SEQUENCE_INL
#define SDV_SEQUENCE_INL
#ifndef SDV_SEQUENCE_H
#error Do not include "sequence.inl" directly. Include "sequence.h" instead!
#endif //!defined SDV_SEQUENCE_H
#include "sequence.h"
#endif //! defined SDV_SEQUENCE_H
namespace sdv
{

View File

@@ -1,3 +1,16 @@
/********************************************************************************
* 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 SDV_SERDES_H
#define SDV_SERDES_H

View File

@@ -1,9 +1,22 @@
/********************************************************************************
* 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 SDV_SERDES_INL
#define SDV_SERDES_INL
#ifndef SDV_SERDES_H
#error Do not include "serdes.inl" directly. Include "serdes.h" instead!
#endif //!defined SDV_SERDES_H
#include "serdes.h"
#endif //! defined SDV_SERDES_H
#include <type_traits>

View File

@@ -1,13 +1,16 @@
/**
/********************************************************************************
* Copyright (c) 2025-2026 ZF Friedrichshafen AG
*
* @file signal_support.h
* @brief This file provides base-implementations and helpers for signals and signal handling.
* @version 0.1
* @date 2022.11.14
* @author Thomas.pfleiderer@zf.com
* @copyright Copyright ZF Friedrichshaven AG (c) 2022
* 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 SIGNAL_SUPPORT_H
#define SIGNAL_SUPPORT_H
@@ -409,7 +412,7 @@ namespace sdv
template <typename TType>
void Write(TType tVal, const CTransaction& rTransaction = CTransaction())
{
if (m_pSignalWrite) m_pSignalWrite->Write(any_t(tVal), rTransaction.GetTransaction());
if (m_pSignalWrite) m_pSignalWrite->Write(tVal, rTransaction.GetTransaction());
}
/**
@@ -747,7 +750,7 @@ namespace sdv
CSignal signal;
if (pRegister)
signal = CSignal(*this, rssName,
pRegister->RegisterTxSignal(rssName, any_t(tDefVal)),
pRegister->RegisterTxSignal(rssName, tDefVal),
true);
return signal;
}

View File

@@ -1,3 +1,16 @@
/********************************************************************************
* 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 SDV_STRING_H
#define SDV_STRING_H

View File

@@ -1,9 +1,22 @@
/********************************************************************************
* 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 SDV_STRING_INL
#define SDV_STRING_INL
#ifndef SDV_STRING_H
#error Do not include "string.inl" directly. Include "string.h" instead!
#endif //!defined SDV_STRING_H
#include "string.h"
#endif //! defined SDV_STRING_H
#include <string>
#include <algorithm>
@@ -2926,7 +2939,7 @@ namespace sdv
template <typename TCharType, bool bUnicode, size_t nFixedSize>
inline std::filesystem::path MakePath(const string_base<TCharType, bUnicode, nFixedSize>& rssPath)
{
std::filesystem::path path(MakeWString(rssPath).c_str());
std::filesystem::path path(static_cast<std::wstring>(MakeWString(rssPath)));
return path;
}

View File

@@ -1,3 +1,16 @@
/********************************************************************************
* 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 VAPI_TASK_TIMER_H
#define VAPI_TASK_TIMER_H
@@ -25,20 +38,21 @@ namespace sdv
* @brief Constructor
* @param[in] uiPeriod The period to create a timer for.
* @param[in] fnCallback Callback function to be called on task execution.
* @param[in] bUseSimTimer Use the simulated task timer instead of the actual task timer.
*/
CTaskTimer(uint32_t uiPeriod, std::function<void()> fnCallback) :
CTaskTimer(uint32_t uiPeriod, std::function<void()> fnCallback, bool bUseSimTimer = false) :
m_ptrCallback(std::make_unique<STimerCallback>(fnCallback))
{
if (!m_ptrCallback) return;
if (!uiPeriod) return;
// Get the task timer service.
sdv::core::ITaskTimer* pTaskTimer = sdv::core::GetObject<sdv::core::ITaskTimer>("TaskTimerService");
if (!pTaskTimer)
{
sdv::core::ITaskTimer* pTaskTimer = nullptr;
if (bUseSimTimer)
pTaskTimer = sdv::core::GetObject<sdv::core::ITaskTimer>("SimulationTaskTimerService");
if (!pTaskTimer) return;
}
else
pTaskTimer = sdv::core::GetObject<sdv::core::ITaskTimer>("TaskTimerService");
if (!pTaskTimer) return;
// Create the timer
m_pTimer = pTaskTimer->CreateTimer(uiPeriod, m_ptrCallback.get());
@@ -49,18 +63,20 @@ namespace sdv
* @param[in] uiPeriod The period to create a timer for.
* @param[in] pTask Pointer to the interface of the task object to be called. The object must expose
* sdv::core::ITastExecute.
*/
CTaskTimer(uint32_t uiPeriod, sdv::IInterfaceAccess* pTask)
* @param[in] bUseSimTimer Use the simulated task timer instead of the actual task timer.
*/
CTaskTimer(uint32_t uiPeriod, sdv::IInterfaceAccess* pTask, bool bUseSimTimer = false)
{
if (!uiPeriod) return;
// Get the task timer service.
sdv::core::ITaskTimer* pTaskTimer = sdv::core::GetObject<sdv::core::ITaskTimer>("TaskTimerService");
if (!pTaskTimer)
{
sdv::core::ITaskTimer* pTaskTimer = nullptr;
if (bUseSimTimer)
pTaskTimer = sdv::core::GetObject<sdv::core::ITaskTimer>("SimulationTaskTimerService");
if (!pTaskTimer) return;
}
else
pTaskTimer = sdv::core::GetObject<sdv::core::ITaskTimer>("TaskTimerService");
if (!pTaskTimer)
return;
// Create the timer
m_pTimer = pTaskTimer->CreateTimer(uiPeriod, pTask);

View File

@@ -1,3 +1,16 @@
/********************************************************************************
* 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 SDV_CONFIG_H
#define SDV_CONFIG_H
@@ -43,11 +56,17 @@ namespace sdv::toml
*/
virtual operator bool() const;
/**
* @brief Get the underlying interface.
* @return The interface pointer.
*/
TInterfaceAccessPtr GetInterface();
/**
* @brief Return the node name.
* @return String containing the node name.
*/
sdv::u8string GetName();
sdv::u8string GetName() const;
/**
* @brief Retrurn the node qualified path including the parent path.
@@ -55,19 +74,58 @@ namespace sdv::toml
* to the node can be used to directly access the node.
* @return String containing the qualified path to the node.
*/
sdv::u8string GetQualifiedPath();
sdv::u8string GetQualifiedPath() const;
/**
* @brief Get the node type.
* @return The node type.
*/
ENodeType GetType();
ENodeType GetType() const;
/**
* @brief Return any associated comment text for this node.
* @return The node comment or an empty string when there is not comment for this node.
*/
std::string GetComment() const;
/**
* @brief Set comment for this node. Comments are placed before the node if this node is a table or an array and placed
* behind the node if this node is a value node.
* @param rssComment Reference to the comment string.
*/
void SetComment(const std::string& rssComment);
/**
* @brief Get the node value if the node contains a value.
* @return The node value.
* @return The node value or empty when the node doesn't have a value.
*/
sdv::any_t GetValue();
sdv::any_t GetValue() const;
/**
* @brief Automatically cast the value to a string.
* @return String to return or an empty string.
*/
std::string GetValueAsString() const;
/**
* @brief Automatically cast the value to a path (only for string values).
* @return Path to return or an empty path.
*/
std::filesystem::path GetValueAsPath() const;
/**
* @brief Set the node value if the node is a value node.
* @remarks The value type depends on the node type and will be converted if necessary.
* @param[in] ranyValue Reference to the value to set.
* @return Returns 'true' on successful setting; 'false' otherwise.
*/
bool SetValue(const sdv::any_t& ranyValue);
/**
* @brief Delete the node including all child nodes.
* @return Returns 'true' on successful setting; 'false' otherwise.
*/
bool Delete();
/**
* @brief Clear the node class.
@@ -76,7 +134,7 @@ namespace sdv::toml
/**
* @brief Get the TOML string from this node including all children.
* @return The TOMl string.
* @return The TOML string.
*/
sdv::u8string GetTOML() const;
@@ -170,6 +228,140 @@ namespace sdv::toml
*/
CNode GetDirect(const sdv::u8string& rssNode) const;
/**
* @brief Insert a value node before the provided position.
* @remarks The actual position depends on the type of node and the order the nodes are stored. Inline nodes come before
* standard nodes.
* @param[in] nIndex The index before which to insert the node. Can be larger than the count value as well as
* sdv::toml::npos when adding the node at the end.
* @param[in] rssName Reference to the name of the new value node. If this collection is an array, the name is ignored.
* Otherwise the name must be unique within this collection.
* @param[in] ranyValue The value to assign to the node. The value also determines the type of value node.
* @return Returns the node when successfully inserted or an empty node when not.
*/
CNode InsertValue(size_t nIndex, const std::string& rssName, const sdv::any_t& ranyValue);
/**
* @brief Add a value node to the collection.
* @remarks The actual position depends on the type of node and the order the nodes are stored. Inline nodes come before
* standard nodes.
* @param[in] rssName Reference to the name of the new array collection node. If this collection is an array, the name is
* ignored. Otherwise the name must be unique within this collection.
* @param[in] ranyValue The value to assign to the node. The value also determines the type of value node.
* @return Returns the node when successfully added or an empty node when not.
*/
CNode AddValue(const std::string& rssName, const sdv::any_t& ranyValue);
/**
* @brief Insert an array collection before the provided position.
* @remarks The actual position depends on the type of node and the order the nodes are stored. Inline nodes come before
* standard nodes.
* @param[in] nIndex The index before which to insert the node. Can be larger than the count value as well as
* sdv::toml::npos when adding the node at the end.
* @param[in] rssName Reference to the name of the new value node. If this collection is an array, the name is ignored.
* Otherwise the name must be unique within this collection.
* @return Returns the collection node when successfully inserted or an empty node when not.
*/
CNodeCollection InsertArray(size_t nIndex, const std::string& rssName);
/**
* @brief Add an array collection to this collection.
* @remarks The actual position depends on the type of node and the order the nodes are stored. Inline nodes come before
* standard nodes.
* @param[in] rssName Reference to the name of the new array collection node. If this collection is an array, the name is
* ignored. Otherwise the name must be unique within this collection.
* @return Returns the collection node when successfully added or an empty node when not.
*/
CNodeCollection AddArray(const std::string& rssName);
/**
* @brief Insert a table collection before the provided position.
* @remarks The actual position depends on the type of node and the order the nodes are stored. Inline nodes come before
* standard nodes.
* @param[in] nIndex The index before which to insert the node. Can be larger than the count value as well as
* sdv::toml::npos when adding the node at the end.
* @param[in] rssName Reference to the name of the new table collection node. If this collection is an array, the name is
* ignored. Otherwise the name must be unique within this collection.
* @param[in] bFavorInline When set, the node will be added as inline collection node. When not, the node will be inserted
* as inline collection if the this collection is also inline, as standard when not.
* @return Returns the collection node when successfully inserted or an empty node when not.
*/
CNodeCollection InsertTable(size_t nIndex, const std::string& rssName, bool bFavorInline = false);
/**
* @brief Add a table collection to this collection.
* @remarks The actual position depends on the type of node and the order the nodes are stored. Inline nodes come before
* standard nodes.
* @param[in] rssName Reference to the name of the new table collection node. If this collection is an array, the name is
* ignored. Otherwise the name must be unique within this collection.
* @param[in] bFavorInline When set, the node will be added as inline collection node. When not, the node will be inserted
* as inline collection if the this collection is also inline, as standard when not.
* @return Returns the collection node when successfully added or an empty node when not.
*/
CNodeCollection AddTable(const std::string& rssName, bool bFavorInline = false);
/**
* @brief Insert a table array collection before the provided position.
* @remarks The actual position depends on the type of node and the order the nodes are stored. Inline nodes come before
* standard nodes.
* @remarks A table array is an array with table inside. Inserting a table array node can also be done by creating an array,
* if not existing already, and adding a table to the array.
* @param[in] nIndex The index before which to insert the node. Can be larger than the count value as well as
* sdv::toml::npos when adding the node at the end.
* @param[in] rssName Reference to the name of the new table array node. If this collection is an array, the name is
* ignored. Otherwise the name must be unique within this collection.
* @param[in] bFavorInline When set, the node will be added as inline collection node. When not, the node will be inserted
* as inline collection if the this collection is also inline, as standard when not.
* @return Returns the collection node when successfully inserted or an empty node when not. The collection node represents
* a table collection.
*/
CNodeCollection InsertTableArray(size_t nIndex, const std::string& rssName, bool bFavorInline = false);
/**
* @brief Add a table array collection to this collection.
* @remarks The actual position depends on the type of node and the order the nodes are stored. Inline nodes come before
* standard nodes.
* @remarks A table array is an array with table inside. Inserting a table array node can also be done by creating an array,
* if not existing already, and adding a table to the array.
* @param[in] rssName Reference to the name of the new table array node. If this collection is an array, the name is
* ignored. Otherwise the name must be unique within this collection.
* @param[in] bFavorInline When set, the node will be added as inline collection node. When not, the node will be inserted
* as inline collection if the this collection is also inline, as standard when not.
* @return Returns the collection node when successfully inserted or an empty node when not. The collection node represents
* a table collection.
*/
CNodeCollection AddTableArray(const std::string& rssName, bool bFavorInline = false);
/**
* @brief Insert a TOML string to the collection. All nodes specified in the TOML will be added in the collection except
* when the nodes already exist. Comment and whitespace are preserved when possible.
* @remarks The actual position depends on the type of node and the order the nodes are stored. Inline nodes come before
* standard nodes.
* @param[in] nIndex The index before which to insert the node. Can be larger than the count value as well as
* sdv::toml::npos when adding the node at the end.
* @param[in] rssTOML Reference to the TOML string containing the nodes. The TOML string can be empty, which is not an
* error. If required the TOML nodes are converted to inline nodes.
* @param[in] bAllowPartial When set, duplicate nodes (already present in this collection) will be ignored and do not
* cause an error. When not set, duplicate nodes will cause the function to return without inserting any node.
* @return Returns 1 if the complete TOMl could be inserted, 0 if no TOML could be inserted or -1 when the TOML could be
* partially inserted.
*/
int InsertTOML(size_t nIndex, const std::string& rssTOML, bool bAllowPartial = false);
/**
* @brief Add a TOML string to this collection. All nodes specified in the TOML will be added in the collection except
* when the nodes already exist. Comment and whitespace are preserved when possible.
* @remarks The actual position depends on the type of node and the order the nodes are stored. Inline nodes come before
* standard nodes.
* @param[in] rssTOML Reference to the TOML string containing the nodes. The TOML string can be empty, which is not an
* error. If required the TOML nodes are converted to inline nodes.
* @param[in] bAllowPartial When set, duplicate nodes (already present in this collection) will be ignored and do not
* cause an error. When not set, duplicate nodes will cause the function to return without inserting any node.
* @return Returns 1 if the complete TOMl could be inserted, 0 if no TOML could be inserted or -1 when the TOML could be
* partially inserted.
*/
int AddTOML(const std::string& rssTOML, bool bAllowPartial = false);
private:
INodeCollection* m_pCollection = nullptr; ///< Pointer to the node collection interface.
};
@@ -225,8 +417,7 @@ namespace sdv::toml
inline CNode::CNode(const TInterfaceAccessPtr& rptrNode)
{
m_pNodeInfo = rptrNode.GetInterface<INodeInfo>();
if (!m_pNodeInfo)
return;
if (!m_pNodeInfo) return;
m_ptrNode = rptrNode;
}
@@ -250,26 +441,95 @@ namespace sdv::toml
return m_pNodeInfo ? true : false;
}
inline sdv::u8string CNode::GetName()
inline TInterfaceAccessPtr CNode::GetInterface()
{
return m_ptrNode;
}
inline sdv::u8string CNode::GetName() const
{
return m_pNodeInfo ? m_pNodeInfo->GetName() : sdv::u8string();
}
inline sdv::u8string CNode::GetQualifiedPath()
inline sdv::u8string CNode::GetQualifiedPath() const
{
return m_pNodeInfo ? m_pNodeInfo->GetPath(true) : sdv::u8string();
}
inline ENodeType CNode::GetType()
inline ENodeType CNode::GetType() const
{
return m_pNodeInfo ? m_pNodeInfo->GetType() : ENodeType::node_invalid;
}
inline sdv::any_t CNode::GetValue()
inline std::string CNode::GetComment() const
{
if (!m_pNodeInfo) return {};
std::string ssComment;
switch (GetType())
{
case ENodeType::node_boolean:
case ENodeType::node_integer:
case ENodeType::node_floating_point:
case ENodeType::node_string:
ssComment = m_pNodeInfo->GetComment(INodeInfo::ECommentType::comment_behind);
if (ssComment.empty())
ssComment = m_pNodeInfo->GetComment(INodeInfo::ECommentType::comment_before);
break;
default:
ssComment = m_pNodeInfo->GetComment(INodeInfo::ECommentType::comment_before);
if (ssComment.empty())
ssComment = m_pNodeInfo->GetComment(INodeInfo::ECommentType::comment_behind);
break;
}
return ssComment;
}
inline void CNode::SetComment(const std::string& rssComment)
{
if (!m_pNodeInfo) return;
switch (GetType())
{
case ENodeType::node_boolean:
case ENodeType::node_integer:
case ENodeType::node_floating_point:
case ENodeType::node_string:
m_pNodeInfo->SetComment(INodeInfo::ECommentType::comment_behind, rssComment);
break;
default:
m_pNodeInfo->SetComment(INodeInfo::ECommentType::comment_before, rssComment);
break;
}
}
inline sdv::any_t CNode::GetValue() const
{
return m_pNodeInfo ? m_pNodeInfo->GetValue() : sdv::any_t();
}
inline std::string CNode::GetValueAsString() const
{
return m_pNodeInfo ? m_pNodeInfo->GetValue().get<std::string>() : std::string();
}
inline std::filesystem::path CNode::GetValueAsPath() const
{
return m_pNodeInfo ? m_pNodeInfo->GetValue().get<std::filesystem::path>() : std::filesystem::path();
}
inline bool CNode::SetValue(const sdv::any_t& ranyValue)
{
INodeUpdate* pNodeUpdate = m_ptrNode.GetInterface<INodeUpdate>();
if (!pNodeUpdate) return false;
return pNodeUpdate->ChangeValue(ranyValue);
}
inline bool CNode::Delete()
{
INodeUpdate* pNodeUpdate = m_ptrNode.GetInterface<INodeUpdate>();
if (!pNodeUpdate) return false;
return pNodeUpdate->DeleteNode();
}
inline void CNode::Clear()
{
m_ptrNode = nullptr;
@@ -345,6 +605,105 @@ namespace sdv::toml
return m_pCollection ? CNode(m_pCollection->GetNodeDirect(rssNode)) : CNode();
}
inline CNode CNodeCollection::InsertValue(size_t nIndex, const std::string& rssName, const sdv::any_t& ranyValue)
{
INodeCollectionInsert* pInsert = m_ptrNode.GetInterface<INodeCollectionInsert>();
if (!pInsert) return {};
return CNode(pInsert->InsertValue(static_cast<uint32_t>(nIndex), rssName, ranyValue));
}
inline CNode CNodeCollection::AddValue(const std::string& rssName, const sdv::any_t& ranyValue)
{
INodeCollectionInsert* pInsert = m_ptrNode.GetInterface<INodeCollectionInsert>();
if (!pInsert) return {};
return CNode(pInsert->InsertValue(npos, rssName, ranyValue));
}
inline CNodeCollection CNodeCollection::InsertArray(size_t nIndex, const std::string& rssName)
{
INodeCollectionInsert* pInsert = m_ptrNode.GetInterface<INodeCollectionInsert>();
if (!pInsert) return {};
return CNodeCollection(pInsert->InsertArray(static_cast<uint32_t>(nIndex), rssName));
}
inline CNodeCollection CNodeCollection::AddArray(const std::string& rssName)
{
INodeCollectionInsert* pInsert = m_ptrNode.GetInterface<INodeCollectionInsert>();
if (!pInsert) return {};
return CNodeCollection(pInsert->InsertArray(npos, rssName));
}
inline CNodeCollection CNodeCollection::InsertTable(size_t nIndex, const std::string& rssName, bool bFavorInline /*= false*/)
{
INodeCollectionInsert* pInsert = m_ptrNode.GetInterface<INodeCollectionInsert>();
if (!pInsert) return {};
return CNodeCollection(pInsert->InsertTable(static_cast<uint32_t>(nIndex), rssName,
bFavorInline ? INodeCollectionInsert::EInsertPreference::prefer_inline :
INodeCollectionInsert::EInsertPreference::prefer_standard));
}
inline CNodeCollection CNodeCollection::AddTable(const std::string& rssName, bool bFavorInline /*= false*/)
{
INodeCollectionInsert* pInsert = m_ptrNode.GetInterface<INodeCollectionInsert>();
if (!pInsert) return {};
return CNodeCollection(pInsert->InsertTable(npos, rssName,
bFavorInline ? INodeCollectionInsert::EInsertPreference::prefer_inline :
INodeCollectionInsert::EInsertPreference::prefer_standard));
}
inline CNodeCollection CNodeCollection::InsertTableArray(size_t nIndex, const std::string& rssName,
bool bFavorInline /*= false*/)
{
INodeCollectionInsert* pInsert = m_ptrNode.GetInterface<INodeCollectionInsert>();
if (!pInsert) return {};
return CNodeCollection(pInsert->InsertTableArray(static_cast<uint32_t>(nIndex), rssName,
bFavorInline ? INodeCollectionInsert::EInsertPreference::prefer_inline :
INodeCollectionInsert::EInsertPreference::prefer_standard));
}
inline CNodeCollection CNodeCollection::AddTableArray(const std::string& rssName, bool bFavorInline /*= false*/)
{
INodeCollectionInsert* pInsert = m_ptrNode.GetInterface<INodeCollectionInsert>();
if (!pInsert) return {};
return CNodeCollection(pInsert->InsertTableArray(npos, rssName,
bFavorInline ? INodeCollectionInsert::EInsertPreference::prefer_inline :
INodeCollectionInsert::EInsertPreference::prefer_standard));
}
inline int CNodeCollection::InsertTOML(size_t nIndex, const std::string& rssTOML, bool bAllowPartial /*= false*/)
{
INodeCollectionInsert* pInsert = m_ptrNode.GetInterface<INodeCollectionInsert>();
if (!pInsert) return 0;
INodeCollectionInsert::EInsertResult eRet = pInsert->InsertTOML(static_cast<uint32_t>(nIndex), rssTOML, !bAllowPartial);
switch (eRet)
{
case INodeCollectionInsert::EInsertResult::insert_success:
return 1;
case INodeCollectionInsert::EInsertResult::insert_partly_success:
return -1;
case INodeCollectionInsert::EInsertResult::insert_fail:
default:
return 0;
}
}
inline int CNodeCollection::AddTOML(const std::string& rssTOML, bool bAllowPartial /*= false*/)
{
INodeCollectionInsert* pInsert = m_ptrNode.GetInterface<INodeCollectionInsert>();
if (!pInsert) return 0;
INodeCollectionInsert::EInsertResult eRet = pInsert->InsertTOML(npos, rssTOML, !bAllowPartial);
switch (eRet)
{
case INodeCollectionInsert::EInsertResult::insert_success:
return 1;
case INodeCollectionInsert::EInsertResult::insert_partly_success:
return -1;
case INodeCollectionInsert::EInsertResult::insert_fail:
default:
return 0;
}
}
inline CTOMLParser::CTOMLParser(const std::string& rssConfig)
{
Process(rssConfig);