mirror of
https://github.com/eclipse-openvehicle-api/openvehicle-api.git
synced 2026-08-30 12:15:12 +00:00
connection between 2 systems and bug fixes (#14)
This commit is contained in:
@@ -103,12 +103,6 @@ module sdv
|
||||
* @return The instance ID.
|
||||
*/
|
||||
uint32 GetInstanceID() const;
|
||||
|
||||
/**
|
||||
* @brief Return the number of retries to establish a connection.
|
||||
* @return Number of retries.
|
||||
*/
|
||||
uint32 GetRetries() const;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -181,5 +175,96 @@ module sdv
|
||||
void RequestShutdown() raises(XAccessDenied, XInvalidState);
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Load and save the application settings.
|
||||
* @remarks The interface is only available in maintenance mode.
|
||||
*/
|
||||
interface IAppSettingsPersist
|
||||
{
|
||||
/**
|
||||
* @brief Load the application settings.
|
||||
* @remarks When there is no settings file, this is not an error. Default settings will be assumed.
|
||||
* @return Returns whether the loading was successful.
|
||||
*/
|
||||
boolean LoadSettings();
|
||||
|
||||
/**
|
||||
* @brief Save the application settings file (or create when not existing yet).
|
||||
* @return Returns whether the saving was successful.
|
||||
*/
|
||||
boolean SaveSettings();
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Application connections
|
||||
* @remarks The interface is only available in maintenance mode.
|
||||
*/
|
||||
interface IAppConnections
|
||||
{
|
||||
/**
|
||||
* @brief Get a sequence with listener names.
|
||||
* @return Sequence with listener name strings.
|
||||
*/
|
||||
sequence<u8string> GetListeners() const;
|
||||
|
||||
/**
|
||||
* @brief Get the listener configuration.
|
||||
* @param[in] ssName Name of the listener.
|
||||
* @return String containing the listener configuration.
|
||||
*/
|
||||
u8string GetListenerConfig(in u8string ssName) const;
|
||||
|
||||
/**
|
||||
* @brief Add or update a listener configuration.
|
||||
* @param[in] ssName Name of the listener configuration.
|
||||
* @param[in] ssConfig The configuration string for the listener.
|
||||
* @return Returns whether the listener could be added.
|
||||
*/
|
||||
boolean AddListenerConfig(in u8string ssName, in u8string ssConfig);
|
||||
|
||||
/**
|
||||
* @brief Remove a listener configuration with the provided name.
|
||||
* @param[in] ssName Name of the listener configuration.
|
||||
* @return Returns whether the removal was successful.
|
||||
*/
|
||||
boolean RemoveListenerConfig(in u8string ssName);
|
||||
|
||||
/**
|
||||
* @brief Get a sequence with connection names.
|
||||
* @return Sequence with name strings.
|
||||
*/
|
||||
sequence<u8string> GetConnections() const;
|
||||
|
||||
/**
|
||||
* @brief Get the connection configuration.
|
||||
* @param[in] ssName Name of the connection.
|
||||
* @return String containing the connection configuration.
|
||||
*/
|
||||
u8string GetConnectionConfig(in u8string ssName) const;
|
||||
|
||||
/**
|
||||
* @brief Add or update a connection configuration.
|
||||
* @param[in] ssName Name of the connection configuration.
|
||||
* @param[in] ssConfig The configuration string for the connection.
|
||||
* @param[in] ssInsertBefore Reference to the string to connection to insert the the new connection before, or empty
|
||||
* when the the new connection should be placed at the end.
|
||||
* @return Returns whether the connection could be added (fails when the connection already exists).
|
||||
*/
|
||||
boolean AddConnectionConfig(in u8string ssName, in u8string ssConfig, in u8string ssInsertBefore);
|
||||
|
||||
/**
|
||||
* @brief Remove a connection configuration with the provided name.
|
||||
* @param[in] ssName Name of the connection configuration.
|
||||
* @return Returns whether the removal was successful.
|
||||
*/
|
||||
boolean RemoveConnectionConfig(in u8string ssName);
|
||||
|
||||
/**
|
||||
* @brief Return the number of retries to establish a connection.
|
||||
* @return Number of retries.
|
||||
*/
|
||||
uint32 GetConnectRetries() const;
|
||||
};
|
||||
|
||||
}; // module app
|
||||
}; // module sdv
|
||||
|
||||
@@ -53,31 +53,56 @@ module sdv
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Connect to a remote system. Provided by the ConnectClient utility.
|
||||
* @brief Connect to a remote system. Provided by the Connection service.
|
||||
* @details This interface is exposed by the connection client service. The configuration is provided during instantiation
|
||||
* of the object and is of the form:
|
||||
* @code
|
||||
* # Provider to use for the connection
|
||||
* [Provider]
|
||||
* Name = ""
|
||||
*
|
||||
* # Additional channel information for the client
|
||||
* [IpcChannel]
|
||||
* xyz = ""
|
||||
* @endcode
|
||||
*
|
||||
* For example for shared memory:
|
||||
* @code
|
||||
* [Provider]
|
||||
* Name = "DefaultSharedMemory"
|
||||
* [IpcChannel]
|
||||
* Name = "LISTENER_1234"
|
||||
* @endcode
|
||||
*/
|
||||
interface IClientConnect
|
||||
{
|
||||
/**
|
||||
* @brief Connect to a remote system using the connection string to contact the system.
|
||||
* @remarks After a successful connection, the ConnectClient utility is not needed any more.
|
||||
* @param[in] ssConnectString Optional connection string to use for connection. If not provided, the connection will
|
||||
* automatically get the connection ID from the app-control service (default). The connection string for a local
|
||||
* connection can be of the form:
|
||||
* @code
|
||||
* [Client]
|
||||
* Type = "local"
|
||||
* Instance = 1234 # Optional: only use when connecting to a system with a different instance ID.
|
||||
* @endcode
|
||||
* And the following can be used for a remote connection:
|
||||
* @code
|
||||
* [Client]
|
||||
* Type = "remote"
|
||||
* Interface = "127.0.0.1"
|
||||
* Port = 2000
|
||||
* @endcode
|
||||
* @return Returns an interface to the repository of the remote system or a NULL pointer if not found.
|
||||
* @brief Connect to a remote system.
|
||||
* @return Returns whether connect was successful.
|
||||
*/
|
||||
IInterfaceAccess Connect(in u8string ssConnectString) raises(XAccessDenied, XNotFound, XInvalidState, XTimeout);
|
||||
boolean Connect() raises(XAccessDenied, XNotFound, XInvalidState, XTimeout);
|
||||
|
||||
/**
|
||||
* @brief Disconnect from a connected system.
|
||||
* @return Returns whether disconnect was successful.
|
||||
*/
|
||||
boolean Disconnect() raises(XAccessDenied, XNotFound, XInvalidState, XTimeout);
|
||||
|
||||
/**
|
||||
* @brief State of the current connection.
|
||||
* @return Returns whether an active connection exists.
|
||||
*/
|
||||
boolean IsConnected() const;
|
||||
|
||||
/**
|
||||
* @brief Get the remote repository that is available after connection.
|
||||
* @remarks For main, isolated and external applications, the remote repository will be automatically linked to the
|
||||
* local repository. Hence a requests for the repository is not needed. For all other applications, access must be
|
||||
* explicitly acquired through this interface.
|
||||
* @return Interface to the remote repository if a successful connection is established. The interface is valid until
|
||||
* disconnect is called or the client connection service is terminated.
|
||||
*/
|
||||
IInterfaceAccess GetRemoteRepository();
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -389,6 +389,17 @@ module sdv
|
||||
u8string ssInstallName; ///< Name of the installation.
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief The package exceeds the maximum size.
|
||||
*/
|
||||
exception XPackageSizeExceeded : XSysExcept
|
||||
{
|
||||
/** Description */
|
||||
const char _description[] = "Maximum package size exceeded.";
|
||||
|
||||
u8string ssFileName; ///< Name of the file which causes the exception.
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief The installation doesn't contain a module.
|
||||
*/
|
||||
|
||||
@@ -57,11 +57,28 @@ module sdv
|
||||
template <typename TInterface>
|
||||
TInterface* GetInterface()
|
||||
{
|
||||
return GetInterface(sdv::GetInterfaceId<TInterface>()).template get<TInterface>();
|
||||
try
|
||||
{
|
||||
return GetInterface(sdv::GetInterfaceId<TInterface>()).template get<TInterface>();
|
||||
} catch (const XSysExcept&)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
#verbatim_end
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Core features.
|
||||
*/
|
||||
module core
|
||||
{
|
||||
/**
|
||||
* @brief Object ID.
|
||||
*/
|
||||
typedef uint64 TObjectID;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Object type enumeration.
|
||||
*/
|
||||
@@ -163,13 +180,24 @@ module sdv
|
||||
|
||||
/**
|
||||
* @brief Component operation mode.
|
||||
*/
|
||||
*/
|
||||
enum EOperationMode : uint32
|
||||
{
|
||||
configuring = 20, ///< The component should switch to configuration mode.
|
||||
running = 30, ///< The component should switch to running mode.
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Object information supplied to the object initialization function.
|
||||
*/
|
||||
struct SObjectInfo
|
||||
{
|
||||
core::TObjectID tObjectID; ///< Object ID (local for the running process)
|
||||
SClassInfo sClassInfo; ///< Object class information
|
||||
u8string ssName; ///< Object name
|
||||
u8string ssConfig; ///< Object configuration TOML
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Optional interface allowing for additional control of more complex SDVObjects.
|
||||
* To be implemented if the object in question calls other SDVobjects via running threads or callbacks,
|
||||
@@ -179,9 +207,9 @@ module sdv
|
||||
{
|
||||
/**
|
||||
* @brief Initialize the object.
|
||||
* @param[in] ssObjectConfig Optional configuration string.
|
||||
* @param[in] sObjectInfo The registration information of this object.
|
||||
*/
|
||||
void Initialize(in u8string ssObjectConfig);
|
||||
void Initialize(in SObjectInfo sObjectInfo);
|
||||
|
||||
/**
|
||||
* @brief Get the current state of the object.
|
||||
@@ -247,50 +275,6 @@ module sdv
|
||||
*/
|
||||
uint32 GetCount() const;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Attribute flags.
|
||||
*/
|
||||
enum EAttributeFlags : uint32
|
||||
{
|
||||
read_only = 0x100, ///< When set, the attribute is readonly.
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Attribute interface
|
||||
*/
|
||||
interface IAttributes
|
||||
{
|
||||
/**
|
||||
* @brief Get a sequence with the available attribute names.
|
||||
* @return The sequence of attribute names.
|
||||
*/
|
||||
sequence<u8string> GetNames() const;
|
||||
|
||||
/**
|
||||
* @brief Get the attribute value.
|
||||
* @param[in] ssAttribute Name of the attribute.
|
||||
* @return The attribute value or an empty any-value if the attribute wasn't found or didn't have a value.
|
||||
*/
|
||||
any Get(in u8string ssAttribute) const;
|
||||
|
||||
/**
|
||||
* @brief Set the attribute value.
|
||||
* @param[in] ssAttribute Name of the attribute.
|
||||
* @param[in] anyAttribute Attribute value to set.
|
||||
* @return Returns 'true' when setting the attribute was successful or 'false' when the attribute was not found or the
|
||||
* attribute is read-only or another error occurred.
|
||||
*/
|
||||
boolean Set(in u8string ssAttribute, in any anyAttribute);
|
||||
|
||||
/**
|
||||
* @brief Get the attribute flags belonging to a certain attribute.
|
||||
* @param[in] ssAttribute Name of the attribute.
|
||||
* @return Returns the attribute flags (zero or more EAttributeFlags flags) or 0 when the attribute could not be found.
|
||||
*/
|
||||
uint32 GetFlags(in u8string ssAttribute) const;
|
||||
};
|
||||
|
||||
}; // module sdv
|
||||
|
||||
#verbatim_begin
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
|
||||
#include "core.idl"
|
||||
#include "process.idl"
|
||||
#include "permission.idl"
|
||||
|
||||
/**
|
||||
* @brief Software Defined Vehicle framework.
|
||||
@@ -149,6 +150,7 @@ module sdv
|
||||
TMarshallID tProxyID; ///< Proxy id to identify the proxy this packet is sending from or destined to.
|
||||
TMarshallID tStubID; ///< Stub id to identify the stub this packet is destined to or receiving from.
|
||||
uint64 uiCallIndex; ///< Call index to uniquely identify the call.
|
||||
core::TPermissionID tPermissionID; ///< Permission ID used to elevate permission, or 0 for standard permission.
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -35,12 +35,15 @@ module sdv
|
||||
///< identification must be similar to the following example:
|
||||
///< @code
|
||||
///< [Provider]
|
||||
///< Name = "DefaultSharedMemoryChannelControl"
|
||||
///< Name = "DefaultSharedMemory"
|
||||
///< @endcode
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Interface for creating an IPC connection, which other participants can connect to via IChannelAccess
|
||||
* @brief Interface for creating an IPC connection, which other participants can connect to via IChannelAccess.
|
||||
* @attention The channel control object should allow the creation of channels with a fixed configuration (e.g. a provided
|
||||
* name or a port), which is necessary for the creation of a listener. It also should allow dynamic channel creation (e.g.
|
||||
* automatic name or port-number) to create additional connections between components.
|
||||
*/
|
||||
interface ICreateEndpoint
|
||||
{
|
||||
|
||||
96
export/interfaces/permission.idl
Normal file
96
export/interfaces/permission.idl
Normal file
@@ -0,0 +1,96 @@
|
||||
/********************************************************************************
|
||||
* 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
|
||||
{
|
||||
/**
|
||||
* @brief Core features.
|
||||
*/
|
||||
module core
|
||||
{
|
||||
/// ID corresponding to a thread specific permission request.
|
||||
typedef uint64 TPermissionID;
|
||||
|
||||
/// ID identifying a permission transfer.
|
||||
typedef uint64 TPermissionTransferID;
|
||||
|
||||
/**
|
||||
* @brief Access type restriction. The lower the access, the more restricted.
|
||||
*/
|
||||
enum EAccessPermission : int32
|
||||
{
|
||||
not_set = -1001, ///< Permissions are not set; will be treated as restricted access.
|
||||
restricted_access = -1000, ///< Restricted access (default when no other set).
|
||||
remote_access = -200, ///< Access for remote execution. Access allowed to basic and complex services.
|
||||
local_access = -100, ///< Access for isolated execution. Access allowed to system, basic and complex services.
|
||||
full_access = 0, ///< Full access is allowed to complete system.
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Permission control interface. This interface is used for restricting permission on a thread and transferring
|
||||
* permissions from one thread to another.
|
||||
*/
|
||||
interface IPermissionControl
|
||||
{
|
||||
/**
|
||||
* @brief Restrict the access permission for the current thread.
|
||||
* @remarks The access restriction will be assigned to the current thread and combined with previous and future
|
||||
* permissions. The lowest assigned permission will determine the actual access permission for the current thread.
|
||||
* @remarks The access restriction will stay in effect until it is released by the function ReleaseAccessPermission.
|
||||
* @remarks A newly created thread has fully restricted access. This cannot be changed using this function. Use an
|
||||
* access restriction transfer from one thread to this thread to set a higher level of access permission.
|
||||
* @param[in] ePermission The permission to restrict to.
|
||||
* @return The permission ID for this restriction or 0 when the access permission could not be set. Use the
|
||||
* ReleaseAccessPermission to release the restriction again.
|
||||
*/
|
||||
TPermissionID RestrictAccessPermission(in EAccessPermission ePermission);
|
||||
|
||||
/**
|
||||
* @brief Release a previously set access restriction for the current thread.
|
||||
* @param[in] tPermissionID The ID of the access restriction previously set for the current thread.
|
||||
* @return Returns whether the restriction could be released successfully.
|
||||
*/
|
||||
boolean ReleaseAccessPermission(in TPermissionID tPermissionID);
|
||||
|
||||
/**
|
||||
* @brief Prepares a transfer of the access restriction from the current thread.
|
||||
* @return The ID of the transfer object containing the current access permissions or 0 when the transfer preparation
|
||||
* has failed.
|
||||
*/
|
||||
TPermissionTransferID TransferCurrentPermission();
|
||||
|
||||
/**
|
||||
* @brief Set the access permission using a transfer object from one thread to another.
|
||||
* @remarks An new thread has fully restricted access per default. Use this function to set the required access level.
|
||||
* If a thread has already initialized with the proper access level, this function will set identical or lower access
|
||||
* permissions for the current thread.
|
||||
* @param[in] tTransferID The IS of the prepared access permission transfer.
|
||||
* @return The permission ID for this restriction or 0 when the access permission could not be transferred. Use the
|
||||
* ReleaseAccessPermission to release the restriction again.
|
||||
*/
|
||||
TPermissionID SetAccessPermission(in TPermissionTransferID tTransferID);
|
||||
|
||||
/**
|
||||
* @brief Get the access permission level for the current thread. This will be the lowest restriction set for the
|
||||
* current thread.
|
||||
* @return The current access permission level.
|
||||
*/
|
||||
EAccessPermission GetCurrentPermission() const;
|
||||
};
|
||||
}; // module core
|
||||
}; // module sdv
|
||||
@@ -25,11 +25,6 @@ module sdv
|
||||
module core
|
||||
{
|
||||
|
||||
/**
|
||||
* @brief Object ID.
|
||||
*/
|
||||
typedef uint64 TObjectID;
|
||||
|
||||
/**
|
||||
* @brief Interface used to access objects from other modules via the repository service
|
||||
*/
|
||||
@@ -229,6 +224,32 @@ module sdv
|
||||
TObjectID RegisterObject(in IInterfaceAccess pObjectIfc, in u8string ssObjectName);
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief The object dependency can be used to state dependencies between two objects. This influence is used during
|
||||
* shutdown to determine the termination order.
|
||||
*/
|
||||
interface IObjectDependency
|
||||
{
|
||||
/**
|
||||
* @brief Add a dependency for an object.
|
||||
* @param ssObjectName Name of the object.
|
||||
* @param ssDependsOnObject Name of the object it depends on.
|
||||
*/
|
||||
void AddObjectDependency(in u8string ssObjectName, in u8string ssDependsOnObject);
|
||||
|
||||
/**
|
||||
* @brief Remove an object dependency.
|
||||
* @param ssObjectName Name of the object.
|
||||
* @param ssDependsOnObject Name of the object it depends on.
|
||||
*/
|
||||
void RemoveObjectDependency(in u8string ssObjectName, in u8string ssDependsOnObject);
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Link ID.
|
||||
*/
|
||||
typedef uint64 TLinkID;
|
||||
|
||||
/**
|
||||
* @brief Connect the core repository to the local repository to allow object access by the locally running components.
|
||||
* @remarks This interface is available only for isolated and external applications.
|
||||
@@ -238,13 +259,15 @@ module sdv
|
||||
/**
|
||||
* @brief Register the core repository.
|
||||
* @param[in] pCoreRepository Pointer to the proxy interface of the core repository.
|
||||
* @return Returns a link ID to be used in the Unlink function. Or 0 on failure.
|
||||
*/
|
||||
void LinkCoreRepository(in IInterfaceAccess pCoreRepository);
|
||||
TLinkID LinkCoreRepository(in IInterfaceAccess pCoreRepository);
|
||||
|
||||
/**
|
||||
* @brief Unlink a previously linked core repository.
|
||||
* @param[in] tLinkID Link ID of the repository link to remove.
|
||||
*/
|
||||
void UnlinkCoreRepository();
|
||||
void UnlinkCoreRepository(in TLinkID tLinkID);
|
||||
};
|
||||
|
||||
}; // module core
|
||||
|
||||
@@ -142,10 +142,10 @@ module sdv
|
||||
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.
|
||||
* @brief Format the node automatically, remove redundant whitespace.
|
||||
* @param[in] bRemoveComments When set, the comments are removed from the node.
|
||||
*/
|
||||
void AutomaticFormat();
|
||||
void AutomaticFormat(in boolean bRemoveComments);
|
||||
|
||||
/**
|
||||
* @brief Is the node inline?
|
||||
@@ -265,10 +265,21 @@ module sdv
|
||||
|
||||
/**
|
||||
* @brief Convert the node to a standard node.
|
||||
* @param[in] bIncludeChildren When set, applicable child nodes are made are converted to standard nodes as well (only
|
||||
* tables and table-arrays can be defined as standard).
|
||||
* @return Returns whether the conversion was successful. Returns 'true' when the node was already defined as standard
|
||||
* node.
|
||||
*/
|
||||
boolean MakeStandard();
|
||||
boolean MakeStandard(in boolean bIncludeChildren);
|
||||
};
|
||||
|
||||
/**
|
||||
* @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.
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -278,71 +289,67 @@ module sdv
|
||||
{
|
||||
/**
|
||||
* @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.
|
||||
* @remarks In TOML, inline nodes are located before standard nodes. Since values are presented as inline node, they
|
||||
* will be inserted before any standard node (table or table array if defined as standard node).
|
||||
* @param[in] ssInsertBefore Name of the node to insert the value before. In case of an array, can be an index between
|
||||
* square brackets. Can be empty, causing the node to be inserted at the end.
|
||||
* @param[in] ssName Name of the node to insert. This name can contain parent nodes, which are automatically created if
|
||||
* not existing. With arrays, since the value in TOML doesn't have a name, the name of the value must be an empty
|
||||
* string and any names provided are considered parent nodes. 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);
|
||||
IInterfaceAccess InsertValue(in u8string ssInsertBefore, 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.
|
||||
* @remarks In TOML, inline nodes are located before standard nodes. Since arrays are presented as inline node, they
|
||||
* will be inserted before any standard node (table or table array if defined as standard node).
|
||||
* @param[in] ssInsertBefore Name of the node to insert the value before. In case of an array, can be an index between
|
||||
* square brackets. Can be empty, causing the node to be inserted at the end.
|
||||
* @param[in] ssName Name of the node to insert. This name can contain parent nodes, which are automatically created if
|
||||
* not existing. With arrays, since the value in TOML doesn't have a name, the name of the value must be an empty
|
||||
* string and any names provided are considered parent nodes. 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.
|
||||
};
|
||||
IInterfaceAccess InsertArray(in u8string ssInsertBefore, 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] 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.
|
||||
* @remarks In TOML, inline nodes are located before standard nodes. Tables can be inserted as inline node, in which
|
||||
* case they will be inserted before any standard node (table or table array if defined as standard node).
|
||||
* @param[in] ssInsertBefore Name of the node to insert the value before. In case of an array, can be an index between
|
||||
* square brackets. Can be empty, causing the node to be inserted at the end.
|
||||
* @param[in] ssName Name of the node to insert. This name can contain parent nodes, which are automatically created if
|
||||
* not existing. With arrays, since the value in TOML doesn't have a name, the name of the value must be an empty
|
||||
* string and any names provided are considered parent nodes. 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);
|
||||
IInterfaceAccess InsertTable(in u8string ssInsertBefore, 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.
|
||||
* @remarks In TOML, inline nodes are located before standard nodes. Table arrays can be inserted as inline node, in
|
||||
* which case they will be inserted before any standard node (table or table array if defined as standard node).
|
||||
* @param[in] ssInsertBefore Name of the node to insert the value before. In case of an array, can be an index between
|
||||
* square brackets. Can be empty, causing the node to be inserted at the end.
|
||||
* @param[in] ssName Name of the node to insert. This name can contain parent nodes, which are automatically created if
|
||||
* not existing. With arrays, since the value in TOML doesn't have a name, the name of the value must be an empty
|
||||
* string and any names provided are considered parent nodes. 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);
|
||||
IInterfaceAccess InsertTableArray(in u8string ssInsertBefore, in u8string ssName, in EInsertPreference ePreference);
|
||||
|
||||
/**
|
||||
* @brief The result of the TOML string to insert.
|
||||
@@ -358,17 +365,15 @@ module sdv
|
||||
* @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.
|
||||
* @remarks In TOML, inline nodes are located before standard nodes. Dependable on the nodes defined in the TOML they
|
||||
* might be transferred to inline or they might be inserted at a different location.
|
||||
* @param[in] ssInsertBefore Name of the node to insert the value before. In case of an array, can be an index between
|
||||
* square brackets. Can be empty, causing the node to be inserted at the end.
|
||||
* @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);
|
||||
EInsertResult InsertTOML(in u8string ssInsertBefore, in u8string ssTOML, in boolean bRollbackOnFailure);
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user