/******************************************************************************** * 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 #include "linked.idl" // Test: split nested module definitions // Nested module definitions module Test1 { /** * @brief Javadoc like comments */ module Test2 { struct SModuleTest1 {}; }; }; // Extending module definitions module Test1 { module Test2 { struct SModuleTest2 {}; }; }; // Test: forward declaration of struct struct SForward1; /*! * @brief Implementation of forward declared structure */ struct SForward1 {}; /** * @brief Second level base interface. */ interface I2ndLevelBase : sdv::IInterfaceAccess { void Test2nd_1(); void Test2nd_2(); }; /** * @brief Base interface */ interface IBase : I2ndLevelBase { void TestBase_1(); void TestBase_2(); }; /** * @brief Inheritance test interface. */ interface IInheritanceTest : IBase { void Test1(); void Test2(); }; /** * @brief Complex structure */ struct SComplex { uint8 uiVal8 = 0x08; uint16 uiVal16 = 0x0106; uint32 uiVal32 = 0x00030002; uint64 uiVal64 = 0x0000000600000004; float fVal = 1234.1234f; double dVal = 5678.5678; // GCC issue with generated initialization in the constructor for the "long double" type: BUG #3982727 //long double ldVal = 12345678.12345678l; boolean bVal = true; uint32 rguiVal32[5] = { 0x10, 0x20, 0x30, 0x40, 0x50 }; char16 rgcVal[6] = u"Hello"; string ssEmptyVal; string ssVal; u8string ss8Val; u16string ss16Val; u32string ss32Val; wstring sswVal; string<15> ssFixedVal; u8string<15> ss8FixedVal; u16string<15> ss16FixedVal; u32string<15> ss32FixedVal; wstring<15> sswFixedVal; struct SRGB { string ssRed; string ssGreen; string ssBlue; }; sequence seqEmptyVal; sequence seqRgbVal; sequence seqFixedRgbVal; pointer ptrEmptyVal; pointer ptrRgbVal; pointer ptrFixedRgbVal; any anyString; any anyFloat; any anyInteger; }; /** * @brief Exception defined */ exception XExceptionTest { SComplex sComplex; ///< Complex data in the exception }; /** * @brief Interface to test the marshalling of variables. */ interface IVarTest { /** * @{ * @brief Test signed fixed integral. */ void SetFixedInt(in int8 i8Val, in int16 i16Val, in int32 i32Val, in int64 i64Val); void GetFixedInt(out int8 i8Val, out int16 i16Val, out int32 i32Val, out int64 i64Val) const; /** * @} */ /** * @{ * @brief Test unsigned fixed integral. */ void SetFixedUInt(in boolean bVal, in native nVal, in uint8 ui8Val, in uint16 ui16Val, in uint32 ui32Val, in uint64 ui64Val); void GetFixedUInt(out boolean bVal, out native nVal, out uint8 ui8Val, out uint16 ui16Val, out uint32 ui32Val, out uint64 ui64Val) const; /** * @} */ /** * @{ * @brief Test character integral. */ void SetFixedChar(in char cVal, in wchar cwVal, in char16 c16Val, in char32 c32Val); void GetFixedChar(out char cVal, out wchar cwVal, out char16 c16Val, out char32 c32Val) const; /** * @} */ /** * @{ * @brief Test floating point. */ // GCC issue with generated initialization in the consructor for the "long double" type: BUG #3982727 void SetFloatingPoint(in float fVal, in double dVal/*, in long double ldVal*/); void GetFloatingPoint(out float fVal, out double dVal/*, out long double ldVal*/) const; /** * @} */ /** * @{ * @brief Test fixed point. */ void SetFixedPoint(in fixed<10, 3> fixVal10, in fixed<8, 2> fixVal8, in fixed<5, 0> fixVal5); void GetFixedPoint(out fixed<10, 3> fixVal10, out fixed<8, 2> fixVal8, out fixed<5, 0> fixVal5) const; /** * @} */ /** * @{ * @brief Test string. */ void SetString(in string ssText, in u8string ss8Text, in u16string ss16Text, in u32string ss32Text, in wstring sswText); void GetString(out string ssText, out u8string ss8Text, out u16string ss16Text, out u32string ss32Text, out wstring sswText) const; /** * @} */ /** * @{ * @brief Test fixed size string. */ void SetFixedString(in string<10> ssText, in u8string<10> ss8Text, in u16string<10> ss16Text, in u32string<10> ss32Text, in wstring<10> sswText); void GetFixedString(out string<15> ssText, out u8string<15> ss8Text, out u16string<15> ss16Text, out u32string<15> ss32Text, out wstring<15> sswText) const; /** * @} */ /** * @{ * @brief Test sequence. */ void SetSequence(in sequence seqUInts, in sequence seqTexts, in sequence> seqSequences); void GetSequence(out sequence seqUInts, out sequence seqTexts, out sequence> seqSequences); /** * @} */ /** * @{ * @brief Test fixed size sequence. */ void SetFixedSequence(in sequence seqUInts, in sequence seqTexts, in sequence, 2> seqSequences); void GetFixedSequence(out sequence seqUInts, out sequence seqTexts, out sequence, 3> seqSequences); /** * @} */ /** * @{ * @brief Test map. */ void SetMap(in map mapUInts, in map mapTexts, in map> mapSequences); void GetMap(out map mapUInts, out map mapTexts, out map> mapSequences); /** * @} */ /** * @{ * @brief Test fixed size map. */ void SetFixedMap(in map mapUInts, in map mapTexts, in map, 2> mapSequences); void GetFixedMap(out map mapUInts, out map mapTexts, out map, 3> mapSequences); /** * @} */ /** * @{ * @brief Test pointer. */ void SetPointer(in pointer ptrUInts, in pointer ptrTexts, in pointer> ptrSequences); void GetPointer(out pointer ptrUInts, out pointer ptrTexts, out pointer> ptrSequences); /** * @} */ /** * @{ * @brief Test fixed size pointer. */ void SetFixedPointer(in pointer ptrUInts, in pointer ptrTexts, in pointer, 2> ptrSequences); void GetFixedPointer(out pointer ptrUInts, out pointer ptrTexts, out pointer, 3> ptrSequences); /** * @} */ /** * @{ * @brief Test any data type. */ void SetAny(in any anyMyValue); void GetAny(out any anyMyValue); /** * @} */ /** * @{ * @brief Test complex data type. */ void SetComplex(in SComplex rsComplex); SComplex GetComplex() const; void UpdateComplex(inout SComplex rsComplex); /** * @} */ /** * @{ * @brief Test attributes */ attribute boolean bVal; attribute native nVal; attribute int8 i8Val; attribute int16 i16Val; attribute int32 i32Val; attribute int64 i64Val; attribute uint8 ui8Val; attribute uint16 ui16Val; attribute uint32 ui32Val; attribute uint64 ui64Val; attribute char cVal; attribute wchar cwVal; attribute char16 c16Val; attribute char32 c32Val; attribute float fVal; attribute double dVal; // GCC issue with generated initialization in the consructor for the "long double" type: BUG #3982727 //attribute long double ldVal; attribute fixed<10, 3> fixVal10; attribute fixed<8, 2> fixVal8; attribute fixed<5, 0> fixVal5; attribute string ssText; attribute u8string ss8Text; attribute u16string ss16Text; attribute u32string ss32Text; attribute wstring sswText; attribute string<10> ssFixedText; attribute u8string<10> ss8FixedText; attribute u16string<10> ss16FixedText; attribute u32string<10> ss32FixedText; attribute wstring<10> sswFixedText; attribute sequence seqUInts; attribute sequence seqTexts; attribute sequence> seqSequences; attribute sequence seqFixedUInts; attribute sequence seqFixedTexts; attribute sequence, 2> seqFixedSequences; attribute map mapUInts; attribute map mapTexts; attribute map> mapSequences; attribute map mapFixedUInts; attribute map mapFixedTexts; attribute map, 2> mapFixedSequences; attribute pointer ptrUInts; attribute pointer ptrTexts; attribute pointer> ptrSequences; attribute pointer ptrFixedUInts; attribute pointer ptrFixedTexts; attribute pointer, 2> ptrFixedSequences; attribute any anyMyValue; /** * @} */ /** * Trigger complex exception. */ void TriggerComplexException() raises(XExceptionTest); /** * Trigger system exception. */ void TriggerSystemException(); /** * Trigger unhandled exception. */ void TriggerUnhandledException(); /** * Trigger crash exception. */ void TriggerCrashException(); }; module BankDemo { typedef float TCashAmount; // Type for representing cash typedef string TAccountId; // Type for representing account ids //... interface IAccount : sdv::IInterfaceAccess { readonly attribute TAccountId fAccountId; //!< The account ID attribute TCashAmount fBalance; //!< The balance void Withdraw(in TCashAmount fAmount) raises(InsufficientFunds); void Deposit(in TCashAmount fAmount); }; };