diff options
author | Stefan Laner <laner@itestra.de> | 2013-11-23 01:14:27 +0100 |
---|---|---|
committer | Philip Rauwolf <rauwolf@itestra.de> | 2013-11-27 14:59:35 +0100 |
commit | 8c6ed83e31ac977224da0fd0763c173e16b5f858 (patch) | |
tree | aa3c46e1478ed2fd8de8e783804cfcdc8aa2c72c | |
parent | e6460a44e88ceb584d920e86550a725491965d7a (diff) | |
download | genivi-common-api-dbus-runtime-8c6ed83e31ac977224da0fd0763c173e16b5f858.tar.gz |
Fix for inherited interfaces and tests for that including generated code
72 files changed, 2530 insertions, 891 deletions
diff --git a/DBusPolymorphicTest b/DBusPolymorphicTest new file mode 100755 index 0000000..4b4da2a --- /dev/null +++ b/DBusPolymorphicTest @@ -0,0 +1,228 @@ +#! /bin/bash + +# DBusPolymorphicTest - temporary wrapper script for .libs/DBusPolymorphicTest +# Generated by libtool (GNU libtool) 2.4.2 Debian-2.4.2-1ubuntu1 +# +# The DBusPolymorphicTest program cannot be directly executed until all the libtool +# libraries that it depends on are installed. +# +# This wrapper script should never be moved out of the build directory. +# If it is, it will not operate correctly. + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +sed_quote_subst='s/\([`"$\\]\)/\\\1/g' + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac +fi +BIN_SH=xpg4; export BIN_SH # for Tru64 +DUALCASE=1; export DUALCASE # for MKS sh + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +relink_command="(cd /home/laner/git/ascgit017.CommonAPI-D-Bus; { test -z \"\${LIBRARY_PATH+set}\" || unset LIBRARY_PATH || { LIBRARY_PATH=; export LIBRARY_PATH; }; }; { test -z \"\${COMPILER_PATH+set}\" || unset COMPILER_PATH || { COMPILER_PATH=; export COMPILER_PATH; }; }; { test -z \"\${GCC_EXEC_PREFIX+set}\" || unset GCC_EXEC_PREFIX || { GCC_EXEC_PREFIX=; export GCC_EXEC_PREFIX; }; }; { test -z \"\${LD_RUN_PATH+set}\" || unset LD_RUN_PATH || { LD_RUN_PATH=; export LD_RUN_PATH; }; }; { test -z \"\${LD_LIBRARY_PATH+set}\" || unset LD_LIBRARY_PATH || { LD_LIBRARY_PATH=; export LD_LIBRARY_PATH; }; }; PATH=/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games; export PATH; g++ -pthread -O0 -g -ggdb3 -std=c++0x -o \$progdir/\$file src/test/commonapi/tests/DBusPolymorphicTest-DerivedTypeCollection.o src/test/commonapi/tests/DBusPolymorphicTest-TestInterfaceStubDefault.o src/test/commonapi/tests/DBusPolymorphicTest-TestInterfaceDBusProxy.o src/test/commonapi/tests/DBusPolymorphicTest-TestInterfaceDBusStubAdapter.o src/test/fake/legacy/service/DBusPolymorphicTest-LegacyInterfaceDBusProxy.o src/test/DBusPolymorphicTest-DBusPolymorphicTest.o -pthread /home/laner/git/ascgit017.CommonAPI/.libs/libCommonAPI.so -L/usr/local/lib /usr/local/lib/libdbus-1.so -lpthread -lrt ./.libs/libCommonAPI-DBus.so /home/laner/gtest-1.6.0/lib/.libs/libgtest.so -pthread -Wl,-rpath -Wl,/home/laner/git/ascgit017.CommonAPI/.libs -Wl,-rpath -Wl,/usr/local/lib -Wl,-rpath -Wl,/home/laner/git/ascgit017.CommonAPI-D-Bus/.libs -Wl,-rpath -Wl,/home/laner/gtest-1.6.0/lib/.libs -Wl,-rpath -Wl,/usr/local/lib)" + +# This environment variable determines our operation mode. +if test "$libtool_install_magic" = "%%%MAGIC variable%%%"; then + # install mode needs the following variables: + generated_by_libtool_version='2.4.2' + notinst_deplibs=' /home/laner/git/ascgit017.CommonAPI/libCommonAPI.la libCommonAPI-DBus.la /home/laner/gtest-1.6.0/lib/libgtest.la' +else + # When we are sourced in execute mode, $file and $ECHO are already set. + if test "$libtool_execute_magic" != "%%%MAGIC variable%%%"; then + file="$0" + +# A function that is used when there is no print builtin or printf. +func_fallback_echo () +{ + eval 'cat <<_LTECHO_EOF +$1 +_LTECHO_EOF' +} + ECHO="printf %s\\n" + fi + +# Very basic option parsing. These options are (a) specific to +# the libtool wrapper, (b) are identical between the wrapper +# /script/ and the wrapper /executable/ which is used only on +# windows platforms, and (c) all begin with the string --lt- +# (application programs are unlikely to have options which match +# this pattern). +# +# There are only two supported options: --lt-debug and +# --lt-dump-script. There is, deliberately, no --lt-help. +# +# The first argument to this parsing function should be the +# script's ./libtool value, followed by no. +lt_option_debug= +func_parse_lt_options () +{ + lt_script_arg0=$0 + shift + for lt_opt + do + case "$lt_opt" in + --lt-debug) lt_option_debug=1 ;; + --lt-dump-script) + lt_dump_D=`$ECHO "X$lt_script_arg0" | /bin/sed -e 's/^X//' -e 's%/[^/]*$%%'` + test "X$lt_dump_D" = "X$lt_script_arg0" && lt_dump_D=. + lt_dump_F=`$ECHO "X$lt_script_arg0" | /bin/sed -e 's/^X//' -e 's%^.*/%%'` + cat "$lt_dump_D/$lt_dump_F" + exit 0 + ;; + --lt-*) + $ECHO "Unrecognized --lt- option: '$lt_opt'" 1>&2 + exit 1 + ;; + esac + done + + # Print the debug banner immediately: + if test -n "$lt_option_debug"; then + echo "DBusPolymorphicTest:DBusPolymorphicTest:${LINENO}: libtool wrapper (GNU libtool) 2.4.2 Debian-2.4.2-1ubuntu1" 1>&2 + fi +} + +# Used when --lt-debug. Prints its arguments to stdout +# (redirection is the responsibility of the caller) +func_lt_dump_args () +{ + lt_dump_args_N=1; + for lt_arg + do + $ECHO "DBusPolymorphicTest:DBusPolymorphicTest:${LINENO}: newargv[$lt_dump_args_N]: $lt_arg" + lt_dump_args_N=`expr $lt_dump_args_N + 1` + done +} + +# Core function for launching the target application +func_exec_program_core () +{ + + if test -n "$lt_option_debug"; then + $ECHO "DBusPolymorphicTest:DBusPolymorphicTest:${LINENO}: newargv[0]: $progdir/$program" 1>&2 + func_lt_dump_args ${1+"$@"} 1>&2 + fi + exec "$progdir/$program" ${1+"$@"} + + $ECHO "$0: cannot exec $program $*" 1>&2 + exit 1 +} + +# A function to encapsulate launching the target application +# Strips options in the --lt-* namespace from $@ and +# launches target application with the remaining arguments. +func_exec_program () +{ + case " $* " in + *\ --lt-*) + for lt_wr_arg + do + case $lt_wr_arg in + --lt-*) ;; + *) set x "$@" "$lt_wr_arg"; shift;; + esac + shift + done ;; + esac + func_exec_program_core ${1+"$@"} +} + + # Parse options + func_parse_lt_options "$0" ${1+"$@"} + + # Find the directory that this script lives in. + thisdir=`$ECHO "$file" | /bin/sed 's%/[^/]*$%%'` + test "x$thisdir" = "x$file" && thisdir=. + + # Follow symbolic links until we get to the real thisdir. + file=`ls -ld "$file" | /bin/sed -n 's/.*-> //p'` + while test -n "$file"; do + destdir=`$ECHO "$file" | /bin/sed 's%/[^/]*$%%'` + + # If there was a directory component, then change thisdir. + if test "x$destdir" != "x$file"; then + case "$destdir" in + [\\/]* | [A-Za-z]:[\\/]*) thisdir="$destdir" ;; + *) thisdir="$thisdir/$destdir" ;; + esac + fi + + file=`$ECHO "$file" | /bin/sed 's%^.*/%%'` + file=`ls -ld "$thisdir/$file" | /bin/sed -n 's/.*-> //p'` + done + + # Usually 'no', except on cygwin/mingw when embedded into + # the cwrapper. + WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=no + if test "$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR" = "yes"; then + # special case for '.' + if test "$thisdir" = "."; then + thisdir=`pwd` + fi + # remove .libs from thisdir + case "$thisdir" in + *[\\/].libs ) thisdir=`$ECHO "$thisdir" | /bin/sed 's%[\\/][^\\/]*$%%'` ;; + .libs ) thisdir=. ;; + esac + fi + + # Try to get the absolute directory name. + absdir=`cd "$thisdir" && pwd` + test -n "$absdir" && thisdir="$absdir" + + program=lt-'DBusPolymorphicTest' + progdir="$thisdir/.libs" + + if test ! -f "$progdir/$program" || + { file=`ls -1dt "$progdir/$program" "$progdir/../$program" 2>/dev/null | /bin/sed 1q`; \ + test "X$file" != "X$progdir/$program"; }; then + + file="$$-$program" + + if test ! -d "$progdir"; then + mkdir "$progdir" + else + rm -f "$progdir/$file" + fi + + # relink executable if necessary + if test -n "$relink_command"; then + if relink_command_output=`eval $relink_command 2>&1`; then : + else + printf %s\n "$relink_command_output" >&2 + rm -f "$progdir/$file" + exit 1 + fi + fi + + mv -f "$progdir/$file" "$progdir/$program" 2>/dev/null || + { rm -f "$progdir/$program"; + mv -f "$progdir/$file" "$progdir/$program"; } + rm -f "$progdir/$file" + fi + + if test -f "$progdir/$program"; then + if test "$libtool_execute_magic" != "%%%MAGIC variable%%%"; then + # Run the actual program with our arguments. + func_exec_program ${1+"$@"} + fi + else + # The program doesn't exist. + $ECHO "$0: error: \`$progdir/$program' does not exist" 1>&2 + $ECHO "This script is just a wrapper for $program." 1>&2 + $ECHO "See the libtool documentation for more information." 1>&2 + exit 1 + fi +fi diff --git a/Makefile.am b/Makefile.am index a3bc737..b1b650d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -163,6 +163,10 @@ ManagedDBusSources = \ src/test/commonapi/tests/managed/SecondRootDBusProxy.cpp \ src/test/commonapi/tests/managed/SecondRootDBusStubAdapter.cpp +ExtendedInterfaceSources = \ + src/test/commonapi/tests/ExtendedInterfaceDBusProxy.cpp \ + src/test/commonapi/tests/ExtendedInterfaceDBusStubAdapter.cpp \ + src/test/commonapi/tests/ExtendedInterfaceStubDefault.cpp lib_LTLIBRARIES += libDBusGen-TestInterface.la libDBusGen_TestInterface_la_SOURCES = \ @@ -308,7 +312,8 @@ DBusMultipleConnectionTest_LDADD = ${LDADD_FOR_GTEST} DBusProxyTest_SOURCES = \ src/test/DBusProxyTest.cpp \ - ${TestInterfaceDBusSources} + ${TestInterfaceDBusSources} \ + ${ExtendedInterfaceSources} DBusProxyTest_CPPFLAGS = ${AM_CPPFLAGS} ${GTEST_CPPFLAGS} DBusProxyTest_CXXFLAGS = ${GTEST_CXXFLAGS} DBusProxyTest_LDADD = ${LDADD_FOR_GTEST} diff --git a/src/CommonAPI/DBus/DBusFactory.cpp b/src/CommonAPI/DBus/DBusFactory.cpp index 782b9ce..c0b2cdd 100644 --- a/src/CommonAPI/DBus/DBusFactory.cpp +++ b/src/CommonAPI/DBus/DBusFactory.cpp @@ -185,7 +185,7 @@ std::shared_ptr<DBusStubAdapter> DBusFactory::createDBusStubAdapter(const std::s const auto& dbusAdapterFactoryFunction = registeredAdapterFactoryFunctionsIter->second; dbusStubAdapter = dbusAdapterFactoryFunction(shared_from_this(), commonApiAddress, interfaceName, connectionName, objectPath, dbusConnection_, stubBase); - dbusStubAdapter->init(); + dbusStubAdapter->init(dbusStubAdapter); } return dbusStubAdapter; diff --git a/src/CommonAPI/DBus/DBusStubAdapter.cpp b/src/CommonAPI/DBus/DBusStubAdapter.cpp index eb187ef..7456d9f 100644 --- a/src/CommonAPI/DBus/DBusStubAdapter.cpp +++ b/src/CommonAPI/DBus/DBusStubAdapter.cpp @@ -47,7 +47,7 @@ DBusStubAdapter::~DBusStubAdapter() { deinit(); } -void DBusStubAdapter::init() { +void DBusStubAdapter::init(std::shared_ptr<DBusStubAdapter> instance) { } void DBusStubAdapter::deinit() { diff --git a/src/CommonAPI/DBus/DBusStubAdapter.h b/src/CommonAPI/DBus/DBusStubAdapter.h index ec73067..129e397 100644 --- a/src/CommonAPI/DBus/DBusStubAdapter.h +++ b/src/CommonAPI/DBus/DBusStubAdapter.h @@ -39,7 +39,7 @@ class DBusStubAdapter: virtual public CommonAPI::StubAdapter, public DBusInterfa virtual ~DBusStubAdapter(); - virtual void init(); + virtual void init(std::shared_ptr<DBusStubAdapter> instance); virtual void deinit(); virtual const std::string getAddress() const; diff --git a/src/CommonAPI/DBus/DBusStubAdapterHelper.h b/src/CommonAPI/DBus/DBusStubAdapterHelper.h index 54f246a..aa7f2db 100644 --- a/src/CommonAPI/DBus/DBusStubAdapterHelper.h +++ b/src/CommonAPI/DBus/DBusStubAdapterHelper.h @@ -27,17 +27,24 @@ namespace CommonAPI { namespace DBus { +class StubDispatcherBase { +public: + virtual ~StubDispatcherBase() { } +}; + template <typename _StubClass> -class DBusStubAdapterHelper: public DBusStubAdapter, public std::enable_shared_from_this<typename _StubClass::StubAdapterType> { +class DBusStubAdapterHelper: public virtual DBusStubAdapter { public: typedef typename _StubClass::StubAdapterType StubAdapterType; typedef typename _StubClass::RemoteEventHandlerType RemoteEventHandlerType; - class StubDispatcher { + class StubDispatcher: public StubDispatcherBase { public: - virtual ~StubDispatcher() { } virtual bool dispatchDBusMessage(const DBusMessage& dbusMessage, const std::shared_ptr<_StubClass>& stub, DBusStubAdapterHelper<_StubClass>& dbusStubAdapterHelper) = 0; }; + // interfaceMemberName, interfaceMemberSignature + typedef std::pair<const char*, const char*> DBusInterfaceMemberPath; + typedef std::unordered_map<DBusInterfaceMemberPath, StubDispatcherBase*> StubDispatcherTable; public: DBusStubAdapterHelper(const std::shared_ptr<DBusFactory>& factory, @@ -57,9 +64,10 @@ class DBusStubAdapterHelper: public DBusStubAdapter, public std::enable_shared_f stub_.reset(); } - virtual void init() { - DBusStubAdapter::init(); - remoteEventHandler_ = stub_->initStubAdapter(getStubAdapter()); + virtual void init(std::shared_ptr<DBusStubAdapter> instance) { + DBusStubAdapter::init(instance); + std::shared_ptr<StubAdapterType> stubAdapter = std::dynamic_pointer_cast<StubAdapterType>(instance); + remoteEventHandler_ = stub_->initStubAdapter(stubAdapter); } virtual void deinit() { @@ -67,8 +75,8 @@ class DBusStubAdapterHelper: public DBusStubAdapter, public std::enable_shared_f stub_.reset(); } - inline std::shared_ptr<StubAdapterType> getStubAdapter() { - return this->shared_from_this(); + inline void setRemoteEventHandler(RemoteEventHandlerType* remoteEventHandler) { + remoteEventHandler_ = remoteEventHandler; } inline RemoteEventHandlerType* getRemoteEventHandler() { @@ -76,9 +84,6 @@ class DBusStubAdapterHelper: public DBusStubAdapter, public std::enable_shared_f } protected: - // interfaceMemberName, interfaceMemberSignature - typedef std::pair<const char*, const char*> DBusInterfaceMemberPath; - typedef std::unordered_map<DBusInterfaceMemberPath, StubDispatcher*> StubDispatcherTable; virtual bool onInterfaceDBusMessage(const DBusMessage& dbusMessage) { const char* interfaceMemberName = dbusMessage.getMemberName(); @@ -95,7 +100,7 @@ class DBusStubAdapterHelper: public DBusStubAdapter, public std::enable_shared_f //To prevent the destruction of the stub whilst still handling a message auto stubSafety = stub_; if (stubSafety && foundInterfaceMemberHandler) { - StubDispatcher* stubDispatcher = findIterator->second; + StubDispatcher* stubDispatcher = static_cast<StubDispatcher*>(findIterator->second); dbusMessageHandled = stubDispatcher->dispatchDBusMessage(dbusMessage, stubSafety, *this); } @@ -323,7 +328,7 @@ class DBusMethodWithReplyAdapterDispatcher<_StubClass, _StubAdapterClass, _In<_I std::shared_ptr<DBusClientId> clientId = std::make_shared<DBusClientId>(std::string(dbusMessage.getSenderName())); - (dbusStubAdapterHelper.getStubAdapter().get()->*stubFunctor_)(clientId, std::move(std::get<_InArgIndices>(argTuple))..., std::get<_OutArgIndices>(argTuple)...); + (stub->getStubAdapter().get()->*stubFunctor_)(clientId, std::move(std::get<_InArgIndices>(argTuple))..., std::get<_OutArgIndices>(argTuple)...); DBusMessage dbusMessageReply = dbusMessage.createMethodReturn(dbusReplySignature_); if (sizeof...(_OutArgs) > 0) { @@ -476,7 +481,7 @@ class DBusSetObservableAttributeStubDispatcher: public DBusSetAttributeStubDispa private: inline void fireAttributeValueChanged(std::shared_ptr<CommonAPI::ClientId> clientId, DBusStubAdapterHelperType& dbusStubAdapterHelper, const std::shared_ptr<_StubClass> stub) { - (dbusStubAdapterHelper.getStubAdapter().get()->*fireChangedFunctor_)(this->getAttributeValue(clientId, stub)); + (stub->getStubAdapter().get()->*fireChangedFunctor_)(this->getAttributeValue(clientId, stub)); } const FireChangedFunctor fireChangedFunctor_; diff --git a/src/test/DBusCommunicationTest.cpp b/src/test/DBusCommunicationTest.cpp index 126422d..2534154 100644 --- a/src/test/DBusCommunicationTest.cpp +++ b/src/test/DBusCommunicationTest.cpp @@ -403,7 +403,7 @@ class DBusLowLevelCommunicationTest: public ::testing::Test { std::shared_ptr<commonapi::tests::TestInterfaceStubDefault> stub = std::make_shared<commonapi::tests::TestInterfaceStubDefault>(); dbusStubAdapter = std::make_shared<commonapi::tests::TestInterfaceDBusStubAdapter>(dummy, commonApiAddress, interfaceName, connectionName, objectPath, dbusConnection, stub); - dbusStubAdapter->init(); + dbusStubAdapter->init(dbusStubAdapter); std::shared_ptr<CommonAPI::DBus::DBusObjectManagerStub> rootDBusObjectManagerStub = dbusConnection->getDBusObjectManager()->getRootDBusObjectManagerStub(); diff --git a/src/test/DBusObjectManagerStubTest.cpp b/src/test/DBusObjectManagerStubTest.cpp index cd14d74..28b44c7 100644 --- a/src/test/DBusObjectManagerStubTest.cpp +++ b/src/test/DBusObjectManagerStubTest.cpp @@ -279,7 +279,7 @@ protected: ASSERT_TRUE(bool(dbusStubAdapter[i])); - dbusStubAdapter[i]->init(); + dbusStubAdapter[i]->init(dbusStubAdapter[i]); } } @@ -349,7 +349,7 @@ TEST_F(DBusObjectManagerStubTest, RegisterManagerStubAdapterWorks) { serviceFactory, dbusObjectManagerStubPath, stubDBusConnection_); - managerDBusStubAdapter->init(); + managerDBusStubAdapter->init(managerDBusStubAdapter); ASSERT_TRUE(CommonAPI::DBus::DBusServicePublisher::getInstance()->registerService(managerDBusStubAdapter)); @@ -385,7 +385,7 @@ TEST_F(DBusObjectManagerStubTest, ManagerStubAdapterExportAndUnexportWorks) { serviceFactory, dbusObjectManagerStubPath, stubDBusConnection_); - managerDBusStubAdapter->init(); + managerDBusStubAdapter->init(managerDBusStubAdapter); ASSERT_TRUE(CommonAPI::DBus::DBusServicePublisher::getInstance()->registerService(managerDBusStubAdapter)); @@ -452,7 +452,7 @@ TEST_F(DBusObjectManagerStubTest, DestructorUnpublishingWorks) { serviceFactory, dbusObjectManagerStubPath, stubDBusConnection_); - managerDBusStubAdapter->init(); + managerDBusStubAdapter->init(managerDBusStubAdapter); EXPECT_TRUE(CommonAPI::DBus::DBusServicePublisher::getInstance()->registerService(managerDBusStubAdapter)); diff --git a/src/test/DBusPolymorphicTest.cpp b/src/test/DBusPolymorphicTest.cpp index 7b2df63..62d6115 100644 --- a/src/test/DBusPolymorphicTest.cpp +++ b/src/test/DBusPolymorphicTest.cpp @@ -145,7 +145,7 @@ protected: objectPath, stubDBusConnection_, testStub); - stubAdapter_->init(); + stubAdapter_->init(stubAdapter_); const bool isStubAdapterRegistered = CommonAPI::DBus::DBusServicePublisher::getInstance()->registerService( stubAdapter_); @@ -239,7 +239,7 @@ TEST_F(PolymorphicTest, SendStructWithPolymorphicMember) { ASSERT_EQ(testStub->numberOfContainedElements_, 1); ASSERT_TRUE(testStub->firstElementIsExtended_); } - +/* TEST_F(PolymorphicTest, SendStructWithMapWithEnumKeyMember) { CommonAPI::CallStatus stat; commonapi::tests::DerivedTypeCollection::StructWithEnumKeyMap inputStruct; @@ -249,6 +249,7 @@ TEST_F(PolymorphicTest, SendStructWithMapWithEnumKeyMember) { ASSERT_EQ(stat, CommonAPI::CallStatus::SUCCESS); } +*/ int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); diff --git a/src/test/DBusProxyTest.cpp b/src/test/DBusProxyTest.cpp index 33e44d9..a966fe2 100644 --- a/src/test/DBusProxyTest.cpp +++ b/src/test/DBusProxyTest.cpp @@ -25,6 +25,11 @@ #include <commonapi/tests/TestInterfaceDBusStubAdapter.h> #include <commonapi/tests/TestInterfaceStubDefault.h> +#include <commonapi/tests/ExtendedInterfaceProxy.h> +#include <commonapi/tests/ExtendedInterfaceDBusProxy.h> +#include <commonapi/tests/ExtendedInterfaceDBusStubAdapter.h> +#include <commonapi/tests/ExtendedInterfaceStubDefault.h> + #ifndef COMMONAPI_INTERNAL_COMPILATION #define COMMONAPI_INTERNAL_COMPILATION #endif @@ -42,10 +47,12 @@ static const std::string commonApiAddress = "local:CommonAPI.DBus.tests.DBusProxyTestInterface:CommonAPI.DBus.tests.DBusProxyTestService"; +static const std::string commonApiAddressExtended = "local:CommonAPI.DBus.tests.DBusProxyTestInterface:CommonAPI.DBus.tests.DBusProxyTestService2"; static const std::string commonApiServiceName = "CommonAPI.DBus.tests.DBusProxyTestInterface"; static const std::string interfaceName = "CommonAPI.DBus.tests.DBusProxyTestInterface"; static const std::string busName = "CommonAPI.DBus.tests.DBusProxyTestService"; static const std::string objectPath = "/CommonAPI/DBus/tests/DBusProxyTestService"; +static const std::string objectPathExtended = "/CommonAPI/DBus/tests/DBusProxyTestService2"; class ProxyTest: public ::testing::Test { @@ -53,15 +60,15 @@ protected: void SetUp() { - auto runtime = std::dynamic_pointer_cast<CommonAPI::DBus::DBusRuntime>(CommonAPI::Runtime::load()); + runtime_ = std::dynamic_pointer_cast<CommonAPI::DBus::DBusRuntime>(CommonAPI::Runtime::load()); - serviceFactory = std::dynamic_pointer_cast<CommonAPI::DBus::DBusFactory>(runtime->createFactory()); + serviceFactory_ = std::dynamic_pointer_cast<CommonAPI::DBus::DBusFactory>(runtime_->createFactory()); proxyDBusConnection_ = CommonAPI::DBus::DBusConnection::getSessionBus(); ASSERT_TRUE(proxyDBusConnection_->connect()); proxy_ = std::make_shared<commonapi::tests::TestInterfaceDBusProxy>( - serviceFactory, + serviceFactory_, commonApiAddress, interfaceName, busName, @@ -70,28 +77,25 @@ protected: proxy_->init(); } - std::shared_ptr<CommonAPI::DBus::DBusFactory> serviceFactory; + std::shared_ptr<CommonAPI::DBus::DBusRuntime> runtime_; + std::shared_ptr<CommonAPI::DBus::DBusFactory> serviceFactory_; virtual void TearDown() { usleep(30000); } void registerTestStub() { - stubDBusConnection_ = CommonAPI::DBus::DBusConnection::getSessionBus(); - ASSERT_TRUE(stubDBusConnection_->connect()); + stubDefault_ = std::make_shared<commonapi::tests::TestInterfaceStubDefault>(); + const bool isStubAdapterRegistered = runtime_->getServicePublisher()->registerService<commonapi::tests::TestInterfaceStub>(stubDefault_, commonApiAddress, serviceFactory_); + ASSERT_TRUE(isStubAdapterRegistered); - auto stubDefault = std::make_shared<commonapi::tests::TestInterfaceStubDefault>(); - stubAdapter_ = std::make_shared<commonapi::tests::TestInterfaceDBusStubAdapter>( - serviceFactory, - commonApiAddress, - interfaceName, - busName, - objectPath, - stubDBusConnection_, - stubDefault); - stubAdapter_->init(); + usleep(500000); + } - const bool isStubAdapterRegistered = CommonAPI::DBus::DBusServicePublisher::getInstance()->registerService(stubAdapter_); + void registerExtendedStub() { + stubExtended_ = std::make_shared<commonapi::tests::ExtendedInterfaceStubDefault>(); + + const bool isStubAdapterRegistered = runtime_->getServicePublisher()->registerService<commonapi::tests::ExtendedInterfaceStub>(stubExtended_, commonApiAddressExtended, serviceFactory_); ASSERT_TRUE(isStubAdapterRegistered); usleep(500000); @@ -99,14 +103,16 @@ protected: void deregisterTestStub() { const bool isStubAdapterUnregistered = CommonAPI::DBus::DBusServicePublisher::getInstance()->unregisterService( - stubAdapter_->getAddress()); + commonApiAddress); ASSERT_TRUE(isStubAdapterUnregistered); - stubAdapter_.reset(); + stubDefault_.reset(); + } - if (stubDBusConnection_->isConnected()) { - stubDBusConnection_->disconnect(); - } - stubDBusConnection_.reset(); + void deregisterExtendedStub() { + const bool isStubAdapterUnregistered = runtime_->getServicePublisher()->unregisterService( + commonApiAddressExtended); + ASSERT_TRUE(isStubAdapterUnregistered); + stubExtended_.reset(); } void proxyRegisterForAvailabilityStatus() { @@ -126,7 +132,7 @@ protected: for (int i = 0; i < 10; i++) { if (proxyAvailabilityStatus_ == availabilityStatus) return true; - usleep(100000); + usleep(200000); } return false; @@ -138,8 +144,8 @@ protected: CommonAPI::ProxyStatusEvent::Subscription proxyStatusSubscription_; - std::shared_ptr<CommonAPI::DBus::DBusConnection> stubDBusConnection_; - std::shared_ptr<commonapi::tests::TestInterfaceDBusStubAdapter> stubAdapter_; + std::shared_ptr<commonapi::tests::ExtendedInterfaceStubDefault> stubExtended_; + std::shared_ptr<commonapi::tests::TestInterfaceStubDefault> stubDefault_; }; TEST_F(ProxyTest, HasCorrectConnectionName) { @@ -181,11 +187,11 @@ TEST_F(ProxyTest, DBusProxyStatusEventBeforeServiceIsRegistered) { EXPECT_TRUE(proxyWaitForAvailabilityStatus(CommonAPI::AvailabilityStatus::AVAILABLE)); - stubDBusConnection_->disconnect(); + deregisterTestStub(); + usleep(100000); EXPECT_TRUE(proxyWaitForAvailabilityStatus(CommonAPI::AvailabilityStatus::NOT_AVAILABLE)); - deregisterTestStub(); proxyDeregisterForAvailabilityStatus(); } @@ -200,11 +206,11 @@ TEST_F(ProxyTest, DBusProxyStatusEventAfterServiceIsRegistered) { EXPECT_TRUE(proxyWaitForAvailabilityStatus(CommonAPI::AvailabilityStatus::AVAILABLE)); - stubDBusConnection_->disconnect(); + deregisterTestStub(); + usleep(100000); EXPECT_TRUE(proxyWaitForAvailabilityStatus(CommonAPI::AvailabilityStatus::NOT_AVAILABLE)); - deregisterTestStub(); proxyDeregisterForAvailabilityStatus(); } @@ -289,6 +295,57 @@ TEST_F(ProxyTest, AsyncCallbacksAreCalledIfServiceNotAvailable) { ASSERT_TRUE(wasCalledFuture.get()); } + +TEST_F(ProxyTest, CallMethodFromExtendedInterface) { + registerExtendedStub(); + + auto extendedProxy = serviceFactory_->buildProxy<commonapi::tests::ExtendedInterfaceProxy>(commonApiAddressExtended); + + // give the proxy time to become available + for(int i=0; i<20; i++) { + if(!extendedProxy->isAvailable()) { + usleep(100000); + } + } + + ASSERT_TRUE(extendedProxy->isAvailable()); + + uint32_t inInt; + bool wasCalled = false; + extendedProxy->TestIntMethodExtendedAsync( + inInt, + [&](const CommonAPI::CallStatus& callStatus) { + ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS); + wasCalled = true; + }); + usleep(200000); + + ASSERT_TRUE(wasCalled); + deregisterExtendedStub(); + usleep(500000); +} + +TEST_F(ProxyTest, CallMethodFromParentInterface) { + registerExtendedStub(); + + auto extendedProxy = serviceFactory_->buildProxy<commonapi::tests::ExtendedInterfaceProxy>(commonApiAddressExtended); + + usleep(800000); // give the proxy time to become available + ASSERT_TRUE(extendedProxy->isAvailable()); + + bool wasCalled = false; + extendedProxy->testEmptyMethodAsync( + [&](const CommonAPI::CallStatus& callStatus) { + ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS); + wasCalled = true; + }); + usleep(50000); + ASSERT_TRUE(wasCalled); + + deregisterExtendedStub(); + usleep(500000); +} + int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); diff --git a/src/test/commonapi/tests/DerivedTypeCollection.cpp b/src/test/commonapi/tests/DerivedTypeCollection.cpp index c8da568..ff24fa3 100644 --- a/src/test/commonapi/tests/DerivedTypeCollection.cpp +++ b/src/test/commonapi/tests/DerivedTypeCollection.cpp @@ -169,7 +169,6 @@ void TestExtendedPolymorphicStruct::writeToOutputStream(CommonAPI::OutputStream& outputStream << additionalValue; } - StructWithPolymorphicMember::StructWithPolymorphicMember(const uint32_t& numberValueValue, const std::shared_ptr<TestPolymorphicStruct>& polymorphicMemberValue): numberValue(numberValueValue), polymorphicMember(polymorphicMemberValue) @@ -197,7 +196,8 @@ void StructWithPolymorphicMember::writeToOutputStream(CommonAPI::OutputStream& o outputStream << polymorphicMember; } -StructWithEnumKeyMap::StructWithEnumKeyMap(const TestEnumMap& testMapValue): +StructWithEnumKeyMap::StructWithEnumKeyMap(const uint32_t& numberValueValue, const TestEnumMap& testMapValue): + numberValue(numberValueValue), testMap(testMapValue) { } @@ -208,15 +208,18 @@ bool operator==(const StructWithEnumKeyMap& lhs, const StructWithEnumKeyMap& rhs return true; return + lhs.numberValue == rhs.numberValue && lhs.testMap == rhs.testMap ; } void StructWithEnumKeyMap::readFromInputStream(CommonAPI::InputStream& inputStream) { + inputStream >> numberValue; inputStream >> testMap; } void StructWithEnumKeyMap::writeToOutputStream(CommonAPI::OutputStream& outputStream) const { + outputStream << numberValue; outputStream << testMap; } diff --git a/src/test/commonapi/tests/DerivedTypeCollection.h b/src/test/commonapi/tests/DerivedTypeCollection.h index a3aba4f..6f8d196 100644 --- a/src/test/commonapi/tests/DerivedTypeCollection.h +++ b/src/test/commonapi/tests/DerivedTypeCollection.h @@ -207,16 +207,18 @@ namespace DerivedTypeCollection { } }; struct StructWithEnumKeyMap: CommonAPI::SerializableStruct { + uint32_t numberValue; TestEnumMap testMap; StructWithEnumKeyMap() = default; - StructWithEnumKeyMap(const TestEnumMap& testMap); + StructWithEnumKeyMap(const uint32_t& numberValue, const TestEnumMap& testMap); virtual void readFromInputStream(CommonAPI::InputStream& inputStream); virtual void writeToOutputStream(CommonAPI::OutputStream& outputStream) const; static inline void writeToTypeOutputStream(CommonAPI::TypeOutputStream& typeOutputStream) { + typeOutputStream.writeUInt32Type(); typeOutputStream.beginWriteMapType(); typeOutputStream.writeInt32Type(); typeOutputStream.writeStringType(); diff --git a/src/test/commonapi/tests/ExtendedInterface.h b/src/test/commonapi/tests/ExtendedInterface.h new file mode 100644 index 0000000..0febbfd --- /dev/null +++ b/src/test/commonapi/tests/ExtendedInterface.h @@ -0,0 +1,60 @@ +/* +* This file was generated by the CommonAPI Generators. +* Used org.genivi.commonapi.core 2.1.4.qualifier. +* Used org.franca.core 0.8.10.201309262002. +* +* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. +* If a copy of the MPL was not distributed with this file, You can obtain one at +* http://mozilla.org/MPL/2.0/. +*/ +#ifndef COMMONAPI_TESTS_Extended_Interface_H_ +#define COMMONAPI_TESTS_Extended_Interface_H_ + + + +#include <commonapi/tests/TestInterface.h> + +#if !defined (COMMONAPI_INTERNAL_COMPILATION) +#define COMMONAPI_INTERNAL_COMPILATION +#endif + +#include <CommonAPI/types.h> + +#undef COMMONAPI_INTERNAL_COMPILATION + +namespace commonapi { +namespace tests { + +class ExtendedInterface: public TestInterface { + public: + virtual ~ExtendedInterface() { } + + static inline const char* getInterfaceId(); + static inline CommonAPI::Version getInterfaceVersion(); +}; + +const char* ExtendedInterface::getInterfaceId() { + static const char* interfaceId = "commonapi.tests.ExtendedInterface"; + return interfaceId; +} + +CommonAPI::Version ExtendedInterface::getInterfaceVersion() { + return CommonAPI::Version(1, 0); +} + + +} // namespace tests +} // namespace commonapi + +namespace CommonAPI { + +} + + +namespace std { + //hashes for types + + //hashes for error types +} + +#endif // COMMONAPI_TESTS_Extended_Interface_H_ diff --git a/src/test/commonapi/tests/ExtendedInterfaceDBusProxy.cpp b/src/test/commonapi/tests/ExtendedInterfaceDBusProxy.cpp new file mode 100644 index 0000000..7daf324 --- /dev/null +++ b/src/test/commonapi/tests/ExtendedInterfaceDBusProxy.cpp @@ -0,0 +1,78 @@ +/* +* This file was generated by the CommonAPI Generators. +* Used org.genivi.commonapi.core 2.1.4.qualifier. +* Used org.franca.core 0.8.10.201309262002. +* +* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. +* If a copy of the MPL was not distributed with this file, You can obtain one at +* http://mozilla.org/MPL/2.0/. +*/ +#include "ExtendedInterfaceDBusProxy.h" + +namespace commonapi { +namespace tests { + +std::shared_ptr<CommonAPI::DBus::DBusProxy> createExtendedInterfaceDBusProxy( + const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, + const std::string& commonApiAddress, + const std::string& interfaceName, + const std::string& busName, + const std::string& objectPath, + const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusProxyConnection) { + return std::make_shared<ExtendedInterfaceDBusProxy>(factory, commonApiAddress, interfaceName, busName, objectPath, dbusProxyConnection); +} + +__attribute__((constructor)) void registerExtendedInterfaceDBusProxy(void) { + CommonAPI::DBus::DBusFactory::registerProxyFactoryMethod(ExtendedInterface::getInterfaceId(), + &createExtendedInterfaceDBusProxy); +} + +ExtendedInterfaceDBusProxy::ExtendedInterfaceDBusProxy( + const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, + const std::string& commonApiAddress, + const std::string& interfaceName, + const std::string& busName, + const std::string& objectPath, + const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusProxyconnection): + TestInterfaceDBusProxy( + factory, + commonApiAddress, + interfaceName, + busName, + objectPath, + dbusProxyconnection), + CommonAPI::DBus::DBusProxy(factory, commonApiAddress, interfaceName, busName, objectPath, dbusProxyconnection) + { + } + + + +void ExtendedInterfaceDBusProxy::TestIntMethodExtended(const uint32_t& inInt, CommonAPI::CallStatus& callStatus) { + CommonAPI::DBus::DBusProxyHelper<CommonAPI::DBus::DBusSerializableArguments<uint32_t>, + CommonAPI::DBus::DBusSerializableArguments<> >::callMethodWithReply( + *this, + "TestIntMethodExtended", + "u", + inInt, + callStatus + ); +} +std::future<CommonAPI::CallStatus> ExtendedInterfaceDBusProxy::TestIntMethodExtendedAsync(const uint32_t& inInt, TestIntMethodExtendedAsyncCallback callback) { + return CommonAPI::DBus::DBusProxyHelper<CommonAPI::DBus::DBusSerializableArguments<uint32_t>, + CommonAPI::DBus::DBusSerializableArguments<> >::callMethodAsync( + *this, + "TestIntMethodExtended", + "u", + inInt, + std::move(callback)); +} + + + +void ExtendedInterfaceDBusProxy::getOwnVersion(uint16_t& ownVersionMajor, uint16_t& ownVersionMinor) const { + ownVersionMajor = 1; + ownVersionMinor = 0; +} + +} // namespace tests +} // namespace commonapi diff --git a/src/test/commonapi/tests/ExtendedInterfaceDBusProxy.h b/src/test/commonapi/tests/ExtendedInterfaceDBusProxy.h new file mode 100644 index 0000000..aa6329c --- /dev/null +++ b/src/test/commonapi/tests/ExtendedInterfaceDBusProxy.h @@ -0,0 +1,62 @@ +/* +* This file was generated by the CommonAPI Generators. +* Used org.genivi.commonapi.core 2.1.4.qualifier. +* Used org.franca.core 0.8.10.201309262002. +* +* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. +* If a copy of the MPL was not distributed with this file, You can obtain one at +* http://mozilla.org/MPL/2.0/. +*/ +#ifndef COMMONAPI_TESTS_Extended_Interface_DBUS_PROXY_H_ +#define COMMONAPI_TESTS_Extended_Interface_DBUS_PROXY_H_ + +#include <commonapi/tests/ExtendedInterfaceProxyBase.h> + +#include <commonapi/tests/TestInterfaceDBusProxy.h> + + +#if !defined (COMMONAPI_INTERNAL_COMPILATION) +#define COMMONAPI_INTERNAL_COMPILATION +#endif + +#include <CommonAPI/DBus/DBusFactory.h> +#include <CommonAPI/DBus/DBusProxy.h> + +#undef COMMONAPI_INTERNAL_COMPILATION + +#include <string> + +namespace commonapi { +namespace tests { + +class ExtendedInterfaceDBusProxy: virtual public ExtendedInterfaceProxyBase, virtual public TestInterfaceDBusProxy { + public: + ExtendedInterfaceDBusProxy( + const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, + const std::string& commonApiAddress, + const std::string& interfaceName, + const std::string& busName, + const std::string& objectPath, + const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusProxyconnection); + + virtual ~ExtendedInterfaceDBusProxy() { } + + + + virtual void TestIntMethodExtended(const uint32_t& inInt, CommonAPI::CallStatus& callStatus); + virtual std::future<CommonAPI::CallStatus> TestIntMethodExtendedAsync(const uint32_t& inInt, TestIntMethodExtendedAsyncCallback callback); + + + virtual void getOwnVersion(uint16_t& ownVersionMajor, uint16_t& ownVersionMinor) const; + + private: + + +}; + + + +} // namespace tests +} // namespace commonapi + +#endif // COMMONAPI_TESTS_Extended_Interface_DBUS_PROXY_H_ diff --git a/src/test/commonapi/tests/ExtendedInterfaceDBusStubAdapter.cpp b/src/test/commonapi/tests/ExtendedInterfaceDBusStubAdapter.cpp new file mode 100644 index 0000000..6a3cb8c --- /dev/null +++ b/src/test/commonapi/tests/ExtendedInterfaceDBusStubAdapter.cpp @@ -0,0 +1,104 @@ + /* + * This file was generated by the CommonAPI Generators. + * Used org.genivi.commonapi.core 2.1.4.qualifier. + * Used org.franca.core 0.8.10.201309262002. + * + * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. + * If a copy of the MPL was not distributed with this file, You can obtain one at + * http://mozilla.org/MPL/2.0/. + */ + #include "ExtendedInterfaceDBusStubAdapter.h" + #include <commonapi/tests/ExtendedInterface.h> + + namespace commonapi { + namespace tests { + + std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> createExtendedInterfaceDBusStubAdapter( + const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, + const std::string& commonApiAddress, + const std::string& interfaceName, + const std::string& busName, + const std::string& objectPath, + const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusProxyConnection, + const std::shared_ptr<CommonAPI::StubBase>& stubBase) { + return std::make_shared<ExtendedInterfaceDBusStubAdapter>(factory, commonApiAddress, interfaceName, busName, objectPath, dbusProxyConnection, stubBase); + } + + __attribute__((constructor)) void registerExtendedInterfaceDBusStubAdapter(void) { + CommonAPI::DBus::DBusFactory::registerAdapterFactoryMethod(ExtendedInterface::getInterfaceId(), + &createExtendedInterfaceDBusStubAdapter); + } + + + + ExtendedInterfaceDBusStubAdapterInternal::~ExtendedInterfaceDBusStubAdapterInternal() { + deactivateManagedInstances(); + ExtendedInterfaceDBusStubAdapterHelper::deinit(); + ExtendedInterfaceDBusStubAdapterHelper::stub_.reset(); + } + + void ExtendedInterfaceDBusStubAdapterInternal::deactivateManagedInstances() { + } + + const char* ExtendedInterfaceDBusStubAdapterInternal::getMethodsDBusIntrospectionXmlData() const { + static const std::string introspectionData = + std::string(TestInterfaceDBusStubAdapterInternal::getMethodsDBusIntrospectionXmlData()) + + "<method name=\"TestIntMethodExtended\">\n" + "<arg name=\"inInt\" type=\"u\" direction=\"in\" />\n" + "</method>\n" + + ; + return introspectionData.c_str(); + } + + + static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< + ExtendedInterfaceStub, + std::tuple<uint32_t>, + std::tuple<> + > testIntMethodExtendedStubDispatcher(&ExtendedInterfaceStub::TestIntMethodExtended, ""); + + + + const ExtendedInterfaceDBusStubAdapterHelper::StubDispatcherTable& ExtendedInterfaceDBusStubAdapterInternal::getStubDispatcherTable() { + return stubDispatcherTable_; + } + + + ExtendedInterfaceDBusStubAdapterInternal::ExtendedInterfaceDBusStubAdapterInternal( + const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, + const std::string& commonApiAddress, + const std::string& dbusInterfaceName, + const std::string& dbusBusName, + const std::string& dbusObjectPath, + const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection, + const std::shared_ptr<CommonAPI::StubBase>& stub): + CommonAPI::DBus::DBusStubAdapter( + factory, + commonApiAddress, + dbusInterfaceName, + dbusBusName, + dbusObjectPath, + dbusConnection, + false), + ExtendedInterfaceDBusStubAdapterHelper(factory, commonApiAddress, dbusInterfaceName, dbusBusName, dbusObjectPath, + dbusConnection, std::dynamic_pointer_cast<ExtendedInterfaceStub>(stub), + false), + TestInterfaceDBusStubAdapterInternal( + factory, + commonApiAddress, + dbusInterfaceName, + dbusBusName, + dbusObjectPath, + dbusConnection, + stub), + stubDispatcherTable_({ + { { "TestIntMethodExtended", "u" }, &commonapi::tests::testIntMethodExtendedStubDispatcher } + }) { + + auto parentDispatcherTable = TestInterfaceDBusStubAdapterInternal::getStubDispatcherTable(); + stubDispatcherTable_.insert(parentDispatcherTable.begin(), parentDispatcherTable.end()); + } + + } // namespace tests + } // namespace commonapi diff --git a/src/test/commonapi/tests/ExtendedInterfaceDBusStubAdapter.h b/src/test/commonapi/tests/ExtendedInterfaceDBusStubAdapter.h new file mode 100644 index 0000000..a708e03 --- /dev/null +++ b/src/test/commonapi/tests/ExtendedInterfaceDBusStubAdapter.h @@ -0,0 +1,120 @@ +/* +* This file was generated by the CommonAPI Generators. +* Used org.genivi.commonapi.core 2.1.4.qualifier. +* Used org.franca.core 0.8.10.201309262002. +* +* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. +* If a copy of the MPL was not distributed with this file, You can obtain one at +* http://mozilla.org/MPL/2.0/. +*/ +#ifndef COMMONAPI_TESTS_Extended_Interface_DBUS_STUB_ADAPTER_H_ +#define COMMONAPI_TESTS_Extended_Interface_DBUS_STUB_ADAPTER_H_ + +#include <commonapi/tests/ExtendedInterfaceStub.h> + +#include <commonapi/tests/TestInterfaceDBusStubAdapter.h> + +#if !defined (COMMONAPI_INTERNAL_COMPILATION) +#define COMMONAPI_INTERNAL_COMPILATION +#endif + +#include <CommonAPI/DBus/DBusStubAdapterHelper.h> +#include <CommonAPI/DBus/DBusStubAdapter.h> +#include <CommonAPI/DBus/DBusFactory.h> +#include <CommonAPI/DBus/DBusServicePublisher.h> + +#undef COMMONAPI_INTERNAL_COMPILATION + +namespace commonapi { +namespace tests { + +typedef CommonAPI::DBus::DBusStubAdapterHelper<ExtendedInterfaceStub> ExtendedInterfaceDBusStubAdapterHelper; + +class ExtendedInterfaceDBusStubAdapterInternal: public ExtendedInterfaceStubAdapter, public ExtendedInterfaceDBusStubAdapterHelper, public TestInterfaceDBusStubAdapterInternal { + public: + ExtendedInterfaceDBusStubAdapterInternal( + const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, + const std::string& commonApiAddress, + const std::string& dbusInterfaceName, + const std::string& dbusBusName, + const std::string& dbusObjectPath, + const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection, + const std::shared_ptr<CommonAPI::StubBase>& stub); + + ~ExtendedInterfaceDBusStubAdapterInternal(); + + + + + const ExtendedInterfaceDBusStubAdapterHelper::StubDispatcherTable& getStubDispatcherTable(); + + void deactivateManagedInstances(); + + virtual const std::string getAddress() const { + return DBusStubAdapter::getAddress(); + } + + virtual const std::string& getDomain() const { + return DBusStubAdapter::getDomain(); + } + + virtual const std::string& getServiceId() const { + return DBusStubAdapter::getServiceId(); + } + + virtual const std::string& getInstanceId() const { + return DBusStubAdapter::getInstanceId(); + } + + virtual void init(std::shared_ptr<DBusStubAdapter> instance) { + return DBusStubAdapter::init(instance); + } + + + virtual void deinit() { + return DBusStubAdapter::deinit(); + } + + virtual bool onInterfaceDBusMessage(const CommonAPI::DBus::DBusMessage& dbusMessage) { + return ExtendedInterfaceDBusStubAdapterHelper::onInterfaceDBusMessage(dbusMessage); + } + + protected: + virtual const char* getMethodsDBusIntrospectionXmlData() const; + + private: + ExtendedInterfaceDBusStubAdapterHelper::StubDispatcherTable stubDispatcherTable_; +}; + +class ExtendedInterfaceDBusStubAdapter: public ExtendedInterfaceDBusStubAdapterInternal, public std::enable_shared_from_this<ExtendedInterfaceDBusStubAdapter> { +public: + ExtendedInterfaceDBusStubAdapter( + const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, + const std::string& commonApiAddress, + const std::string& dbusInterfaceName, + const std::string& dbusBusName, + const std::string& dbusObjectPath, + const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection, + const std::shared_ptr<CommonAPI::StubBase>& stub) : + CommonAPI::DBus::DBusStubAdapter( + factory, + commonApiAddress, + dbusInterfaceName, + dbusBusName, + dbusObjectPath, + dbusConnection, + false), + ExtendedInterfaceDBusStubAdapterInternal( + factory, + commonApiAddress, + dbusInterfaceName, + dbusBusName, + dbusObjectPath, + dbusConnection, + stub) { } +}; + +} // namespace tests +} // namespace commonapi + +#endif // COMMONAPI_TESTS_Extended_Interface_DBUS_STUB_ADAPTER_H_ diff --git a/src/test/commonapi/tests/ExtendedInterfaceProxy.h b/src/test/commonapi/tests/ExtendedInterfaceProxy.h new file mode 100644 index 0000000..d2c79a5 --- /dev/null +++ b/src/test/commonapi/tests/ExtendedInterfaceProxy.h @@ -0,0 +1,182 @@ +/* +* This file was generated by the CommonAPI Generators. +* Used org.genivi.commonapi.core 2.1.4.qualifier. +* Used org.franca.core 0.8.10.201309262002. +* +* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. +* If a copy of the MPL was not distributed with this file, You can obtain one at +* http://mozilla.org/MPL/2.0/. +*/ +#ifndef COMMONAPI_TESTS_Extended_Interface_PROXY_H_ +#define COMMONAPI_TESTS_Extended_Interface_PROXY_H_ + +#include "ExtendedInterfaceProxyBase.h" + +#include "TestInterfaceProxy.h" + +#if !defined (COMMONAPI_INTERNAL_COMPILATION) +#define COMMONAPI_INTERNAL_COMPILATION +#endif + + +#undef COMMONAPI_INTERNAL_COMPILATION + +namespace commonapi { +namespace tests { + +template <typename ... _AttributeExtensions> +class ExtendedInterfaceProxy: virtual public ExtendedInterface, virtual public ExtendedInterfaceProxyBase +, virtual public TestInterfaceProxy<_AttributeExtensions...> +, public _AttributeExtensions... { +public: + ExtendedInterfaceProxy(std::shared_ptr<CommonAPI::Proxy> delegate); + ~ExtendedInterfaceProxy(); + + typedef ExtendedInterface InterfaceType; + + inline static const char* getInterfaceId() { + return(ExtendedInterface::getInterfaceId()); + } + + + + /** + * Calls TestIntMethodExtended with synchronous semantics. + * + * All const parameters are input parameters to this method. + * The CallStatus will be filled when the method returns and indicate either + * "SUCCESS" or which type of error has occurred. In case of an error, ONLY the CallStatus + * will be set. + */ + virtual void TestIntMethodExtended(const uint32_t& inInt, CommonAPI::CallStatus& callStatus); + /** + * Calls TestIntMethodExtended with asynchronous semantics. + * + * The provided callback will be called when the reply to this call arrives or + * an error occurs during the call. The CallStatus will indicate either "SUCCESS" + * or which type of error has occurred. In case of any error, ONLY the CallStatus + * will have a defined value. + * The std::future returned by this method will be fulfilled at arrival of the reply. + * It will provide the same value for CallStatus as will be handed to the callback. + */ + virtual std::future<CommonAPI::CallStatus> TestIntMethodExtendedAsync(const uint32_t& inInt, TestIntMethodExtendedAsyncCallback callback); + + + /** + * Returns the CommonAPI address of the remote partner this proxy communicates with. + */ + virtual std::string getAddress() const; + + /** + * Returns the domain of the remote partner this proxy communicates with. + */ + virtual const std::string& getDomain() const; + + /** + * Returns the service ID of the remote partner this proxy communicates with. + */ + virtual const std::string& getServiceId() const; + + /** + * Returns the instance ID of the remote partner this proxy communicates with. + */ + virtual const std::string& getInstanceId() const; + + /** + * Returns true if the remote partner for this proxy is currently known to be available. + */ + virtual bool isAvailable() const; + + /** + * Returns true if the remote partner for this proxy is available. + */ + virtual bool isAvailableBlocking() const; + + /** + * Returns the wrapper class that is used to (de-)register for notifications about + * the availability of the remote partner of this proxy. + */ + virtual CommonAPI::ProxyStatusEvent& getProxyStatusEvent(); + + /** + * Returns the wrapper class that is used to access version information of the remote + * partner of this proxy. + */ + virtual CommonAPI::InterfaceVersionAttribute& getInterfaceVersionAttribute(); + + private: + std::shared_ptr<ExtendedInterfaceProxyBase> delegate_; +}; + + +// +// ExtendedInterfaceProxy Implementation +// +template <typename ... _AttributeExtensions> +ExtendedInterfaceProxy<_AttributeExtensions...>::ExtendedInterfaceProxy(std::shared_ptr<CommonAPI::Proxy> delegate): + TestInterfaceProxy<_AttributeExtensions...>(delegate), + delegate_(std::dynamic_pointer_cast<ExtendedInterfaceProxyBase>(delegate)), + _AttributeExtensions(*(std::dynamic_pointer_cast<ExtendedInterfaceProxyBase>(delegate)))... { +} + +template <typename ... _AttributeExtensions> +ExtendedInterfaceProxy<_AttributeExtensions...>::~ExtendedInterfaceProxy() { +} + +template <typename ... _AttributeExtensions> +void ExtendedInterfaceProxy<_AttributeExtensions...>::TestIntMethodExtended(const uint32_t& inInt, CommonAPI::CallStatus& callStatus) { + delegate_->TestIntMethodExtended(inInt, callStatus); +} + +template <typename ... _AttributeExtensions> +std::future<CommonAPI::CallStatus> ExtendedInterfaceProxy<_AttributeExtensions...>::TestIntMethodExtendedAsync(const uint32_t& inInt, TestIntMethodExtendedAsyncCallback callback) { + return delegate_->TestIntMethodExtendedAsync(inInt, callback); +} + +template <typename ... _AttributeExtensions> +std::string ExtendedInterfaceProxy<_AttributeExtensions...>::getAddress() const { + return delegate_->getAddress(); +} + +template <typename ... _AttributeExtensions> +const std::string& ExtendedInterfaceProxy<_AttributeExtensions...>::getDomain() const { + return delegate_->getDomain(); +} + +template <typename ... _AttributeExtensions> +const std::string& ExtendedInterfaceProxy<_AttributeExtensions...>::getServiceId() const { + return delegate_->getServiceId(); +} + +template <typename ... _AttributeExtensions> +const std::string& ExtendedInterfaceProxy<_AttributeExtensions...>::getInstanceId() const { + return delegate_->getInstanceId(); +} + +template <typename ... _AttributeExtensions> +bool ExtendedInterfaceProxy<_AttributeExtensions...>::isAvailable() const { + return delegate_->isAvailable(); +} + +template <typename ... _AttributeExtensions> +bool ExtendedInterfaceProxy<_AttributeExtensions...>::isAvailableBlocking() const { + return delegate_->isAvailableBlocking(); +} + +template <typename ... _AttributeExtensions> +CommonAPI::ProxyStatusEvent& ExtendedInterfaceProxy<_AttributeExtensions...>::getProxyStatusEvent() { + return delegate_->getProxyStatusEvent(); +} + +template <typename ... _AttributeExtensions> +CommonAPI::InterfaceVersionAttribute& ExtendedInterfaceProxy<_AttributeExtensions...>::getInterfaceVersionAttribute() { + return delegate_->getInterfaceVersionAttribute(); +} + + + +} // namespace tests +} // namespace commonapi + + +#endif // COMMONAPI_TESTS_Extended_Interface_PROXY_H_ diff --git a/src/test/commonapi/tests/ExtendedInterfaceProxyBase.h b/src/test/commonapi/tests/ExtendedInterfaceProxyBase.h new file mode 100644 index 0000000..0cf2e50 --- /dev/null +++ b/src/test/commonapi/tests/ExtendedInterfaceProxyBase.h @@ -0,0 +1,48 @@ +/* +* This file was generated by the CommonAPI Generators. +* Used org.genivi.commonapi.core 2.1.4.qualifier. +* Used org.franca.core 0.8.10.201309262002. +* +* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. +* If a copy of the MPL was not distributed with this file, You can obtain one at +* http://mozilla.org/MPL/2.0/. +*/ +#ifndef COMMONAPI_TESTS_Extended_Interface_PROXY_BASE_H_ +#define COMMONAPI_TESTS_Extended_Interface_PROXY_BASE_H_ + +#include "ExtendedInterface.h" + +#include "TestInterfaceProxyBase.h" + + + +#if !defined (COMMONAPI_INTERNAL_COMPILATION) +#define COMMONAPI_INTERNAL_COMPILATION +#endif + +#include <vector> + +#include <CommonAPI/Proxy.h> +#include <functional> +#include <future> + +#undef COMMONAPI_INTERNAL_COMPILATION + +namespace commonapi { +namespace tests { + +class ExtendedInterfaceProxyBase: virtual public TestInterfaceProxyBase { + public: + + typedef std::function<void(const CommonAPI::CallStatus&)> TestIntMethodExtendedAsyncCallback; + + + + virtual void TestIntMethodExtended(const uint32_t& inInt, CommonAPI::CallStatus& callStatus) = 0; + virtual std::future<CommonAPI::CallStatus> TestIntMethodExtendedAsync(const uint32_t& inInt, TestIntMethodExtendedAsyncCallback callback) = 0; +}; + +} // namespace tests +} // namespace commonapi + +#endif // COMMONAPI_TESTS_Extended_Interface_PROXY_BASE_H_ diff --git a/src/test/commonapi/tests/ExtendedInterfaceStub.h b/src/test/commonapi/tests/ExtendedInterfaceStub.h new file mode 100644 index 0000000..a4f96ea --- /dev/null +++ b/src/test/commonapi/tests/ExtendedInterfaceStub.h @@ -0,0 +1,96 @@ +/* +* This file was generated by the CommonAPI Generators. +* Used org.genivi.commonapi.core 2.1.4.qualifier. +* Used org.franca.core 0.8.10.201309262002. +* +* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. +* If a copy of the MPL was not distributed with this file, You can obtain one at +* http://mozilla.org/MPL/2.0/. +*/ +#ifndef COMMONAPI_TESTS_Extended_Interface_STUB_H_ +#define COMMONAPI_TESTS_Extended_Interface_STUB_H_ + + + +#include <commonapi/tests/TestInterfaceStub.h> + +#include "ExtendedInterface.h" + +#if !defined (COMMONAPI_INTERNAL_COMPILATION) +#define COMMONAPI_INTERNAL_COMPILATION +#endif + +#include <vector> + +#include <CommonAPI/Stub.h> + +#undef COMMONAPI_INTERNAL_COMPILATION + +namespace commonapi { +namespace tests { + +/** + * Receives messages from remote and handles all dispatching of deserialized calls + * to a stub for the service ExtendedInterface. Also provides means to send broadcasts + * and attribute-changed-notifications of observable attributes as defined by this service. + * An application developer should not need to bother with this class. + */ +class ExtendedInterfaceStubAdapter: virtual public CommonAPI::StubAdapter, public ExtendedInterface { + public: + + + + virtual void deactivateManagedInstances() = 0; + +protected: + /** + * Defines properties for storing the ClientIds of clients / proxies that have + * subscribed to the selective broadcasts + */ +}; + + +/** + * Defines the necessary callbacks to handle remote set events related to the attributes + * defined in the IDL description for ExtendedInterface. + * For each attribute two callbacks are defined: + * - a verification callback that allows to verify the requested value and to prevent setting + * e.g. an invalid value ("onRemoteSet<AttributeName>"). + * - an action callback to do local work after the attribute value has been changed + * ("onRemote<AttributeName>Changed"). + * + * This class and the one below are the ones an application developer needs to have + * a look at if he wants to implement a service. + */ +class ExtendedInterfaceStubRemoteEvent { + public: + virtual ~ExtendedInterfaceStubRemoteEvent() { } + +}; + + +/** + * Defines the interface that must be implemented by any class that should provide + * the service ExtendedInterface to remote clients. + * This class and the one above are the ones an application developer needs to have + * a look at if he wants to implement a service. + */ +class ExtendedInterfaceStub : public virtual CommonAPI::Stub<ExtendedInterfaceStubAdapter, ExtendedInterfaceStubRemoteEvent>, public virtual TestInterfaceStub { +public: + virtual ~ExtendedInterfaceStub() { } + + + /// This is the method that will be called on remote calls on the method TestIntMethodExtended. + virtual void TestIntMethodExtended(const std::shared_ptr<CommonAPI::ClientId> clientId, uint32_t inInt) = 0; + + + using CommonAPI::Stub<ExtendedInterfaceStubAdapter, ExtendedInterfaceStubRemoteEvent>::initStubAdapter; + typedef CommonAPI::Stub<ExtendedInterfaceStubAdapter, ExtendedInterfaceStubRemoteEvent>::StubAdapterType StubAdapterType; + typedef CommonAPI::Stub<ExtendedInterfaceStubAdapter, ExtendedInterfaceStubRemoteEvent>::RemoteEventHandlerType RemoteEventHandlerType; + +}; + +} // namespace tests +} // namespace commonapi + +#endif // COMMONAPI_TESTS_Extended_Interface_STUB_H_ diff --git a/src/test/commonapi/tests/ExtendedInterfaceStubDefault.cpp b/src/test/commonapi/tests/ExtendedInterfaceStubDefault.cpp new file mode 100644 index 0000000..4c5a179 --- /dev/null +++ b/src/test/commonapi/tests/ExtendedInterfaceStubDefault.cpp @@ -0,0 +1,41 @@ +/* +* This file was generated by the CommonAPI Generators. +* Used org.genivi.commonapi.core 2.1.4.qualifier. +* Used org.franca.core 0.8.10.201309262002. +* +* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. +* If a copy of the MPL was not distributed with this file, You can obtain one at +* http://mozilla.org/MPL/2.0/. +*/ +#include <commonapi/tests/ExtendedInterfaceStubDefault.h> + +namespace commonapi { +namespace tests { + +ExtendedInterfaceStubDefault::ExtendedInterfaceStubDefault(): + remoteEventHandler_(this) { +} + +ExtendedInterfaceStubRemoteEvent* ExtendedInterfaceStubDefault::initStubAdapter(const std::shared_ptr<ExtendedInterfaceStubAdapter>& stubAdapter) { + CommonAPI::Stub<ExtendedInterfaceStubAdapter, ExtendedInterfaceStubRemoteEvent>::stubAdapter_ = stubAdapter; + return &remoteEventHandler_; +} + + +void ExtendedInterfaceStubDefault::TestIntMethodExtended(const std::shared_ptr<CommonAPI::ClientId> clientId, uint32_t inInt) { + // Call old style methods in default + TestIntMethodExtended(inInt); +} +void ExtendedInterfaceStubDefault::TestIntMethodExtended(uint32_t inInt) { + // No operation in default +} + + + + +ExtendedInterfaceStubDefault::RemoteEventHandler::RemoteEventHandler(ExtendedInterfaceStubDefault* defaultStub): + defaultStub_(defaultStub) { +} + +} // namespace tests +} // namespace commonapi diff --git a/src/test/commonapi/tests/ExtendedInterfaceStubDefault.h b/src/test/commonapi/tests/ExtendedInterfaceStubDefault.h new file mode 100644 index 0000000..5a0124e --- /dev/null +++ b/src/test/commonapi/tests/ExtendedInterfaceStubDefault.h @@ -0,0 +1,62 @@ +/* +* This file was generated by the CommonAPI Generators. +* Used org.genivi.commonapi.core 2.1.4.qualifier. +* Used org.franca.core 0.8.10.201309262002. +* +* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. +* If a copy of the MPL was not distributed with this file, You can obtain one at +* http://mozilla.org/MPL/2.0/. +*/ +#ifndef COMMONAPI_TESTS_Extended_Interface_STUB_DEFAULT_H_ +#define COMMONAPI_TESTS_Extended_Interface_STUB_DEFAULT_H_ + +#include <commonapi/tests/TestInterfaceStubDefault.h> + +#include <commonapi/tests/ExtendedInterfaceStub.h> +#include <sstream> + +namespace commonapi { +namespace tests { + +/** + * Provides a default implementation for ExtendedInterfaceStubRemoteEvent and + * ExtendedInterfaceStub. Method callbacks have an empty implementation, + * remote set calls on attributes will always change the value of the attribute + * to the one received. + * + * Override this stub if you only want to provide a subset of the functionality + * that would be defined for this service, and/or if you do not need any non-default + * behaviour. + */ +class ExtendedInterfaceStubDefault : public virtual ExtendedInterfaceStub, public virtual TestInterfaceStubDefault { +public: + ExtendedInterfaceStubDefault(); + + ExtendedInterfaceStubRemoteEvent* initStubAdapter(const std::shared_ptr<ExtendedInterfaceStubAdapter>& stubAdapter); + + + virtual void TestIntMethodExtended(const std::shared_ptr<CommonAPI::ClientId> clientId, uint32_t inInt); + virtual void TestIntMethodExtended(uint32_t inInt); + + + + +protected: +private: + class RemoteEventHandler: public ExtendedInterfaceStubRemoteEvent { + public: + RemoteEventHandler(ExtendedInterfaceStubDefault* defaultStub); + + + private: + ExtendedInterfaceStubDefault* defaultStub_; + }; + + RemoteEventHandler remoteEventHandler_; + +}; + +} // namespace tests +} // namespace commonapi + +#endif // COMMONAPI_TESTS_Extended_Interface_STUB_DEFAULT_H_ diff --git a/src/test/commonapi/tests/TestInterfaceDBusProxy.cpp b/src/test/commonapi/tests/TestInterfaceDBusProxy.cpp index aa28d09..95169d9 100644 --- a/src/test/commonapi/tests/TestInterfaceDBusProxy.cpp +++ b/src/test/commonapi/tests/TestInterfaceDBusProxy.cpp @@ -219,7 +219,7 @@ void TestInterfaceDBusProxy::TestStructWithEnumKeyMapMember(const DerivedTypeCol CommonAPI::DBus::DBusSerializableArguments<> >::callMethodWithReply( *this, "TestStructWithEnumKeyMapMember", - "(a{is})", + "(ua{is})", inStruct, callStatus ); @@ -229,7 +229,7 @@ std::future<CommonAPI::CallStatus> TestInterfaceDBusProxy::TestStructWithEnumKey CommonAPI::DBus::DBusSerializableArguments<> >::callMethodAsync( *this, "TestStructWithEnumKeyMapMember", - "(a{is})", + "(ua{is})", inStruct, std::move(callback)); } diff --git a/src/test/commonapi/tests/TestInterfaceDBusProxy.h b/src/test/commonapi/tests/TestInterfaceDBusProxy.h index bef16fc..01bb38a 100644 --- a/src/test/commonapi/tests/TestInterfaceDBusProxy.h +++ b/src/test/commonapi/tests/TestInterfaceDBusProxy.h @@ -12,6 +12,8 @@ #include <commonapi/tests/TestInterfaceProxyBase.h> + + #if !defined (COMMONAPI_INTERNAL_COMPILATION) #define COMMONAPI_INTERNAL_COMPILATION #endif diff --git a/src/test/commonapi/tests/TestInterfaceDBusStubAdapter.cpp b/src/test/commonapi/tests/TestInterfaceDBusStubAdapter.cpp index de5e112..230dfc3 100644 --- a/src/test/commonapi/tests/TestInterfaceDBusStubAdapter.cpp +++ b/src/test/commonapi/tests/TestInterfaceDBusStubAdapter.cpp @@ -1,3 +1,4 @@ +<<<<<<< Upstream, based on origin/master /* * This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. @@ -9,21 +10,35 @@ */ #include "TestInterfaceDBusStubAdapter.h" #include <commonapi/tests/TestInterface.h> - -namespace commonapi { -namespace tests { - -std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> createTestInterfaceDBusStubAdapter( - const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, - const std::string& commonApiAddress, - const std::string& interfaceName, - const std::string& busName, - const std::string& objectPath, - const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusProxyConnection, - const std::shared_ptr<CommonAPI::StubBase>& stubBase) { - return std::make_shared<TestInterfaceDBusStubAdapter>(factory, commonApiAddress, interfaceName, busName, objectPath, dbusProxyConnection, stubBase); -} - +======= + /* + * This file was generated by the CommonAPI Generators. + * Used org.genivi.commonapi.core 2.1.4.qualifier. + * Used org.franca.core 0.8.10.201309262002. + * + * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. + * If a copy of the MPL was not distributed with this file, You can obtain one at + * http://mozilla.org/MPL/2.0/. + */ + #include "TestInterfaceDBusStubAdapter.h" + #include <commonapi/tests/TestInterface.h> +>>>>>>> 555557d Fix for inherited interfaces and tests for that including generated code + + namespace commonapi { + namespace tests { + + std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> createTestInterfaceDBusStubAdapter( + const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, + const std::string& commonApiAddress, + const std::string& interfaceName, + const std::string& busName, + const std::string& objectPath, + const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusProxyConnection, + const std::shared_ptr<CommonAPI::StubBase>& stubBase) { + return std::make_shared<TestInterfaceDBusStubAdapter>(factory, commonApiAddress, interfaceName, busName, objectPath, dbusProxyConnection, stubBase); + } + +<<<<<<< Upstream, based on origin/master __attribute__((constructor)) void registerTestInterfaceDBusStubAdapter(void) { CommonAPI::DBus::DBusFactory::registerAdapterFactoryMethod(TestInterface::getInterfaceId(), &createTestInterfaceDBusStubAdapter); @@ -136,55 +151,153 @@ const char* TestInterfaceDBusStubAdapter::getMethodsDBusIntrospectionXmlData() c ; return introspectionData; } +======= + __attribute__((constructor)) void registerTestInterfaceDBusStubAdapter(void) { + CommonAPI::DBus::DBusFactory::registerAdapterFactoryMethod(TestInterface::getInterfaceId(), + &createTestInterfaceDBusStubAdapter); + } +>>>>>>> 555557d Fix for inherited interfaces and tests for that including generated code static CommonAPI::DBus::DBusGetAttributeStubDispatcher< TestInterfaceStub, CommonAPI::Version > getInterfaceVersionStubDispatcher(&TestInterfaceStub::getInterfaceVersion, "uu"); -static CommonAPI::DBus::DBusGetAttributeStubDispatcher< - TestInterfaceStub, - uint32_t - > getTestPredefinedTypeAttributeAttributeStubDispatcher(&TestInterfaceStub::getTestPredefinedTypeAttributeAttribute, "u"); -static CommonAPI::DBus::DBusSetObservableAttributeStubDispatcher< - TestInterfaceStub, - uint32_t - > setTestPredefinedTypeAttributeAttributeStubDispatcher( - &TestInterfaceStub::getTestPredefinedTypeAttributeAttribute, - &TestInterfaceStubRemoteEvent::onRemoteSetTestPredefinedTypeAttributeAttribute, - &TestInterfaceStubRemoteEvent::onRemoteTestPredefinedTypeAttributeAttributeChanged, - &TestInterfaceStubAdapter::fireTestPredefinedTypeAttributeAttributeChanged, - "u"); - -static CommonAPI::DBus::DBusGetAttributeStubDispatcher< - TestInterfaceStub, - DerivedTypeCollection::TestStructExtended - > getTestDerivedStructAttributeAttributeStubDispatcher(&TestInterfaceStub::getTestDerivedStructAttributeAttribute, "(sqi)"); -static CommonAPI::DBus::DBusSetObservableAttributeStubDispatcher< - TestInterfaceStub, - DerivedTypeCollection::TestStructExtended - > setTestDerivedStructAttributeAttributeStubDispatcher( - &TestInterfaceStub::getTestDerivedStructAttributeAttribute, - &TestInterfaceStubRemoteEvent::onRemoteSetTestDerivedStructAttributeAttribute, - &TestInterfaceStubRemoteEvent::onRemoteTestDerivedStructAttributeAttributeChanged, - &TestInterfaceStubAdapter::fireTestDerivedStructAttributeAttributeChanged, - "(sqi)"); - -static CommonAPI::DBus::DBusGetAttributeStubDispatcher< - TestInterfaceStub, - DerivedTypeCollection::TestArrayUInt64 - > getTestDerivedArrayAttributeAttributeStubDispatcher(&TestInterfaceStub::getTestDerivedArrayAttributeAttribute, "at"); -static CommonAPI::DBus::DBusSetObservableAttributeStubDispatcher< - TestInterfaceStub, - DerivedTypeCollection::TestArrayUInt64 - > setTestDerivedArrayAttributeAttributeStubDispatcher( - &TestInterfaceStub::getTestDerivedArrayAttributeAttribute, - &TestInterfaceStubRemoteEvent::onRemoteSetTestDerivedArrayAttributeAttribute, - &TestInterfaceStubRemoteEvent::onRemoteTestDerivedArrayAttributeAttributeChanged, - &TestInterfaceStubAdapter::fireTestDerivedArrayAttributeAttributeChanged, - "at"); - + TestInterfaceDBusStubAdapterInternal::~TestInterfaceDBusStubAdapterInternal() { + deactivateManagedInstances(); + TestInterfaceDBusStubAdapterHelper::deinit(); + TestInterfaceDBusStubAdapterHelper::stub_.reset(); + } + + void TestInterfaceDBusStubAdapterInternal::deactivateManagedInstances() { + } + + const char* TestInterfaceDBusStubAdapterInternal::getMethodsDBusIntrospectionXmlData() const { + static const std::string introspectionData = + "<method name=\"getTestPredefinedTypeAttributeAttribute\">\n" + "<arg name=\"value\" type=\"u\" direction=\"out\" />" + "</method>\n" + "<method name=\"setTestPredefinedTypeAttributeAttribute\">\n" + "<arg name=\"requestedValue\" type=\"u\" direction=\"in\" />\n" + "<arg name=\"setValue\" type=\"u\" direction=\"out\" />\n" + "</method>\n" + "<signal name=\"onTestPredefinedTypeAttributeAttributeChanged\">\n" + "<arg name=\"changedValue\" type=\"u\" />\n" + "</signal>\n" + "<method name=\"getTestDerivedStructAttributeAttribute\">\n" + "<arg name=\"value\" type=\"(sqi)\" direction=\"out\" />" + "</method>\n" + "<method name=\"setTestDerivedStructAttributeAttribute\">\n" + "<arg name=\"requestedValue\" type=\"(sqi)\" direction=\"in\" />\n" + "<arg name=\"setValue\" type=\"(sqi)\" direction=\"out\" />\n" + "</method>\n" + "<signal name=\"onTestDerivedStructAttributeAttributeChanged\">\n" + "<arg name=\"changedValue\" type=\"(sqi)\" />\n" + "</signal>\n" + "<method name=\"getTestDerivedArrayAttributeAttribute\">\n" + "<arg name=\"value\" type=\"at\" direction=\"out\" />" + "</method>\n" + "<method name=\"setTestDerivedArrayAttributeAttribute\">\n" + "<arg name=\"requestedValue\" type=\"at\" direction=\"in\" />\n" + "<arg name=\"setValue\" type=\"at\" direction=\"out\" />\n" + "</method>\n" + "<signal name=\"onTestDerivedArrayAttributeAttributeChanged\">\n" + "<arg name=\"changedValue\" type=\"at\" />\n" + "</signal>\n" + "<signal name=\"TestPredefinedTypeBroadcast\">\n" + "<arg name=\"uint32Value\" type=\"u\" />\n" + "<arg name=\"stringValue\" type=\"s\" />\n" + "</signal>\n" + "<signal name=\"TestSelectiveBroadcast\">\n" + "</signal>\n" + "<signal name=\"TestBroadcastWithOutArgs\">\n" + "<arg name=\"uint32Value\" type=\"u\" />\n" + "<arg name=\"stringValue\" type=\"s\" />\n" + "</signal>\n" + "<method name=\"testEmptyMethod\">\n" + "</method>\n" + "<method name=\"testVoidPredefinedTypeMethod\">\n" + "<arg name=\"uint32Value\" type=\"u\" direction=\"in\" />\n" + "<arg name=\"stringValue\" type=\"s\" direction=\"in\" />\n" + "</method>\n" + "<method name=\"testPredefinedTypeMethod\">\n" + "<arg name=\"uint32InValue\" type=\"u\" direction=\"in\" />\n" + "<arg name=\"stringInValue\" type=\"s\" direction=\"in\" />\n" + "<arg name=\"uint32OutValue\" type=\"u\" direction=\"out\" />\n" + "<arg name=\"stringOutValue\" type=\"s\" direction=\"out\" />\n" + "</method>\n" + "<method name=\"testVoidDerivedTypeMethod\">\n" + "<arg name=\"testEnumExtended2Value\" type=\"i\" direction=\"in\" />\n" + "<arg name=\"testMapValue\" type=\"a{ua(sq)}\" direction=\"in\" />\n" + "</method>\n" + "<method name=\"testDerivedTypeMethod\">\n" + "<arg name=\"testEnumExtended2InValue\" type=\"i\" direction=\"in\" />\n" + "<arg name=\"testMapInValue\" type=\"a{ua(sq)}\" direction=\"in\" />\n" + "<arg name=\"testEnumExtended2OutValue\" type=\"i\" direction=\"out\" />\n" + "<arg name=\"testMapOutValue\" type=\"a{ua(sq)}\" direction=\"out\" />\n" + "</method>\n" + "<method name=\"TestArrayOfPolymorphicStructMethod\">\n" + "<arg name=\"inArray\" type=\"a(uv)\" direction=\"in\" />\n" + "</method>\n" + "<method name=\"TestMapOfPolymorphicStructMethod\">\n" + "<arg name=\"inMap\" type=\"a{y(uv)}\" direction=\"in\" />\n" + "</method>\n" + "<method name=\"TestStructWithPolymorphicMemberMethod\">\n" + "<arg name=\"inStruct\" type=\"(u(uv))\" direction=\"in\" />\n" + "</method>\n" + "<method name=\"TestStructWithEnumKeyMapMember\">\n" + "<arg name=\"inStruct\" type=\"(ua{is})\" direction=\"in\" />\n" + "</method>\n" + + ; + return introspectionData.c_str(); + } + + static CommonAPI::DBus::DBusGetAttributeStubDispatcher< + TestInterfaceStub, + uint32_t + > getTestPredefinedTypeAttributeAttributeStubDispatcher(&TestInterfaceStub::getTestPredefinedTypeAttributeAttribute, "u"); + static CommonAPI::DBus::DBusSetObservableAttributeStubDispatcher< + TestInterfaceStub, + uint32_t + > setTestPredefinedTypeAttributeAttributeStubDispatcher( + &TestInterfaceStub::getTestPredefinedTypeAttributeAttribute, + &TestInterfaceStubRemoteEvent::onRemoteSetTestPredefinedTypeAttributeAttribute, + &TestInterfaceStubRemoteEvent::onRemoteTestPredefinedTypeAttributeAttributeChanged, + &TestInterfaceStubAdapter::fireTestPredefinedTypeAttributeAttributeChanged, + "u"); + + static CommonAPI::DBus::DBusGetAttributeStubDispatcher< + TestInterfaceStub, + DerivedTypeCollection::TestStructExtended + > getTestDerivedStructAttributeAttributeStubDispatcher(&TestInterfaceStub::getTestDerivedStructAttributeAttribute, "(sqi)"); + static CommonAPI::DBus::DBusSetObservableAttributeStubDispatcher< + TestInterfaceStub, + DerivedTypeCollection::TestStructExtended + > setTestDerivedStructAttributeAttributeStubDispatcher( + &TestInterfaceStub::getTestDerivedStructAttributeAttribute, + &TestInterfaceStubRemoteEvent::onRemoteSetTestDerivedStructAttributeAttribute, + &TestInterfaceStubRemoteEvent::onRemoteTestDerivedStructAttributeAttributeChanged, + &TestInterfaceStubAdapter::fireTestDerivedStructAttributeAttributeChanged, + "(sqi)"); + + static CommonAPI::DBus::DBusGetAttributeStubDispatcher< + TestInterfaceStub, + DerivedTypeCollection::TestArrayUInt64 + > getTestDerivedArrayAttributeAttributeStubDispatcher(&TestInterfaceStub::getTestDerivedArrayAttributeAttribute, "at"); + static CommonAPI::DBus::DBusSetObservableAttributeStubDispatcher< + TestInterfaceStub, + DerivedTypeCollection::TestArrayUInt64 + > setTestDerivedArrayAttributeAttributeStubDispatcher( + &TestInterfaceStub::getTestDerivedArrayAttributeAttribute, + &TestInterfaceStubRemoteEvent::onRemoteSetTestDerivedArrayAttributeAttribute, + &TestInterfaceStubRemoteEvent::onRemoteTestDerivedArrayAttributeAttributeChanged, + &TestInterfaceStubAdapter::fireTestDerivedArrayAttributeAttributeChanged, + "at"); + + +<<<<<<< Upstream, based on origin/master static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< TestInterfaceStub, std::tuple<>, @@ -230,180 +343,228 @@ static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< std::tuple<DerivedTypeCollection::StructWithEnumKeyMap>, std::tuple<> > testStructWithEnumKeyMapMemberStubDispatcher(&TestInterfaceStub::TestStructWithEnumKeyMapMember, ""); - -void TestInterfaceDBusStubAdapter::fireTestPredefinedTypeAttributeAttributeChanged(const uint32_t& value) { - CommonAPI::DBus::DBusStubSignalHelper<CommonAPI::DBus::DBusSerializableArguments<uint32_t>> - ::sendSignal( - *this, - "onTestPredefinedTypeAttributeAttributeChanged", - "u", - value - ); -} -void TestInterfaceDBusStubAdapter::fireTestDerivedStructAttributeAttributeChanged(const DerivedTypeCollection::TestStructExtended& value) { - CommonAPI::DBus::DBusStubSignalHelper<CommonAPI::DBus::DBusSerializableArguments<DerivedTypeCollection::TestStructExtended>> - ::sendSignal( - *this, - "onTestDerivedStructAttributeAttributeChanged", - "(sqi)", - value - ); -} -void TestInterfaceDBusStubAdapter::fireTestDerivedArrayAttributeAttributeChanged(const DerivedTypeCollection::TestArrayUInt64& value) { - CommonAPI::DBus::DBusStubSignalHelper<CommonAPI::DBus::DBusSerializableArguments<DerivedTypeCollection::TestArrayUInt64>> - ::sendSignal( - *this, - "onTestDerivedArrayAttributeAttributeChanged", - "at", - value - ); -} - -void TestInterfaceDBusStubAdapter::fireTestPredefinedTypeBroadcastEvent(const uint32_t& uint32Value, const std::string& stringValue) { - CommonAPI::DBus::DBusStubSignalHelper<CommonAPI::DBus::DBusSerializableArguments<uint32_t, std::string>> - ::sendSignal( - *this, - "TestPredefinedTypeBroadcast", - "us", - uint32Value, stringValue - ); -} -static CommonAPI::DBus::DBusMethodWithReplyAdapterDispatcher< - TestInterfaceStub, - TestInterfaceStubAdapter, - std::tuple<>, - std::tuple<bool> - > subscribeTestSelectiveBroadcastSelectiveStubDispatcher(&TestInterfaceStubAdapter::subscribeForTestSelectiveBroadcastSelective, "b"); - -static CommonAPI::DBus::DBusMethodWithReplyAdapterDispatcher< - TestInterfaceStub, - TestInterfaceStubAdapter, - std::tuple<>, - std::tuple<> - > unsubscribeTestSelectiveBroadcastSelectiveStubDispatcher(&TestInterfaceStubAdapter::unsubscribeFromTestSelectiveBroadcastSelective, ""); - - -void TestInterfaceDBusStubAdapter::fireTestSelectiveBroadcastSelective(const std::shared_ptr<CommonAPI::ClientId> clientId) { - std::shared_ptr<CommonAPI::DBus::DBusClientId> dbusClientId = std::dynamic_pointer_cast<CommonAPI::DBus::DBusClientId, CommonAPI::ClientId>(clientId); - - if(dbusClientId) - { - CommonAPI::DBus::DBusStubSignalHelper<CommonAPI::DBus::DBusSerializableArguments<>> - ::sendSignal( - dbusClientId->getDBusId(), - *this, - "TestSelectiveBroadcast", - "" - ); - } -} - -void TestInterfaceDBusStubAdapter::sendTestSelectiveBroadcastSelective(const std::shared_ptr<CommonAPI::ClientIdList> receivers) { - std::shared_ptr<CommonAPI::ClientIdList> actualReceiverList; - actualReceiverList = receivers; - - if(receivers == NULL) - actualReceiverList = subscribersForTestSelectiveBroadcastSelective_; - - for (auto clientIdIterator = actualReceiverList->cbegin(); - clientIdIterator != actualReceiverList->cend(); - clientIdIterator++) { - if(receivers == NULL || subscribersForTestSelectiveBroadcastSelective_->find(*clientIdIterator) != subscribersForTestSelectiveBroadcastSelective_->end()) { - fireTestSelectiveBroadcastSelective(*clientIdIterator); - } - } -} - -void TestInterfaceDBusStubAdapter::subscribeForTestSelectiveBroadcastSelective(const std::shared_ptr<CommonAPI::ClientId> clientId, bool& success) { - bool ok = stub_->onTestSelectiveBroadcastSelectiveSubscriptionRequested(clientId); - if (ok) { - subscribersForTestSelectiveBroadcastSelective_->insert(clientId); - stub_->onTestSelectiveBroadcastSelectiveSubscriptionChanged(clientId, CommonAPI::SelectiveBroadcastSubscriptionEvent::SUBSCRIBED); - success = true; - } else { - success = false; - } -} - - -void TestInterfaceDBusStubAdapter::unsubscribeFromTestSelectiveBroadcastSelective(const std::shared_ptr<CommonAPI::ClientId> clientId) { - subscribersForTestSelectiveBroadcastSelective_->erase(clientId); - stub_->onTestSelectiveBroadcastSelectiveSubscriptionChanged(clientId, CommonAPI::SelectiveBroadcastSubscriptionEvent::UNSUBSCRIBED); -} - -std::shared_ptr<CommonAPI::ClientIdList> const TestInterfaceDBusStubAdapter::getSubscribersForTestSelectiveBroadcastSelective() { - return subscribersForTestSelectiveBroadcastSelective_; -} - -static CommonAPI::DBus::DBusMethodWithReplyAdapterDispatcher< - TestInterfaceStub, - TestInterfaceStubAdapter, - std::tuple<>, - std::tuple<bool> - > subscribeTestBroadcastWithOutArgsSelectiveStubDispatcher(&TestInterfaceStubAdapter::subscribeForTestBroadcastWithOutArgsSelective, "b"); - -static CommonAPI::DBus::DBusMethodWithReplyAdapterDispatcher< - TestInterfaceStub, - TestInterfaceStubAdapter, - std::tuple<>, - std::tuple<> - > unsubscribeTestBroadcastWithOutArgsSelectiveStubDispatcher(&TestInterfaceStubAdapter::unsubscribeFromTestBroadcastWithOutArgsSelective, ""); - - -void TestInterfaceDBusStubAdapter::fireTestBroadcastWithOutArgsSelective(const std::shared_ptr<CommonAPI::ClientId> clientId, const uint32_t& uint32Value, const std::string& stringValue) { - std::shared_ptr<CommonAPI::DBus::DBusClientId> dbusClientId = std::dynamic_pointer_cast<CommonAPI::DBus::DBusClientId, CommonAPI::ClientId>(clientId); - - if(dbusClientId) - { - CommonAPI::DBus::DBusStubSignalHelper<CommonAPI::DBus::DBusSerializableArguments<uint32_t, std::string>> - ::sendSignal( - dbusClientId->getDBusId(), - *this, - "TestBroadcastWithOutArgs", - "us", - uint32Value, stringValue - ); - } -} - -void TestInterfaceDBusStubAdapter::sendTestBroadcastWithOutArgsSelective(const uint32_t& uint32Value, const std::string& stringValue, const std::shared_ptr<CommonAPI::ClientIdList> receivers) { - std::shared_ptr<CommonAPI::ClientIdList> actualReceiverList; - actualReceiverList = receivers; - - if(receivers == NULL) - actualReceiverList = subscribersForTestBroadcastWithOutArgsSelective_; - - for (auto clientIdIterator = actualReceiverList->cbegin(); - clientIdIterator != actualReceiverList->cend(); - clientIdIterator++) { - if(receivers == NULL || subscribersForTestBroadcastWithOutArgsSelective_->find(*clientIdIterator) != subscribersForTestBroadcastWithOutArgsSelective_->end()) { - fireTestBroadcastWithOutArgsSelective(*clientIdIterator, uint32Value, stringValue); - } - } -} - -void TestInterfaceDBusStubAdapter::subscribeForTestBroadcastWithOutArgsSelective(const std::shared_ptr<CommonAPI::ClientId> clientId, bool& success) { - bool ok = stub_->onTestBroadcastWithOutArgsSelectiveSubscriptionRequested(clientId); - if (ok) { - subscribersForTestBroadcastWithOutArgsSelective_->insert(clientId); - stub_->onTestBroadcastWithOutArgsSelectiveSubscriptionChanged(clientId, CommonAPI::SelectiveBroadcastSubscriptionEvent::SUBSCRIBED); - success = true; - } else { - success = false; - } -} - - -void TestInterfaceDBusStubAdapter::unsubscribeFromTestBroadcastWithOutArgsSelective(const std::shared_ptr<CommonAPI::ClientId> clientId) { - subscribersForTestBroadcastWithOutArgsSelective_->erase(clientId); - stub_->onTestBroadcastWithOutArgsSelectiveSubscriptionChanged(clientId, CommonAPI::SelectiveBroadcastSubscriptionEvent::UNSUBSCRIBED); -} - -std::shared_ptr<CommonAPI::ClientIdList> const TestInterfaceDBusStubAdapter::getSubscribersForTestBroadcastWithOutArgsSelective() { - return subscribersForTestBroadcastWithOutArgsSelective_; -} - - +======= + static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< + TestInterfaceStub, + std::tuple<>, + std::tuple<> + > testEmptyMethodStubDispatcher(&TestInterfaceStub::testEmptyMethod, ""); + static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< + TestInterfaceStub, + std::tuple<uint32_t, std::string>, + std::tuple<> + > testVoidPredefinedTypeMethodStubDispatcher(&TestInterfaceStub::testVoidPredefinedTypeMethod, ""); + static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< + TestInterfaceStub, + std::tuple<uint32_t, std::string>, + std::tuple<uint32_t, std::string> + > testPredefinedTypeMethodStubDispatcher(&TestInterfaceStub::testPredefinedTypeMethod, "us"); + static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< + TestInterfaceStub, + std::tuple<DerivedTypeCollection::TestEnumExtended2, DerivedTypeCollection::TestMap>, + std::tuple<> + > testVoidDerivedTypeMethodStubDispatcher(&TestInterfaceStub::testVoidDerivedTypeMethod, ""); + static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< + TestInterfaceStub, + std::tuple<DerivedTypeCollection::TestEnumExtended2, DerivedTypeCollection::TestMap>, + std::tuple<DerivedTypeCollection::TestEnumExtended2, DerivedTypeCollection::TestMap> + > testDerivedTypeMethodStubDispatcher(&TestInterfaceStub::testDerivedTypeMethod, "ia{ua(sq)}"); + static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< + TestInterfaceStub, + std::tuple<std::vector<std::shared_ptr<DerivedTypeCollection::TestPolymorphicStruct>>>, + std::tuple<> + > testArrayOfPolymorphicStructMethodStubDispatcher(&TestInterfaceStub::TestArrayOfPolymorphicStructMethod, ""); + static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< + TestInterfaceStub, + std::tuple<DerivedTypeCollection::MapIntToPolymorphic>, + std::tuple<> + > testMapOfPolymorphicStructMethodStubDispatcher(&TestInterfaceStub::TestMapOfPolymorphicStructMethod, ""); + static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< + TestInterfaceStub, + std::tuple<DerivedTypeCollection::StructWithPolymorphicMember>, + std::tuple<> + > testStructWithPolymorphicMemberMethodStubDispatcher(&TestInterfaceStub::TestStructWithPolymorphicMemberMethod, ""); + static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< + TestInterfaceStub, + std::tuple<DerivedTypeCollection::StructWithEnumKeyMap>, + std::tuple<> + > testStructWithEnumKeyMapMemberStubDispatcher(&TestInterfaceStub::TestStructWithEnumKeyMapMember, ""); +>>>>>>> 555557d Fix for inherited interfaces and tests for that including generated code + + void TestInterfaceDBusStubAdapterInternal::fireTestPredefinedTypeAttributeAttributeChanged(const uint32_t& value) { + CommonAPI::DBus::DBusStubSignalHelper<CommonAPI::DBus::DBusSerializableArguments<uint32_t>> + ::sendSignal( + *this, + "onTestPredefinedTypeAttributeAttributeChanged", + "u", + value + ); + } + void TestInterfaceDBusStubAdapterInternal::fireTestDerivedStructAttributeAttributeChanged(const DerivedTypeCollection::TestStructExtended& value) { + CommonAPI::DBus::DBusStubSignalHelper<CommonAPI::DBus::DBusSerializableArguments<DerivedTypeCollection::TestStructExtended>> + ::sendSignal( + *this, + "onTestDerivedStructAttributeAttributeChanged", + "(sqi)", + value + ); + } + void TestInterfaceDBusStubAdapterInternal::fireTestDerivedArrayAttributeAttributeChanged(const DerivedTypeCollection::TestArrayUInt64& value) { + CommonAPI::DBus::DBusStubSignalHelper<CommonAPI::DBus::DBusSerializableArguments<DerivedTypeCollection::TestArrayUInt64>> + ::sendSignal( + *this, + "onTestDerivedArrayAttributeAttributeChanged", + "at", + value + ); + } + + void TestInterfaceDBusStubAdapterInternal::fireTestPredefinedTypeBroadcastEvent(const uint32_t& uint32Value, const std::string& stringValue) { + CommonAPI::DBus::DBusStubSignalHelper<CommonAPI::DBus::DBusSerializableArguments<uint32_t, std::string>> + ::sendSignal( + *this, + "TestPredefinedTypeBroadcast", + "us", + uint32Value, stringValue + ); + } + static CommonAPI::DBus::DBusMethodWithReplyAdapterDispatcher< + TestInterfaceStub, + TestInterfaceStubAdapter, + std::tuple<>, + std::tuple<bool> + > subscribeTestSelectiveBroadcastSelectiveStubDispatcher(&TestInterfaceStubAdapter::subscribeForTestSelectiveBroadcastSelective, "b"); + + static CommonAPI::DBus::DBusMethodWithReplyAdapterDispatcher< + TestInterfaceStub, + TestInterfaceStubAdapter, + std::tuple<>, + std::tuple<> + > unsubscribeTestSelectiveBroadcastSelectiveStubDispatcher(&TestInterfaceStubAdapter::unsubscribeFromTestSelectiveBroadcastSelective, ""); + + + void TestInterfaceDBusStubAdapterInternal::fireTestSelectiveBroadcastSelective(const std::shared_ptr<CommonAPI::ClientId> clientId) { + std::shared_ptr<CommonAPI::DBus::DBusClientId> dbusClientId = std::dynamic_pointer_cast<CommonAPI::DBus::DBusClientId, CommonAPI::ClientId>(clientId); + + if(dbusClientId) + { + CommonAPI::DBus::DBusStubSignalHelper<CommonAPI::DBus::DBusSerializableArguments<>> + ::sendSignal( + dbusClientId->getDBusId(), + *this, + "TestSelectiveBroadcast", + "" + ); + } + } + + void TestInterfaceDBusStubAdapterInternal::sendTestSelectiveBroadcastSelective(const std::shared_ptr<CommonAPI::ClientIdList> receivers) { + std::shared_ptr<CommonAPI::ClientIdList> actualReceiverList; + actualReceiverList = receivers; + + if(receivers == NULL) + actualReceiverList = subscribersForTestSelectiveBroadcastSelective_; + + for (auto clientIdIterator = actualReceiverList->cbegin(); + clientIdIterator != actualReceiverList->cend(); + clientIdIterator++) { + if(receivers == NULL || subscribersForTestSelectiveBroadcastSelective_->find(*clientIdIterator) != subscribersForTestSelectiveBroadcastSelective_->end()) { + fireTestSelectiveBroadcastSelective(*clientIdIterator); + } + } + } + + void TestInterfaceDBusStubAdapterInternal::subscribeForTestSelectiveBroadcastSelective(const std::shared_ptr<CommonAPI::ClientId> clientId, bool& success) { + bool ok = stub_->onTestSelectiveBroadcastSelectiveSubscriptionRequested(clientId); + if (ok) { + subscribersForTestSelectiveBroadcastSelective_->insert(clientId); + stub_->onTestSelectiveBroadcastSelectiveSubscriptionChanged(clientId, CommonAPI::SelectiveBroadcastSubscriptionEvent::SUBSCRIBED); + success = true; + } else { + success = false; + } + } + + + void TestInterfaceDBusStubAdapterInternal::unsubscribeFromTestSelectiveBroadcastSelective(const std::shared_ptr<CommonAPI::ClientId> clientId) { + subscribersForTestSelectiveBroadcastSelective_->erase(clientId); + stub_->onTestSelectiveBroadcastSelectiveSubscriptionChanged(clientId, CommonAPI::SelectiveBroadcastSubscriptionEvent::UNSUBSCRIBED); + } + + std::shared_ptr<CommonAPI::ClientIdList> const TestInterfaceDBusStubAdapterInternal::getSubscribersForTestSelectiveBroadcastSelective() { + return subscribersForTestSelectiveBroadcastSelective_; + } + + static CommonAPI::DBus::DBusMethodWithReplyAdapterDispatcher< + TestInterfaceStub, + TestInterfaceStubAdapter, + std::tuple<>, + std::tuple<bool> + > subscribeTestBroadcastWithOutArgsSelectiveStubDispatcher(&TestInterfaceStubAdapter::subscribeForTestBroadcastWithOutArgsSelective, "b"); + + static CommonAPI::DBus::DBusMethodWithReplyAdapterDispatcher< + TestInterfaceStub, + TestInterfaceStubAdapter, + std::tuple<>, + std::tuple<> + > unsubscribeTestBroadcastWithOutArgsSelectiveStubDispatcher(&TestInterfaceStubAdapter::unsubscribeFromTestBroadcastWithOutArgsSelective, ""); + + + void TestInterfaceDBusStubAdapterInternal::fireTestBroadcastWithOutArgsSelective(const std::shared_ptr<CommonAPI::ClientId> clientId, const uint32_t& uint32Value, const std::string& stringValue) { + std::shared_ptr<CommonAPI::DBus::DBusClientId> dbusClientId = std::dynamic_pointer_cast<CommonAPI::DBus::DBusClientId, CommonAPI::ClientId>(clientId); + + if(dbusClientId) + { + CommonAPI::DBus::DBusStubSignalHelper<CommonAPI::DBus::DBusSerializableArguments<uint32_t, std::string>> + ::sendSignal( + dbusClientId->getDBusId(), + *this, + "TestBroadcastWithOutArgs", + "us", + uint32Value, stringValue + ); + } + } + + void TestInterfaceDBusStubAdapterInternal::sendTestBroadcastWithOutArgsSelective(const uint32_t& uint32Value, const std::string& stringValue, const std::shared_ptr<CommonAPI::ClientIdList> receivers) { + std::shared_ptr<CommonAPI::ClientIdList> actualReceiverList; + actualReceiverList = receivers; + + if(receivers == NULL) + actualReceiverList = subscribersForTestBroadcastWithOutArgsSelective_; + + for (auto clientIdIterator = actualReceiverList->cbegin(); + clientIdIterator != actualReceiverList->cend(); + clientIdIterator++) { + if(receivers == NULL || subscribersForTestBroadcastWithOutArgsSelective_->find(*clientIdIterator) != subscribersForTestBroadcastWithOutArgsSelective_->end()) { + fireTestBroadcastWithOutArgsSelective(*clientIdIterator, uint32Value, stringValue); + } + } + } + + void TestInterfaceDBusStubAdapterInternal::subscribeForTestBroadcastWithOutArgsSelective(const std::shared_ptr<CommonAPI::ClientId> clientId, bool& success) { + bool ok = stub_->onTestBroadcastWithOutArgsSelectiveSubscriptionRequested(clientId); + if (ok) { + subscribersForTestBroadcastWithOutArgsSelective_->insert(clientId); + stub_->onTestBroadcastWithOutArgsSelectiveSubscriptionChanged(clientId, CommonAPI::SelectiveBroadcastSubscriptionEvent::SUBSCRIBED); + success = true; + } else { + success = false; + } + } + + + void TestInterfaceDBusStubAdapterInternal::unsubscribeFromTestBroadcastWithOutArgsSelective(const std::shared_ptr<CommonAPI::ClientId> clientId) { + subscribersForTestBroadcastWithOutArgsSelective_->erase(clientId); + stub_->onTestBroadcastWithOutArgsSelectiveSubscriptionChanged(clientId, CommonAPI::SelectiveBroadcastSubscriptionEvent::UNSUBSCRIBED); + } + + std::shared_ptr<CommonAPI::ClientIdList> const TestInterfaceDBusStubAdapterInternal::getSubscribersForTestBroadcastWithOutArgsSelective() { + return subscribersForTestBroadcastWithOutArgsSelective_; + } + + +<<<<<<< Upstream, based on origin/master const TestInterfaceDBusStubAdapter::StubDispatcherTable& TestInterfaceDBusStubAdapter::getStubDispatcherTable() { static const TestInterfaceDBusStubAdapter::StubDispatcherTable stubDispatcherTable = { { { "getInterfaceVersion", "" }, &commonapi::tests::getInterfaceVersionStubDispatcher }, @@ -431,7 +592,59 @@ const TestInterfaceDBusStubAdapter::StubDispatcherTable& TestInterfaceDBusStubAd }; return stubDispatcherTable; } - - -} // namespace tests -} // namespace commonapi +======= + const TestInterfaceDBusStubAdapterHelper::StubDispatcherTable& TestInterfaceDBusStubAdapterInternal::getStubDispatcherTable() { + return stubDispatcherTable_; + } + + + TestInterfaceDBusStubAdapterInternal::TestInterfaceDBusStubAdapterInternal( + const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, + const std::string& commonApiAddress, + const std::string& dbusInterfaceName, + const std::string& dbusBusName, + const std::string& dbusObjectPath, + const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection, + const std::shared_ptr<CommonAPI::StubBase>& stub): + CommonAPI::DBus::DBusStubAdapter( + factory, + commonApiAddress, + dbusInterfaceName, + dbusBusName, + dbusObjectPath, + dbusConnection, + false), + TestInterfaceDBusStubAdapterHelper(factory, commonApiAddress, dbusInterfaceName, dbusBusName, dbusObjectPath, + dbusConnection, std::dynamic_pointer_cast<TestInterfaceStub>(stub), + false), + stubDispatcherTable_({ + { { "getTestPredefinedTypeAttributeAttribute", "" }, &commonapi::tests::getTestPredefinedTypeAttributeAttributeStubDispatcher } + , { { "setTestPredefinedTypeAttributeAttribute", "u" }, &commonapi::tests::setTestPredefinedTypeAttributeAttributeStubDispatcher }, + { { "getTestDerivedStructAttributeAttribute", "" }, &commonapi::tests::getTestDerivedStructAttributeAttributeStubDispatcher } + , { { "setTestDerivedStructAttributeAttribute", "(sqi)" }, &commonapi::tests::setTestDerivedStructAttributeAttributeStubDispatcher }, + { { "getTestDerivedArrayAttributeAttribute", "" }, &commonapi::tests::getTestDerivedArrayAttributeAttributeStubDispatcher } + , { { "setTestDerivedArrayAttributeAttribute", "at" }, &commonapi::tests::setTestDerivedArrayAttributeAttributeStubDispatcher } + , + { { "testEmptyMethod", "" }, &commonapi::tests::testEmptyMethodStubDispatcher }, + { { "testVoidPredefinedTypeMethod", "us" }, &commonapi::tests::testVoidPredefinedTypeMethodStubDispatcher }, + { { "testPredefinedTypeMethod", "us" }, &commonapi::tests::testPredefinedTypeMethodStubDispatcher }, + { { "testVoidDerivedTypeMethod", "ia{ua(sq)}" }, &commonapi::tests::testVoidDerivedTypeMethodStubDispatcher }, + { { "testDerivedTypeMethod", "ia{ua(sq)}" }, &commonapi::tests::testDerivedTypeMethodStubDispatcher }, + { { "TestArrayOfPolymorphicStructMethod", "a(uv)" }, &commonapi::tests::testArrayOfPolymorphicStructMethodStubDispatcher }, + { { "TestMapOfPolymorphicStructMethod", "a{y(uv)}" }, &commonapi::tests::testMapOfPolymorphicStructMethodStubDispatcher }, + { { "TestStructWithPolymorphicMemberMethod", "(u(uv))" }, &commonapi::tests::testStructWithPolymorphicMemberMethodStubDispatcher }, + { { "TestStructWithEnumKeyMapMember", "(ua{is})" }, &commonapi::tests::testStructWithEnumKeyMapMemberStubDispatcher } + , + { { "subscribeForTestSelectiveBroadcastSelective", "" }, &commonapi::tests::subscribeTestSelectiveBroadcastSelectiveStubDispatcher }, + { { "unsubscribeFromTestSelectiveBroadcastSelective", "" }, &commonapi::tests::unsubscribeTestSelectiveBroadcastSelectiveStubDispatcher }, + { { "subscribeForTestBroadcastWithOutArgsSelective", "" }, &commonapi::tests::subscribeTestBroadcastWithOutArgsSelectiveStubDispatcher }, + { { "unsubscribeFromTestBroadcastWithOutArgsSelective", "" }, &commonapi::tests::unsubscribeTestBroadcastWithOutArgsSelectiveStubDispatcher } + }) { + subscribersForTestSelectiveBroadcastSelective_ = std::make_shared<CommonAPI::ClientIdList>(); + subscribersForTestBroadcastWithOutArgsSelective_ = std::make_shared<CommonAPI::ClientIdList>(); +>>>>>>> 555557d Fix for inherited interfaces and tests for that including generated code + + } + + } // namespace tests + } // namespace commonapi diff --git a/src/test/commonapi/tests/TestInterfaceDBusStubAdapter.h b/src/test/commonapi/tests/TestInterfaceDBusStubAdapter.h index 6033c61..4dc2a81 100644 --- a/src/test/commonapi/tests/TestInterfaceDBusStubAdapter.h +++ b/src/test/commonapi/tests/TestInterfaceDBusStubAdapter.h @@ -12,6 +12,7 @@ #include <commonapi/tests/TestInterfaceStub.h> + #if !defined (COMMONAPI_INTERNAL_COMPILATION) #define COMMONAPI_INTERNAL_COMPILATION #endif @@ -28,9 +29,9 @@ namespace tests { typedef CommonAPI::DBus::DBusStubAdapterHelper<TestInterfaceStub> TestInterfaceDBusStubAdapterHelper; -class TestInterfaceDBusStubAdapter: public TestInterfaceStubAdapter, public TestInterfaceDBusStubAdapterHelper { +class TestInterfaceDBusStubAdapterInternal: public TestInterfaceStubAdapter, public TestInterfaceDBusStubAdapterHelper { public: - TestInterfaceDBusStubAdapter( + TestInterfaceDBusStubAdapterInternal( const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, const std::string& commonApiAddress, const std::string& dbusInterfaceName, @@ -39,7 +40,7 @@ class TestInterfaceDBusStubAdapter: public TestInterfaceStubAdapter, public Test const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection, const std::shared_ptr<CommonAPI::StubBase>& stub); - ~TestInterfaceDBusStubAdapter(); + ~TestInterfaceDBusStubAdapterInternal(); void fireTestPredefinedTypeAttributeAttributeChanged(const uint32_t& value); void fireTestDerivedStructAttributeAttributeChanged(const DerivedTypeCollection::TestStructExtended& value); @@ -58,14 +59,44 @@ class TestInterfaceDBusStubAdapter: public TestInterfaceStubAdapter, public Test std::shared_ptr<CommonAPI::ClientIdList> const getSubscribersForTestBroadcastWithOutArgsSelective(); - const StubDispatcherTable& getStubDispatcherTable(); + const TestInterfaceDBusStubAdapterHelper::StubDispatcherTable& getStubDispatcherTable(); void deactivateManagedInstances(); + protected: virtual const char* getMethodsDBusIntrospectionXmlData() const; private: + TestInterfaceDBusStubAdapterHelper::StubDispatcherTable stubDispatcherTable_; +}; + +class TestInterfaceDBusStubAdapter: public TestInterfaceDBusStubAdapterInternal, public std::enable_shared_from_this<TestInterfaceDBusStubAdapter> { +public: + TestInterfaceDBusStubAdapter( + const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, + const std::string& commonApiAddress, + const std::string& dbusInterfaceName, + const std::string& dbusBusName, + const std::string& dbusObjectPath, + const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection, + const std::shared_ptr<CommonAPI::StubBase>& stub) : + CommonAPI::DBus::DBusStubAdapter( + factory, + commonApiAddress, + dbusInterfaceName, + dbusBusName, + dbusObjectPath, + dbusConnection, + false), + TestInterfaceDBusStubAdapterInternal( + factory, + commonApiAddress, + dbusInterfaceName, + dbusBusName, + dbusObjectPath, + dbusConnection, + stub) { } }; } // namespace tests diff --git a/src/test/commonapi/tests/TestInterfaceProxy.h b/src/test/commonapi/tests/TestInterfaceProxy.h index af6ae36..35cc04f 100644 --- a/src/test/commonapi/tests/TestInterfaceProxy.h +++ b/src/test/commonapi/tests/TestInterfaceProxy.h @@ -12,6 +12,7 @@ #include "TestInterfaceProxyBase.h" + #if !defined (COMMONAPI_INTERNAL_COMPILATION) #define COMMONAPI_INTERNAL_COMPILATION #endif @@ -25,10 +26,14 @@ namespace commonapi { namespace tests { template <typename ... _AttributeExtensions> -class TestInterfaceProxy: virtual public TestInterface, virtual public TestInterfaceProxyBase, public _AttributeExtensions... { - public: +class TestInterfaceProxy: virtual public TestInterface, virtual public TestInterfaceProxyBase +, public _AttributeExtensions... { +public: TestInterfaceProxy(std::shared_ptr<CommonAPI::Proxy> delegate); ~TestInterfaceProxy(); + + typedef TestInterface InterfaceType; + /** * Returns the wrapper class that provides access to the attribute TestPredefinedTypeAttribute. diff --git a/src/test/commonapi/tests/TestInterfaceProxyBase.h b/src/test/commonapi/tests/TestInterfaceProxyBase.h index ccd1846..139d9d5 100644 --- a/src/test/commonapi/tests/TestInterfaceProxyBase.h +++ b/src/test/commonapi/tests/TestInterfaceProxyBase.h @@ -13,6 +13,7 @@ #include "TestInterface.h" + #include <commonapi/tests/DerivedTypeCollection.h> #include <commonapi/tests/PredefinedTypeCollection.h> diff --git a/src/test/commonapi/tests/TestInterfaceStub.h b/src/test/commonapi/tests/TestInterfaceStub.h index 3809bdc..301102e 100644 --- a/src/test/commonapi/tests/TestInterfaceStub.h +++ b/src/test/commonapi/tests/TestInterfaceStub.h @@ -128,8 +128,8 @@ class TestInterfaceStubRemoteEvent { * This class and the one above are the ones an application developer needs to have * a look at if he wants to implement a service. */ -class TestInterfaceStub : public CommonAPI::Stub<TestInterfaceStubAdapter , TestInterfaceStubRemoteEvent> { - public: +class TestInterfaceStub : public virtual CommonAPI::Stub<TestInterfaceStubAdapter, TestInterfaceStubRemoteEvent> { +public: TestInterfaceStub(): interfaceVersion_(TestInterface::getInterfaceVersion()) { } virtual ~TestInterfaceStub() { } @@ -190,6 +190,11 @@ class TestInterfaceStub : public CommonAPI::Stub<TestInterfaceStubAdapter , Test private: const CommonAPI::Version interfaceVersion_; + + using CommonAPI::Stub<TestInterfaceStubAdapter, TestInterfaceStubRemoteEvent>::initStubAdapter; + typedef CommonAPI::Stub<TestInterfaceStubAdapter, TestInterfaceStubRemoteEvent>::StubAdapterType StubAdapterType; + typedef CommonAPI::Stub<TestInterfaceStubAdapter, TestInterfaceStubRemoteEvent>::RemoteEventHandlerType RemoteEventHandlerType; + }; } // namespace tests diff --git a/src/test/commonapi/tests/TestInterfaceStubDefault.cpp b/src/test/commonapi/tests/TestInterfaceStubDefault.cpp index 4a614fc..e0c2e05 100644 --- a/src/test/commonapi/tests/TestInterfaceStubDefault.cpp +++ b/src/test/commonapi/tests/TestInterfaceStubDefault.cpp @@ -17,7 +17,7 @@ TestInterfaceStubDefault::TestInterfaceStubDefault(): } TestInterfaceStubRemoteEvent* TestInterfaceStubDefault::initStubAdapter(const std::shared_ptr<TestInterfaceStubAdapter>& stubAdapter) { - stubAdapter_ = stubAdapter; + CommonAPI::Stub<TestInterfaceStubAdapter, TestInterfaceStubRemoteEvent>::stubAdapter_ = stubAdapter; return &remoteEventHandler_; } diff --git a/src/test/commonapi/tests/TestInterfaceStubDefault.h b/src/test/commonapi/tests/TestInterfaceStubDefault.h index 01b7bd4..e119a59 100644 --- a/src/test/commonapi/tests/TestInterfaceStubDefault.h +++ b/src/test/commonapi/tests/TestInterfaceStubDefault.h @@ -10,6 +10,7 @@ #ifndef COMMONAPI_TESTS_Test_Interface_STUB_DEFAULT_H_ #define COMMONAPI_TESTS_Test_Interface_STUB_DEFAULT_H_ + #include <commonapi/tests/TestInterfaceStub.h> #include <sstream> @@ -26,8 +27,8 @@ namespace tests { * that would be defined for this service, and/or if you do not need any non-default * behaviour. */ -class TestInterfaceStubDefault : public TestInterfaceStub { - public: +class TestInterfaceStubDefault : public virtual TestInterfaceStub { +public: TestInterfaceStubDefault(); TestInterfaceStubRemoteEvent* initStubAdapter(const std::shared_ptr<TestInterfaceStubAdapter>& stubAdapter); @@ -88,7 +89,7 @@ class TestInterfaceStubDefault : public TestInterfaceStub { virtual bool onTestBroadcastWithOutArgsSelectiveSubscriptionRequested(const std::shared_ptr<CommonAPI::ClientId> clientId); - protected: +protected: virtual bool trySetTestPredefinedTypeAttributeAttribute(uint32_t value); virtual bool validateTestPredefinedTypeAttributeAttributeRequestedValue(const uint32_t& value); virtual void onRemoteTestPredefinedTypeAttributeAttributeChanged(); @@ -98,8 +99,7 @@ class TestInterfaceStubDefault : public TestInterfaceStub { virtual bool trySetTestDerivedArrayAttributeAttribute(DerivedTypeCollection::TestArrayUInt64 value); virtual bool validateTestDerivedArrayAttributeAttributeRequestedValue(const DerivedTypeCollection::TestArrayUInt64& value); virtual void onRemoteTestDerivedArrayAttributeAttributeChanged(); - std::shared_ptr<TestInterfaceStubAdapter> stubAdapter_; - private: +private: class RemoteEventHandler: public TestInterfaceStubRemoteEvent { public: RemoteEventHandler(TestInterfaceStubDefault* defaultStub); diff --git a/src/test/commonapi/tests/managed/BranchInterface.h b/src/test/commonapi/tests/managed/BranchInterface.h index 1578005..385c656 100644 --- a/src/test/commonapi/tests/managed/BranchInterface.h +++ b/src/test/commonapi/tests/managed/BranchInterface.h @@ -1,6 +1,6 @@ /* * This file was generated by the CommonAPI Generators. -* Used org.genivi.commonapi.core 2.1.3.qualifier. +* Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. @@ -12,6 +12,7 @@ + #if !defined (COMMONAPI_INTERNAL_COMPILATION) #define COMMONAPI_INTERNAL_COMPILATION #endif diff --git a/src/test/commonapi/tests/managed/BranchInterfaceDBusProxy.cpp b/src/test/commonapi/tests/managed/BranchInterfaceDBusProxy.cpp index 0e461a6..8c557c5 100644 --- a/src/test/commonapi/tests/managed/BranchInterfaceDBusProxy.cpp +++ b/src/test/commonapi/tests/managed/BranchInterfaceDBusProxy.cpp @@ -1,6 +1,6 @@ /* * This file was generated by the CommonAPI Generators. -* Used org.genivi.commonapi.core 2.1.3.qualifier. +* Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. diff --git a/src/test/commonapi/tests/managed/BranchInterfaceDBusProxy.h b/src/test/commonapi/tests/managed/BranchInterfaceDBusProxy.h index da40530..89d520e 100644 --- a/src/test/commonapi/tests/managed/BranchInterfaceDBusProxy.h +++ b/src/test/commonapi/tests/managed/BranchInterfaceDBusProxy.h @@ -1,6 +1,6 @@ /* * This file was generated by the CommonAPI Generators. -* Used org.genivi.commonapi.core 2.1.3.qualifier. +* Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. @@ -12,6 +12,8 @@ #include <commonapi/tests/managed/BranchInterfaceProxyBase.h> + + #if !defined (COMMONAPI_INTERNAL_COMPILATION) #define COMMONAPI_INTERNAL_COMPILATION #endif diff --git a/src/test/commonapi/tests/managed/BranchInterfaceDBusStubAdapter.cpp b/src/test/commonapi/tests/managed/BranchInterfaceDBusStubAdapter.cpp index 48e9006..d4c0a62 100644 --- a/src/test/commonapi/tests/managed/BranchInterfaceDBusStubAdapter.cpp +++ b/src/test/commonapi/tests/managed/BranchInterfaceDBusStubAdapter.cpp @@ -1,89 +1,99 @@ -/* -* This file was generated by the CommonAPI Generators. -* Used org.genivi.commonapi.core 2.1.3.qualifier. -* Used org.franca.core 0.8.10.201309262002. -* -* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. -* If a copy of the MPL was not distributed with this file, You can obtain one at -* http://mozilla.org/MPL/2.0/. -*/ -#include "BranchInterfaceDBusStubAdapter.h" -#include <commonapi/tests/managed/BranchInterface.h> + /* + * This file was generated by the CommonAPI Generators. + * Used org.genivi.commonapi.core 2.1.4.qualifier. + * Used org.franca.core 0.8.10.201309262002. + * + * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. + * If a copy of the MPL was not distributed with this file, You can obtain one at + * http://mozilla.org/MPL/2.0/. + */ + #include "BranchInterfaceDBusStubAdapter.h" + #include <commonapi/tests/managed/BranchInterface.h> -namespace commonapi { -namespace tests { -namespace managed { + namespace commonapi { + namespace tests { + namespace managed { -std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> createBranchInterfaceDBusStubAdapter( - const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, - const std::string& commonApiAddress, - const std::string& interfaceName, - const std::string& busName, - const std::string& objectPath, - const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusProxyConnection, - const std::shared_ptr<CommonAPI::StubBase>& stubBase) { - return std::make_shared<BranchInterfaceDBusStubAdapter>(factory, commonApiAddress, interfaceName, busName, objectPath, dbusProxyConnection, stubBase); -} + std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> createBranchInterfaceDBusStubAdapter( + const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, + const std::string& commonApiAddress, + const std::string& interfaceName, + const std::string& busName, + const std::string& objectPath, + const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusProxyConnection, + const std::shared_ptr<CommonAPI::StubBase>& stubBase) { + return std::make_shared<BranchInterfaceDBusStubAdapter>(factory, commonApiAddress, interfaceName, busName, objectPath, dbusProxyConnection, stubBase); + } -__attribute__((constructor)) void registerBranchInterfaceDBusStubAdapter(void) { - CommonAPI::DBus::DBusFactory::registerAdapterFactoryMethod(BranchInterface::getInterfaceId(), - &createBranchInterfaceDBusStubAdapter); -} + __attribute__((constructor)) void registerBranchInterfaceDBusStubAdapter(void) { + CommonAPI::DBus::DBusFactory::registerAdapterFactoryMethod(BranchInterface::getInterfaceId(), + &createBranchInterfaceDBusStubAdapter); + } -BranchInterfaceDBusStubAdapter::BranchInterfaceDBusStubAdapter( - const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, - const std::string& commonApiAddress, - const std::string& dbusInterfaceName, - const std::string& dbusBusName, - const std::string& dbusObjectPath, - const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection, - const std::shared_ptr<CommonAPI::StubBase>& stub): - BranchInterfaceDBusStubAdapterHelper(factory, commonApiAddress, dbusInterfaceName, dbusBusName, dbusObjectPath, - dbusConnection, std::dynamic_pointer_cast<BranchInterfaceStub>(stub), - false) { -} -BranchInterfaceDBusStubAdapter::~BranchInterfaceDBusStubAdapter() { - deactivateManagedInstances(); - deinit(); - stub_.reset(); -} -void BranchInterfaceDBusStubAdapter::deactivateManagedInstances() { -} + BranchInterfaceDBusStubAdapterInternal::~BranchInterfaceDBusStubAdapterInternal() { + deactivateManagedInstances(); + BranchInterfaceDBusStubAdapterHelper::deinit(); + BranchInterfaceDBusStubAdapterHelper::stub_.reset(); + } + + void BranchInterfaceDBusStubAdapterInternal::deactivateManagedInstances() { + } -const char* BranchInterfaceDBusStubAdapter::getMethodsDBusIntrospectionXmlData() const { - static const char* introspectionData = - "<method name=\"testBranchMethod\">\n" - "<arg name=\"inInt\" type=\"i\" direction=\"in\" />\n" - "<arg name=\"inString\" type=\"s\" direction=\"in\" />\n" - "<arg name=\"methodError\" type=\"i\" direction=\"out\" />\n" - "<arg name=\"outInt\" type=\"i\" direction=\"out\" />\n" - "<arg name=\"outString\" type=\"s\" direction=\"out\" />\n" - "</method>\n" - - ; - return introspectionData; -} + const char* BranchInterfaceDBusStubAdapterInternal::getMethodsDBusIntrospectionXmlData() const { + static const std::string introspectionData = + "<method name=\"testBranchMethod\">\n" + "<arg name=\"inInt\" type=\"i\" direction=\"in\" />\n" + "<arg name=\"inString\" type=\"s\" direction=\"in\" />\n" + "<arg name=\"methodError\" type=\"i\" direction=\"out\" />\n" + "<arg name=\"outInt\" type=\"i\" direction=\"out\" />\n" + "<arg name=\"outString\" type=\"s\" direction=\"out\" />\n" + "</method>\n" + + ; + return introspectionData.c_str(); + } + static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< + BranchInterfaceStub, + std::tuple<int32_t, std::string>, + std::tuple<BranchInterface::testBranchMethodError, int32_t, std::string> + > testBranchMethodStubDispatcher(&BranchInterfaceStub::testBranchMethod, "iis"); -static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< - BranchInterfaceStub, - std::tuple<int32_t, std::string>, - std::tuple<BranchInterface::testBranchMethodError, int32_t, std::string> - > testBranchMethodStubDispatcher(&BranchInterfaceStub::testBranchMethod, "iis"); + const BranchInterfaceDBusStubAdapterHelper::StubDispatcherTable& BranchInterfaceDBusStubAdapterInternal::getStubDispatcherTable() { + return stubDispatcherTable_; + } + + + BranchInterfaceDBusStubAdapterInternal::BranchInterfaceDBusStubAdapterInternal( + const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, + const std::string& commonApiAddress, + const std::string& dbusInterfaceName, + const std::string& dbusBusName, + const std::string& dbusObjectPath, + const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection, + const std::shared_ptr<CommonAPI::StubBase>& stub): + CommonAPI::DBus::DBusStubAdapter( + factory, + commonApiAddress, + dbusInterfaceName, + dbusBusName, + dbusObjectPath, + dbusConnection, + false), + BranchInterfaceDBusStubAdapterHelper(factory, commonApiAddress, dbusInterfaceName, dbusBusName, dbusObjectPath, + dbusConnection, std::dynamic_pointer_cast<BranchInterfaceStub>(stub), + false), + stubDispatcherTable_({ + { { "testBranchMethod", "is" }, &commonapi::tests::managed::testBranchMethodStubDispatcher } + }) { -const BranchInterfaceDBusStubAdapter::StubDispatcherTable& BranchInterfaceDBusStubAdapter::getStubDispatcherTable() { - static const BranchInterfaceDBusStubAdapter::StubDispatcherTable stubDispatcherTable = { - { { "testBranchMethod", "is" }, &commonapi::tests::managed::testBranchMethodStubDispatcher } - }; - return stubDispatcherTable; -} + } - -} // namespace managed -} // namespace tests -} // namespace commonapi + } // namespace managed + } // namespace tests + } // namespace commonapi diff --git a/src/test/commonapi/tests/managed/BranchInterfaceDBusStubAdapter.h b/src/test/commonapi/tests/managed/BranchInterfaceDBusStubAdapter.h index 6421978..21e46a2 100644 --- a/src/test/commonapi/tests/managed/BranchInterfaceDBusStubAdapter.h +++ b/src/test/commonapi/tests/managed/BranchInterfaceDBusStubAdapter.h @@ -1,6 +1,6 @@ /* * This file was generated by the CommonAPI Generators. -* Used org.genivi.commonapi.core 2.1.3.qualifier. +* Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. @@ -12,6 +12,7 @@ #include <commonapi/tests/managed/BranchInterfaceStub.h> + #if !defined (COMMONAPI_INTERNAL_COMPILATION) #define COMMONAPI_INTERNAL_COMPILATION #endif @@ -29,9 +30,9 @@ namespace managed { typedef CommonAPI::DBus::DBusStubAdapterHelper<BranchInterfaceStub> BranchInterfaceDBusStubAdapterHelper; -class BranchInterfaceDBusStubAdapter: public BranchInterfaceStubAdapter, public BranchInterfaceDBusStubAdapterHelper { +class BranchInterfaceDBusStubAdapterInternal: public BranchInterfaceStubAdapter, public BranchInterfaceDBusStubAdapterHelper { public: - BranchInterfaceDBusStubAdapter( + BranchInterfaceDBusStubAdapterInternal( const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, const std::string& commonApiAddress, const std::string& dbusInterfaceName, @@ -40,19 +41,49 @@ class BranchInterfaceDBusStubAdapter: public BranchInterfaceStubAdapter, public const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection, const std::shared_ptr<CommonAPI::StubBase>& stub); - ~BranchInterfaceDBusStubAdapter(); + ~BranchInterfaceDBusStubAdapterInternal(); - const StubDispatcherTable& getStubDispatcherTable(); + const BranchInterfaceDBusStubAdapterHelper::StubDispatcherTable& getStubDispatcherTable(); void deactivateManagedInstances(); + protected: virtual const char* getMethodsDBusIntrospectionXmlData() const; private: + BranchInterfaceDBusStubAdapterHelper::StubDispatcherTable stubDispatcherTable_; +}; + +class BranchInterfaceDBusStubAdapter: public BranchInterfaceDBusStubAdapterInternal, public std::enable_shared_from_this<BranchInterfaceDBusStubAdapter> { +public: + BranchInterfaceDBusStubAdapter( + const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, + const std::string& commonApiAddress, + const std::string& dbusInterfaceName, + const std::string& dbusBusName, + const std::string& dbusObjectPath, + const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection, + const std::shared_ptr<CommonAPI::StubBase>& stub) : + CommonAPI::DBus::DBusStubAdapter( + factory, + commonApiAddress, + dbusInterfaceName, + dbusBusName, + dbusObjectPath, + dbusConnection, + false), + BranchInterfaceDBusStubAdapterInternal( + factory, + commonApiAddress, + dbusInterfaceName, + dbusBusName, + dbusObjectPath, + dbusConnection, + stub) { } }; } // namespace managed diff --git a/src/test/commonapi/tests/managed/BranchInterfaceProxy.h b/src/test/commonapi/tests/managed/BranchInterfaceProxy.h index a61efd1..6517b8d 100644 --- a/src/test/commonapi/tests/managed/BranchInterfaceProxy.h +++ b/src/test/commonapi/tests/managed/BranchInterfaceProxy.h @@ -1,6 +1,6 @@ /* * This file was generated by the CommonAPI Generators. -* Used org.genivi.commonapi.core 2.1.3.qualifier. +* Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. @@ -12,6 +12,7 @@ #include "BranchInterfaceProxyBase.h" + #if !defined (COMMONAPI_INTERNAL_COMPILATION) #define COMMONAPI_INTERNAL_COMPILATION #endif @@ -24,10 +25,14 @@ namespace tests { namespace managed { template <typename ... _AttributeExtensions> -class BranchInterfaceProxy: virtual public BranchInterface, virtual public BranchInterfaceProxyBase, public _AttributeExtensions... { - public: +class BranchInterfaceProxy: virtual public BranchInterface, virtual public BranchInterfaceProxyBase +, public _AttributeExtensions... { +public: BranchInterfaceProxy(std::shared_ptr<CommonAPI::Proxy> delegate); ~BranchInterfaceProxy(); + + typedef BranchInterface InterfaceType; + diff --git a/src/test/commonapi/tests/managed/BranchInterfaceProxyBase.h b/src/test/commonapi/tests/managed/BranchInterfaceProxyBase.h index d8cb010..d5a61c1 100644 --- a/src/test/commonapi/tests/managed/BranchInterfaceProxyBase.h +++ b/src/test/commonapi/tests/managed/BranchInterfaceProxyBase.h @@ -1,6 +1,6 @@ /* * This file was generated by the CommonAPI Generators. -* Used org.genivi.commonapi.core 2.1.3.qualifier. +* Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. @@ -14,10 +14,12 @@ + #if !defined (COMMONAPI_INTERNAL_COMPILATION) #define COMMONAPI_INTERNAL_COMPILATION #endif +#include <vector> #include <CommonAPI/Proxy.h> #include <functional> diff --git a/src/test/commonapi/tests/managed/BranchInterfaceStub.h b/src/test/commonapi/tests/managed/BranchInterfaceStub.h index 01a01d5..160312a 100644 --- a/src/test/commonapi/tests/managed/BranchInterfaceStub.h +++ b/src/test/commonapi/tests/managed/BranchInterfaceStub.h @@ -1,6 +1,6 @@ /* * This file was generated by the CommonAPI Generators. -* Used org.genivi.commonapi.core 2.1.3.qualifier. +* Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. @@ -19,6 +19,7 @@ #define COMMONAPI_INTERNAL_COMPILATION #endif +#include <vector> #include <CommonAPI/Stub.h> @@ -74,14 +75,19 @@ class BranchInterfaceStubRemoteEvent { * This class and the one above are the ones an application developer needs to have * a look at if he wants to implement a service. */ -class BranchInterfaceStub : public CommonAPI::Stub<BranchInterfaceStubAdapter , BranchInterfaceStubRemoteEvent> { - public: +class BranchInterfaceStub : public virtual CommonAPI::Stub<BranchInterfaceStubAdapter, BranchInterfaceStubRemoteEvent> { +public: virtual ~BranchInterfaceStub() { } /// This is the method that will be called on remote calls on the method testBranchMethod. virtual void testBranchMethod(const std::shared_ptr<CommonAPI::ClientId> clientId, int32_t inInt, std::string inString, BranchInterface::testBranchMethodError& methodError, int32_t& outInt, std::string& outString) = 0; + + using CommonAPI::Stub<BranchInterfaceStubAdapter, BranchInterfaceStubRemoteEvent>::initStubAdapter; + typedef CommonAPI::Stub<BranchInterfaceStubAdapter, BranchInterfaceStubRemoteEvent>::StubAdapterType StubAdapterType; + typedef CommonAPI::Stub<BranchInterfaceStubAdapter, BranchInterfaceStubRemoteEvent>::RemoteEventHandlerType RemoteEventHandlerType; + }; } // namespace managed diff --git a/src/test/commonapi/tests/managed/BranchInterfaceStubDefault.cpp b/src/test/commonapi/tests/managed/BranchInterfaceStubDefault.cpp index ccb5c9d..039c64c 100644 --- a/src/test/commonapi/tests/managed/BranchInterfaceStubDefault.cpp +++ b/src/test/commonapi/tests/managed/BranchInterfaceStubDefault.cpp @@ -1,6 +1,6 @@ /* * This file was generated by the CommonAPI Generators. -* Used org.genivi.commonapi.core 2.1.3.qualifier. +* Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. @@ -18,7 +18,7 @@ BranchInterfaceStubDefault::BranchInterfaceStubDefault(): } BranchInterfaceStubRemoteEvent* BranchInterfaceStubDefault::initStubAdapter(const std::shared_ptr<BranchInterfaceStubAdapter>& stubAdapter) { - stubAdapter_ = stubAdapter; + CommonAPI::Stub<BranchInterfaceStubAdapter, BranchInterfaceStubRemoteEvent>::stubAdapter_ = stubAdapter; return &remoteEventHandler_; } diff --git a/src/test/commonapi/tests/managed/BranchInterfaceStubDefault.h b/src/test/commonapi/tests/managed/BranchInterfaceStubDefault.h index 5ea7ea7..90b0787 100644 --- a/src/test/commonapi/tests/managed/BranchInterfaceStubDefault.h +++ b/src/test/commonapi/tests/managed/BranchInterfaceStubDefault.h @@ -1,6 +1,6 @@ /* * This file was generated by the CommonAPI Generators. -* Used org.genivi.commonapi.core 2.1.3.qualifier. +* Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. @@ -10,6 +10,7 @@ #ifndef COMMONAPI_TESTS_MANAGED_Branch_Interface_STUB_DEFAULT_H_ #define COMMONAPI_TESTS_MANAGED_Branch_Interface_STUB_DEFAULT_H_ + #include <commonapi/tests/managed/BranchInterfaceStub.h> #include <sstream> @@ -27,8 +28,8 @@ namespace managed { * that would be defined for this service, and/or if you do not need any non-default * behaviour. */ -class BranchInterfaceStubDefault : public BranchInterfaceStub { - public: +class BranchInterfaceStubDefault : public virtual BranchInterfaceStub { +public: BranchInterfaceStubDefault(); BranchInterfaceStubRemoteEvent* initStubAdapter(const std::shared_ptr<BranchInterfaceStubAdapter>& stubAdapter); @@ -40,9 +41,8 @@ class BranchInterfaceStubDefault : public BranchInterfaceStub { - protected: - std::shared_ptr<BranchInterfaceStubAdapter> stubAdapter_; - private: +protected: +private: class RemoteEventHandler: public BranchInterfaceStubRemoteEvent { public: RemoteEventHandler(BranchInterfaceStubDefault* defaultStub); diff --git a/src/test/commonapi/tests/managed/LeafInterface.h b/src/test/commonapi/tests/managed/LeafInterface.h index dc1d0d8..d3a05cd 100644 --- a/src/test/commonapi/tests/managed/LeafInterface.h +++ b/src/test/commonapi/tests/managed/LeafInterface.h @@ -1,6 +1,6 @@ /* * This file was generated by the CommonAPI Generators. -* Used org.genivi.commonapi.core 2.1.3.qualifier. +* Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. @@ -12,6 +12,7 @@ + #if !defined (COMMONAPI_INTERNAL_COMPILATION) #define COMMONAPI_INTERNAL_COMPILATION #endif diff --git a/src/test/commonapi/tests/managed/LeafInterfaceDBusProxy.cpp b/src/test/commonapi/tests/managed/LeafInterfaceDBusProxy.cpp index 8274ef4..5c163da 100644 --- a/src/test/commonapi/tests/managed/LeafInterfaceDBusProxy.cpp +++ b/src/test/commonapi/tests/managed/LeafInterfaceDBusProxy.cpp @@ -1,6 +1,6 @@ /* * This file was generated by the CommonAPI Generators. -* Used org.genivi.commonapi.core 2.1.3.qualifier. +* Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. diff --git a/src/test/commonapi/tests/managed/LeafInterfaceDBusProxy.h b/src/test/commonapi/tests/managed/LeafInterfaceDBusProxy.h index 41f1e64..17fde80 100644 --- a/src/test/commonapi/tests/managed/LeafInterfaceDBusProxy.h +++ b/src/test/commonapi/tests/managed/LeafInterfaceDBusProxy.h @@ -1,6 +1,6 @@ /* * This file was generated by the CommonAPI Generators. -* Used org.genivi.commonapi.core 2.1.3.qualifier. +* Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. @@ -12,6 +12,8 @@ #include <commonapi/tests/managed/LeafInterfaceProxyBase.h> + + #if !defined (COMMONAPI_INTERNAL_COMPILATION) #define COMMONAPI_INTERNAL_COMPILATION #endif diff --git a/src/test/commonapi/tests/managed/LeafInterfaceDBusStubAdapter.cpp b/src/test/commonapi/tests/managed/LeafInterfaceDBusStubAdapter.cpp index d843e01..787d4ec 100644 --- a/src/test/commonapi/tests/managed/LeafInterfaceDBusStubAdapter.cpp +++ b/src/test/commonapi/tests/managed/LeafInterfaceDBusStubAdapter.cpp @@ -1,89 +1,99 @@ -/* -* This file was generated by the CommonAPI Generators. -* Used org.genivi.commonapi.core 2.1.3.qualifier. -* Used org.franca.core 0.8.10.201309262002. -* -* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. -* If a copy of the MPL was not distributed with this file, You can obtain one at -* http://mozilla.org/MPL/2.0/. -*/ -#include "LeafInterfaceDBusStubAdapter.h" -#include <commonapi/tests/managed/LeafInterface.h> + /* + * This file was generated by the CommonAPI Generators. + * Used org.genivi.commonapi.core 2.1.4.qualifier. + * Used org.franca.core 0.8.10.201309262002. + * + * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. + * If a copy of the MPL was not distributed with this file, You can obtain one at + * http://mozilla.org/MPL/2.0/. + */ + #include "LeafInterfaceDBusStubAdapter.h" + #include <commonapi/tests/managed/LeafInterface.h> -namespace commonapi { -namespace tests { -namespace managed { + namespace commonapi { + namespace tests { + namespace managed { -std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> createLeafInterfaceDBusStubAdapter( - const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, - const std::string& commonApiAddress, - const std::string& interfaceName, - const std::string& busName, - const std::string& objectPath, - const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusProxyConnection, - const std::shared_ptr<CommonAPI::StubBase>& stubBase) { - return std::make_shared<LeafInterfaceDBusStubAdapter>(factory, commonApiAddress, interfaceName, busName, objectPath, dbusProxyConnection, stubBase); -} + std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> createLeafInterfaceDBusStubAdapter( + const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, + const std::string& commonApiAddress, + const std::string& interfaceName, + const std::string& busName, + const std::string& objectPath, + const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusProxyConnection, + const std::shared_ptr<CommonAPI::StubBase>& stubBase) { + return std::make_shared<LeafInterfaceDBusStubAdapter>(factory, commonApiAddress, interfaceName, busName, objectPath, dbusProxyConnection, stubBase); + } -__attribute__((constructor)) void registerLeafInterfaceDBusStubAdapter(void) { - CommonAPI::DBus::DBusFactory::registerAdapterFactoryMethod(LeafInterface::getInterfaceId(), - &createLeafInterfaceDBusStubAdapter); -} + __attribute__((constructor)) void registerLeafInterfaceDBusStubAdapter(void) { + CommonAPI::DBus::DBusFactory::registerAdapterFactoryMethod(LeafInterface::getInterfaceId(), + &createLeafInterfaceDBusStubAdapter); + } -LeafInterfaceDBusStubAdapter::LeafInterfaceDBusStubAdapter( - const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, - const std::string& commonApiAddress, - const std::string& dbusInterfaceName, - const std::string& dbusBusName, - const std::string& dbusObjectPath, - const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection, - const std::shared_ptr<CommonAPI::StubBase>& stub): - LeafInterfaceDBusStubAdapterHelper(factory, commonApiAddress, dbusInterfaceName, dbusBusName, dbusObjectPath, - dbusConnection, std::dynamic_pointer_cast<LeafInterfaceStub>(stub), - false) { -} -LeafInterfaceDBusStubAdapter::~LeafInterfaceDBusStubAdapter() { - deactivateManagedInstances(); - deinit(); - stub_.reset(); -} -void LeafInterfaceDBusStubAdapter::deactivateManagedInstances() { -} + LeafInterfaceDBusStubAdapterInternal::~LeafInterfaceDBusStubAdapterInternal() { + deactivateManagedInstances(); + LeafInterfaceDBusStubAdapterHelper::deinit(); + LeafInterfaceDBusStubAdapterHelper::stub_.reset(); + } + + void LeafInterfaceDBusStubAdapterInternal::deactivateManagedInstances() { + } -const char* LeafInterfaceDBusStubAdapter::getMethodsDBusIntrospectionXmlData() const { - static const char* introspectionData = - "<method name=\"testLeafMethod\">\n" - "<arg name=\"inInt\" type=\"i\" direction=\"in\" />\n" - "<arg name=\"inString\" type=\"s\" direction=\"in\" />\n" - "<arg name=\"methodError\" type=\"i\" direction=\"out\" />\n" - "<arg name=\"outInt\" type=\"i\" direction=\"out\" />\n" - "<arg name=\"outString\" type=\"s\" direction=\"out\" />\n" - "</method>\n" - - ; - return introspectionData; -} + const char* LeafInterfaceDBusStubAdapterInternal::getMethodsDBusIntrospectionXmlData() const { + static const std::string introspectionData = + "<method name=\"testLeafMethod\">\n" + "<arg name=\"inInt\" type=\"i\" direction=\"in\" />\n" + "<arg name=\"inString\" type=\"s\" direction=\"in\" />\n" + "<arg name=\"methodError\" type=\"i\" direction=\"out\" />\n" + "<arg name=\"outInt\" type=\"i\" direction=\"out\" />\n" + "<arg name=\"outString\" type=\"s\" direction=\"out\" />\n" + "</method>\n" + + ; + return introspectionData.c_str(); + } + static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< + LeafInterfaceStub, + std::tuple<int32_t, std::string>, + std::tuple<LeafInterface::testLeafMethodError, int32_t, std::string> + > testLeafMethodStubDispatcher(&LeafInterfaceStub::testLeafMethod, "iis"); -static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< - LeafInterfaceStub, - std::tuple<int32_t, std::string>, - std::tuple<LeafInterface::testLeafMethodError, int32_t, std::string> - > testLeafMethodStubDispatcher(&LeafInterfaceStub::testLeafMethod, "iis"); + const LeafInterfaceDBusStubAdapterHelper::StubDispatcherTable& LeafInterfaceDBusStubAdapterInternal::getStubDispatcherTable() { + return stubDispatcherTable_; + } + + + LeafInterfaceDBusStubAdapterInternal::LeafInterfaceDBusStubAdapterInternal( + const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, + const std::string& commonApiAddress, + const std::string& dbusInterfaceName, + const std::string& dbusBusName, + const std::string& dbusObjectPath, + const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection, + const std::shared_ptr<CommonAPI::StubBase>& stub): + CommonAPI::DBus::DBusStubAdapter( + factory, + commonApiAddress, + dbusInterfaceName, + dbusBusName, + dbusObjectPath, + dbusConnection, + false), + LeafInterfaceDBusStubAdapterHelper(factory, commonApiAddress, dbusInterfaceName, dbusBusName, dbusObjectPath, + dbusConnection, std::dynamic_pointer_cast<LeafInterfaceStub>(stub), + false), + stubDispatcherTable_({ + { { "testLeafMethod", "is" }, &commonapi::tests::managed::testLeafMethodStubDispatcher } + }) { -const LeafInterfaceDBusStubAdapter::StubDispatcherTable& LeafInterfaceDBusStubAdapter::getStubDispatcherTable() { - static const LeafInterfaceDBusStubAdapter::StubDispatcherTable stubDispatcherTable = { - { { "testLeafMethod", "is" }, &commonapi::tests::managed::testLeafMethodStubDispatcher } - }; - return stubDispatcherTable; -} + } - -} // namespace managed -} // namespace tests -} // namespace commonapi + } // namespace managed + } // namespace tests + } // namespace commonapi diff --git a/src/test/commonapi/tests/managed/LeafInterfaceDBusStubAdapter.h b/src/test/commonapi/tests/managed/LeafInterfaceDBusStubAdapter.h index 797ea90..f60c9b5 100644 --- a/src/test/commonapi/tests/managed/LeafInterfaceDBusStubAdapter.h +++ b/src/test/commonapi/tests/managed/LeafInterfaceDBusStubAdapter.h @@ -1,6 +1,6 @@ /* * This file was generated by the CommonAPI Generators. -* Used org.genivi.commonapi.core 2.1.3.qualifier. +* Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. @@ -12,6 +12,7 @@ #include <commonapi/tests/managed/LeafInterfaceStub.h> + #if !defined (COMMONAPI_INTERNAL_COMPILATION) #define COMMONAPI_INTERNAL_COMPILATION #endif @@ -29,9 +30,9 @@ namespace managed { typedef CommonAPI::DBus::DBusStubAdapterHelper<LeafInterfaceStub> LeafInterfaceDBusStubAdapterHelper; -class LeafInterfaceDBusStubAdapter: public LeafInterfaceStubAdapter, public LeafInterfaceDBusStubAdapterHelper { +class LeafInterfaceDBusStubAdapterInternal: public LeafInterfaceStubAdapter, public LeafInterfaceDBusStubAdapterHelper { public: - LeafInterfaceDBusStubAdapter( + LeafInterfaceDBusStubAdapterInternal( const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, const std::string& commonApiAddress, const std::string& dbusInterfaceName, @@ -40,19 +41,49 @@ class LeafInterfaceDBusStubAdapter: public LeafInterfaceStubAdapter, public Leaf const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection, const std::shared_ptr<CommonAPI::StubBase>& stub); - ~LeafInterfaceDBusStubAdapter(); + ~LeafInterfaceDBusStubAdapterInternal(); - const StubDispatcherTable& getStubDispatcherTable(); + const LeafInterfaceDBusStubAdapterHelper::StubDispatcherTable& getStubDispatcherTable(); void deactivateManagedInstances(); + protected: virtual const char* getMethodsDBusIntrospectionXmlData() const; private: + LeafInterfaceDBusStubAdapterHelper::StubDispatcherTable stubDispatcherTable_; +}; + +class LeafInterfaceDBusStubAdapter: public LeafInterfaceDBusStubAdapterInternal, public std::enable_shared_from_this<LeafInterfaceDBusStubAdapter> { +public: + LeafInterfaceDBusStubAdapter( + const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, + const std::string& commonApiAddress, + const std::string& dbusInterfaceName, + const std::string& dbusBusName, + const std::string& dbusObjectPath, + const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection, + const std::shared_ptr<CommonAPI::StubBase>& stub) : + CommonAPI::DBus::DBusStubAdapter( + factory, + commonApiAddress, + dbusInterfaceName, + dbusBusName, + dbusObjectPath, + dbusConnection, + false), + LeafInterfaceDBusStubAdapterInternal( + factory, + commonApiAddress, + dbusInterfaceName, + dbusBusName, + dbusObjectPath, + dbusConnection, + stub) { } }; } // namespace managed diff --git a/src/test/commonapi/tests/managed/LeafInterfaceProxy.h b/src/test/commonapi/tests/managed/LeafInterfaceProxy.h index 94f8bcb..7275950 100644 --- a/src/test/commonapi/tests/managed/LeafInterfaceProxy.h +++ b/src/test/commonapi/tests/managed/LeafInterfaceProxy.h @@ -1,6 +1,6 @@ /* * This file was generated by the CommonAPI Generators. -* Used org.genivi.commonapi.core 2.1.3.qualifier. +* Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. @@ -12,6 +12,7 @@ #include "LeafInterfaceProxyBase.h" + #if !defined (COMMONAPI_INTERNAL_COMPILATION) #define COMMONAPI_INTERNAL_COMPILATION #endif @@ -24,10 +25,14 @@ namespace tests { namespace managed { template <typename ... _AttributeExtensions> -class LeafInterfaceProxy: virtual public LeafInterface, virtual public LeafInterfaceProxyBase, public _AttributeExtensions... { - public: +class LeafInterfaceProxy: virtual public LeafInterface, virtual public LeafInterfaceProxyBase +, public _AttributeExtensions... { +public: LeafInterfaceProxy(std::shared_ptr<CommonAPI::Proxy> delegate); ~LeafInterfaceProxy(); + + typedef LeafInterface InterfaceType; + diff --git a/src/test/commonapi/tests/managed/LeafInterfaceProxyBase.h b/src/test/commonapi/tests/managed/LeafInterfaceProxyBase.h index 7e8d718..16df4d7 100644 --- a/src/test/commonapi/tests/managed/LeafInterfaceProxyBase.h +++ b/src/test/commonapi/tests/managed/LeafInterfaceProxyBase.h @@ -1,6 +1,6 @@ /* * This file was generated by the CommonAPI Generators. -* Used org.genivi.commonapi.core 2.1.3.qualifier. +* Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. @@ -14,10 +14,12 @@ + #if !defined (COMMONAPI_INTERNAL_COMPILATION) #define COMMONAPI_INTERNAL_COMPILATION #endif +#include <vector> #include <CommonAPI/Proxy.h> #include <functional> diff --git a/src/test/commonapi/tests/managed/LeafInterfaceStub.h b/src/test/commonapi/tests/managed/LeafInterfaceStub.h index d31561b..95ef485 100644 --- a/src/test/commonapi/tests/managed/LeafInterfaceStub.h +++ b/src/test/commonapi/tests/managed/LeafInterfaceStub.h @@ -1,6 +1,6 @@ /* * This file was generated by the CommonAPI Generators. -* Used org.genivi.commonapi.core 2.1.3.qualifier. +* Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. @@ -19,6 +19,7 @@ #define COMMONAPI_INTERNAL_COMPILATION #endif +#include <vector> #include <CommonAPI/Stub.h> @@ -74,14 +75,19 @@ class LeafInterfaceStubRemoteEvent { * This class and the one above are the ones an application developer needs to have * a look at if he wants to implement a service. */ -class LeafInterfaceStub : public CommonAPI::Stub<LeafInterfaceStubAdapter , LeafInterfaceStubRemoteEvent> { - public: +class LeafInterfaceStub : public virtual CommonAPI::Stub<LeafInterfaceStubAdapter, LeafInterfaceStubRemoteEvent> { +public: virtual ~LeafInterfaceStub() { } /// This is the method that will be called on remote calls on the method testLeafMethod. virtual void testLeafMethod(const std::shared_ptr<CommonAPI::ClientId> clientId, int32_t inInt, std::string inString, LeafInterface::testLeafMethodError& methodError, int32_t& outInt, std::string& outString) = 0; + + using CommonAPI::Stub<LeafInterfaceStubAdapter, LeafInterfaceStubRemoteEvent>::initStubAdapter; + typedef CommonAPI::Stub<LeafInterfaceStubAdapter, LeafInterfaceStubRemoteEvent>::StubAdapterType StubAdapterType; + typedef CommonAPI::Stub<LeafInterfaceStubAdapter, LeafInterfaceStubRemoteEvent>::RemoteEventHandlerType RemoteEventHandlerType; + }; } // namespace managed diff --git a/src/test/commonapi/tests/managed/LeafInterfaceStubDefault.cpp b/src/test/commonapi/tests/managed/LeafInterfaceStubDefault.cpp index 01dd58b..f653e18 100644 --- a/src/test/commonapi/tests/managed/LeafInterfaceStubDefault.cpp +++ b/src/test/commonapi/tests/managed/LeafInterfaceStubDefault.cpp @@ -1,6 +1,6 @@ /* * This file was generated by the CommonAPI Generators. -* Used org.genivi.commonapi.core 2.1.3.qualifier. +* Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. @@ -18,7 +18,7 @@ LeafInterfaceStubDefault::LeafInterfaceStubDefault(): } LeafInterfaceStubRemoteEvent* LeafInterfaceStubDefault::initStubAdapter(const std::shared_ptr<LeafInterfaceStubAdapter>& stubAdapter) { - stubAdapter_ = stubAdapter; + CommonAPI::Stub<LeafInterfaceStubAdapter, LeafInterfaceStubRemoteEvent>::stubAdapter_ = stubAdapter; return &remoteEventHandler_; } diff --git a/src/test/commonapi/tests/managed/LeafInterfaceStubDefault.h b/src/test/commonapi/tests/managed/LeafInterfaceStubDefault.h index fdedc9c..e9227b8 100644 --- a/src/test/commonapi/tests/managed/LeafInterfaceStubDefault.h +++ b/src/test/commonapi/tests/managed/LeafInterfaceStubDefault.h @@ -1,6 +1,6 @@ /* * This file was generated by the CommonAPI Generators. -* Used org.genivi.commonapi.core 2.1.3.qualifier. +* Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. @@ -10,6 +10,7 @@ #ifndef COMMONAPI_TESTS_MANAGED_Leaf_Interface_STUB_DEFAULT_H_ #define COMMONAPI_TESTS_MANAGED_Leaf_Interface_STUB_DEFAULT_H_ + #include <commonapi/tests/managed/LeafInterfaceStub.h> #include <sstream> @@ -27,8 +28,8 @@ namespace managed { * that would be defined for this service, and/or if you do not need any non-default * behaviour. */ -class LeafInterfaceStubDefault : public LeafInterfaceStub { - public: +class LeafInterfaceStubDefault : public virtual LeafInterfaceStub { +public: LeafInterfaceStubDefault(); LeafInterfaceStubRemoteEvent* initStubAdapter(const std::shared_ptr<LeafInterfaceStubAdapter>& stubAdapter); @@ -40,9 +41,8 @@ class LeafInterfaceStubDefault : public LeafInterfaceStub { - protected: - std::shared_ptr<LeafInterfaceStubAdapter> stubAdapter_; - private: +protected: +private: class RemoteEventHandler: public LeafInterfaceStubRemoteEvent { public: RemoteEventHandler(LeafInterfaceStubDefault* defaultStub); diff --git a/src/test/commonapi/tests/managed/RootInterface.h b/src/test/commonapi/tests/managed/RootInterface.h index f239090..7894869 100644 --- a/src/test/commonapi/tests/managed/RootInterface.h +++ b/src/test/commonapi/tests/managed/RootInterface.h @@ -1,6 +1,6 @@ /* * This file was generated by the CommonAPI Generators. -* Used org.genivi.commonapi.core 2.1.3.qualifier. +* Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. @@ -13,6 +13,7 @@ #include <set> + #if !defined (COMMONAPI_INTERNAL_COMPILATION) #define COMMONAPI_INTERNAL_COMPILATION #endif diff --git a/src/test/commonapi/tests/managed/RootInterfaceDBusProxy.cpp b/src/test/commonapi/tests/managed/RootInterfaceDBusProxy.cpp index b73d399..b7eb845 100644 --- a/src/test/commonapi/tests/managed/RootInterfaceDBusProxy.cpp +++ b/src/test/commonapi/tests/managed/RootInterfaceDBusProxy.cpp @@ -1,6 +1,6 @@ /* * This file was generated by the CommonAPI Generators. -* Used org.genivi.commonapi.core 2.1.3.qualifier. +* Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. diff --git a/src/test/commonapi/tests/managed/RootInterfaceDBusProxy.h b/src/test/commonapi/tests/managed/RootInterfaceDBusProxy.h index cf00826..07f5798 100644 --- a/src/test/commonapi/tests/managed/RootInterfaceDBusProxy.h +++ b/src/test/commonapi/tests/managed/RootInterfaceDBusProxy.h @@ -1,6 +1,6 @@ /* * This file was generated by the CommonAPI Generators. -* Used org.genivi.commonapi.core 2.1.3.qualifier. +* Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. @@ -12,6 +12,8 @@ #include <commonapi/tests/managed/RootInterfaceProxyBase.h> + + #if !defined (COMMONAPI_INTERNAL_COMPILATION) #define COMMONAPI_INTERNAL_COMPILATION #endif diff --git a/src/test/commonapi/tests/managed/RootInterfaceDBusStubAdapter.cpp b/src/test/commonapi/tests/managed/RootInterfaceDBusStubAdapter.cpp index 7857f58..66a9965 100644 --- a/src/test/commonapi/tests/managed/RootInterfaceDBusStubAdapter.cpp +++ b/src/test/commonapi/tests/managed/RootInterfaceDBusStubAdapter.cpp @@ -1,205 +1,215 @@ -/* -* This file was generated by the CommonAPI Generators. -* Used org.genivi.commonapi.core 2.1.3.qualifier. -* Used org.franca.core 0.8.10.201309262002. -* -* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. -* If a copy of the MPL was not distributed with this file, You can obtain one at -* http://mozilla.org/MPL/2.0/. -*/ -#include "RootInterfaceDBusStubAdapter.h" -#include <commonapi/tests/managed/RootInterface.h> - -namespace commonapi { -namespace tests { -namespace managed { - -std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> createRootInterfaceDBusStubAdapter( - const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, - const std::string& commonApiAddress, - const std::string& interfaceName, - const std::string& busName, - const std::string& objectPath, - const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusProxyConnection, - const std::shared_ptr<CommonAPI::StubBase>& stubBase) { - return std::make_shared<RootInterfaceDBusStubAdapter>(factory, commonApiAddress, interfaceName, busName, objectPath, dbusProxyConnection, stubBase); -} - -__attribute__((constructor)) void registerRootInterfaceDBusStubAdapter(void) { - CommonAPI::DBus::DBusFactory::registerAdapterFactoryMethod(RootInterface::getInterfaceId(), - &createRootInterfaceDBusStubAdapter); -} - -RootInterfaceDBusStubAdapter::RootInterfaceDBusStubAdapter( - const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, - const std::string& commonApiAddress, - const std::string& dbusInterfaceName, - const std::string& dbusBusName, - const std::string& dbusObjectPath, - const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection, - const std::shared_ptr<CommonAPI::StubBase>& stub): - RootInterfaceDBusStubAdapterHelper(factory, commonApiAddress, dbusInterfaceName, dbusBusName, dbusObjectPath, - dbusConnection, std::dynamic_pointer_cast<RootInterfaceStub>(stub), - true) { -} - -RootInterfaceDBusStubAdapter::~RootInterfaceDBusStubAdapter() { - deactivateManagedInstances(); - deinit(); - stub_.reset(); -} - -void RootInterfaceDBusStubAdapter::deactivateManagedInstances() { - for(std::set<std::string>::iterator iter = registeredLeafInterfaceInstances.begin(); - iter != registeredLeafInterfaceInstances.end(); ++iter) { - deregisterManagedStubLeafInterface(*iter); - } - for(std::set<std::string>::iterator iter = registeredBranchInterfaceInstances.begin(); - iter != registeredBranchInterfaceInstances.end(); ++iter) { - deregisterManagedStubBranchInterface(*iter); - } -} - -const char* RootInterfaceDBusStubAdapter::getMethodsDBusIntrospectionXmlData() const { - static const char* introspectionData = - "<method name=\"testRootMethod\">\n" - "<arg name=\"inInt\" type=\"i\" direction=\"in\" />\n" - "<arg name=\"inString\" type=\"s\" direction=\"in\" />\n" - "<arg name=\"methodError\" type=\"i\" direction=\"out\" />\n" - "<arg name=\"outInt\" type=\"i\" direction=\"out\" />\n" - "<arg name=\"outString\" type=\"s\" direction=\"out\" />\n" - "</method>\n" - - ; - return introspectionData; -} - - - -static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< - RootInterfaceStub, - std::tuple<int32_t, std::string>, - std::tuple<RootInterface::testRootMethodError, int32_t, std::string> - > testRootMethodStubDispatcher(&RootInterfaceStub::testRootMethod, "iis"); - - - -const RootInterfaceDBusStubAdapter::StubDispatcherTable& RootInterfaceDBusStubAdapter::getStubDispatcherTable() { - static const RootInterfaceDBusStubAdapter::StubDispatcherTable stubDispatcherTable = { - { { "testRootMethod", "is" }, &commonapi::tests::managed::testRootMethodStubDispatcher } - }; - return stubDispatcherTable; -} - - -bool RootInterfaceDBusStubAdapter::registerManagedStubLeafInterface(std::shared_ptr<LeafInterfaceStub> stub, const std::string& instance) { - if (registeredLeafInterfaceInstances.find(instance) == registeredLeafInterfaceInstances.end()) { - std::string commonApiAddress = "local:commonapi.tests.managed.LeafInterface:" + instance; - - std::string interfaceName; - std::string connectionName; - std::string objectPath; - - CommonAPI::DBus::DBusAddressTranslator::getInstance().searchForDBusAddress( - commonApiAddress, - interfaceName, - connectionName, - objectPath); - - if (objectPath.compare(0, dbusObjectPath_.length(), dbusObjectPath_) == 0) { - auto dbusStubAdapter = factory_->createDBusStubAdapter(stub, "commonapi.tests.managed.LeafInterface", - instance, "commonapi.tests.managed.LeafInterface", "local"); - - bool success = CommonAPI::DBus::DBusServicePublisher::getInstance()->registerManagedService(dbusStubAdapter); - if (success) { - bool isServiceExportSuccessful = dbusConnection_->getDBusObjectManager()->exportManagedDBusStubAdapter(dbusObjectPath_, dbusStubAdapter); - if (isServiceExportSuccessful) { - registeredLeafInterfaceInstances.insert(instance); - return true; - } else { - const bool isManagedDeregistrationSuccessful = - CommonAPI::DBus::DBusServicePublisher::getInstance()->unregisterManagedService( - commonApiAddress); - } - } - } - } - return false; -} - -bool RootInterfaceDBusStubAdapter::deregisterManagedStubLeafInterface(const std::string& instance) { - std::string commonApiAddress = "local:commonapi.tests.managed.LeafInterface:" + instance; - if (registeredLeafInterfaceInstances.find(instance) != registeredLeafInterfaceInstances.end()) { - std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> dbusStubAdapter = - CommonAPI::DBus::DBusServicePublisher::getInstance()->getRegisteredService(commonApiAddress); - if (dbusStubAdapter != nullptr) { - dbusConnection_->getDBusObjectManager()->unexportManagedDBusStubAdapter(dbusObjectPath_, dbusStubAdapter); - CommonAPI::DBus::DBusServicePublisher::getInstance()->unregisterManagedService(commonApiAddress); - registeredLeafInterfaceInstances.erase(instance); - return true; - } - } - return false; -} - -std::set<std::string>& RootInterfaceDBusStubAdapter::getLeafInterfaceInstances() { - return registeredLeafInterfaceInstances; -} - -bool RootInterfaceDBusStubAdapter::registerManagedStubBranchInterface(std::shared_ptr<BranchInterfaceStub> stub, const std::string& instance) { - if (registeredBranchInterfaceInstances.find(instance) == registeredBranchInterfaceInstances.end()) { - std::string commonApiAddress = "local:commonapi.tests.managed.BranchInterface:" + instance; - - std::string interfaceName; - std::string connectionName; - std::string objectPath; - - CommonAPI::DBus::DBusAddressTranslator::getInstance().searchForDBusAddress( - commonApiAddress, - interfaceName, - connectionName, - objectPath); - - if (objectPath.compare(0, dbusObjectPath_.length(), dbusObjectPath_) == 0) { - auto dbusStubAdapter = factory_->createDBusStubAdapter(stub, "commonapi.tests.managed.BranchInterface", - instance, "commonapi.tests.managed.BranchInterface", "local"); - - bool success = CommonAPI::DBus::DBusServicePublisher::getInstance()->registerManagedService(dbusStubAdapter); - if (success) { - bool isServiceExportSuccessful = dbusConnection_->getDBusObjectManager()->exportManagedDBusStubAdapter(dbusObjectPath_, dbusStubAdapter); - if (isServiceExportSuccessful) { - registeredBranchInterfaceInstances.insert(instance); - return true; - } else { - const bool isManagedDeregistrationSuccessful = - CommonAPI::DBus::DBusServicePublisher::getInstance()->unregisterManagedService( - commonApiAddress); - } - } - } - } - return false; -} - -bool RootInterfaceDBusStubAdapter::deregisterManagedStubBranchInterface(const std::string& instance) { - std::string commonApiAddress = "local:commonapi.tests.managed.BranchInterface:" + instance; - if (registeredBranchInterfaceInstances.find(instance) != registeredBranchInterfaceInstances.end()) { - std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> dbusStubAdapter = - CommonAPI::DBus::DBusServicePublisher::getInstance()->getRegisteredService(commonApiAddress); - if (dbusStubAdapter != nullptr) { - dbusConnection_->getDBusObjectManager()->unexportManagedDBusStubAdapter(dbusObjectPath_, dbusStubAdapter); - CommonAPI::DBus::DBusServicePublisher::getInstance()->unregisterManagedService(commonApiAddress); - registeredBranchInterfaceInstances.erase(instance); - return true; - } - } - return false; -} - -std::set<std::string>& RootInterfaceDBusStubAdapter::getBranchInterfaceInstances() { - return registeredBranchInterfaceInstances; -} - -} // namespace managed -} // namespace tests -} // namespace commonapi + /* + * This file was generated by the CommonAPI Generators. + * Used org.genivi.commonapi.core 2.1.4.qualifier. + * Used org.franca.core 0.8.10.201309262002. + * + * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. + * If a copy of the MPL was not distributed with this file, You can obtain one at + * http://mozilla.org/MPL/2.0/. + */ + #include "RootInterfaceDBusStubAdapter.h" + #include <commonapi/tests/managed/RootInterface.h> + + namespace commonapi { + namespace tests { + namespace managed { + + std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> createRootInterfaceDBusStubAdapter( + const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, + const std::string& commonApiAddress, + const std::string& interfaceName, + const std::string& busName, + const std::string& objectPath, + const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusProxyConnection, + const std::shared_ptr<CommonAPI::StubBase>& stubBase) { + return std::make_shared<RootInterfaceDBusStubAdapter>(factory, commonApiAddress, interfaceName, busName, objectPath, dbusProxyConnection, stubBase); + } + + __attribute__((constructor)) void registerRootInterfaceDBusStubAdapter(void) { + CommonAPI::DBus::DBusFactory::registerAdapterFactoryMethod(RootInterface::getInterfaceId(), + &createRootInterfaceDBusStubAdapter); + } + + + + RootInterfaceDBusStubAdapterInternal::~RootInterfaceDBusStubAdapterInternal() { + deactivateManagedInstances(); + RootInterfaceDBusStubAdapterHelper::deinit(); + RootInterfaceDBusStubAdapterHelper::stub_.reset(); + } + + void RootInterfaceDBusStubAdapterInternal::deactivateManagedInstances() { + for(std::set<std::string>::iterator iter = registeredLeafInterfaceInstances.begin(); + iter != registeredLeafInterfaceInstances.end(); ++iter) { + deregisterManagedStubLeafInterface(*iter); + } + for(std::set<std::string>::iterator iter = registeredBranchInterfaceInstances.begin(); + iter != registeredBranchInterfaceInstances.end(); ++iter) { + deregisterManagedStubBranchInterface(*iter); + } + } + + const char* RootInterfaceDBusStubAdapterInternal::getMethodsDBusIntrospectionXmlData() const { + static const std::string introspectionData = + "<method name=\"testRootMethod\">\n" + "<arg name=\"inInt\" type=\"i\" direction=\"in\" />\n" + "<arg name=\"inString\" type=\"s\" direction=\"in\" />\n" + "<arg name=\"methodError\" type=\"i\" direction=\"out\" />\n" + "<arg name=\"outInt\" type=\"i\" direction=\"out\" />\n" + "<arg name=\"outString\" type=\"s\" direction=\"out\" />\n" + "</method>\n" + + ; + return introspectionData.c_str(); + } + + + static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< + RootInterfaceStub, + std::tuple<int32_t, std::string>, + std::tuple<RootInterface::testRootMethodError, int32_t, std::string> + > testRootMethodStubDispatcher(&RootInterfaceStub::testRootMethod, "iis"); + + + + const RootInterfaceDBusStubAdapterHelper::StubDispatcherTable& RootInterfaceDBusStubAdapterInternal::getStubDispatcherTable() { + return stubDispatcherTable_; + } + + + bool RootInterfaceDBusStubAdapterInternal::registerManagedStubLeafInterface(std::shared_ptr<LeafInterfaceStub> stub, const std::string& instance) { + if (registeredLeafInterfaceInstances.find(instance) == registeredLeafInterfaceInstances.end()) { + std::string commonApiAddress = "local:commonapi.tests.managed.LeafInterface:" + instance; + + std::string interfaceName; + std::string connectionName; + std::string objectPath; + + CommonAPI::DBus::DBusAddressTranslator::getInstance().searchForDBusAddress( + commonApiAddress, + interfaceName, + connectionName, + objectPath); + + if (objectPath.compare(0, dbusObjectPath_.length(), dbusObjectPath_) == 0) { + auto dbusStubAdapter = factory_->createDBusStubAdapter(stub, "commonapi.tests.managed.LeafInterface", + instance, "commonapi.tests.managed.LeafInterface", "local"); + + bool success = CommonAPI::DBus::DBusServicePublisher::getInstance()->registerManagedService(dbusStubAdapter); + if (success) { + bool isServiceExportSuccessful = dbusConnection_->getDBusObjectManager()->exportManagedDBusStubAdapter(dbusObjectPath_, dbusStubAdapter); + if (isServiceExportSuccessful) { + registeredLeafInterfaceInstances.insert(instance); + return true; + } else { + const bool isManagedDeregistrationSuccessful = + CommonAPI::DBus::DBusServicePublisher::getInstance()->unregisterManagedService( + commonApiAddress); + } + } + } + } + return false; + } + + bool RootInterfaceDBusStubAdapterInternal::deregisterManagedStubLeafInterface(const std::string& instance) { + std::string commonApiAddress = "local:commonapi.tests.managed.LeafInterface:" + instance; + if (registeredLeafInterfaceInstances.find(instance) != registeredLeafInterfaceInstances.end()) { + std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> dbusStubAdapter = + CommonAPI::DBus::DBusServicePublisher::getInstance()->getRegisteredService(commonApiAddress); + if (dbusStubAdapter != nullptr) { + dbusConnection_->getDBusObjectManager()->unexportManagedDBusStubAdapter(dbusObjectPath_, dbusStubAdapter); + CommonAPI::DBus::DBusServicePublisher::getInstance()->unregisterManagedService(commonApiAddress); + registeredLeafInterfaceInstances.erase(instance); + return true; + } + } + return false; + } + + std::set<std::string>& RootInterfaceDBusStubAdapterInternal::getLeafInterfaceInstances() { + return registeredLeafInterfaceInstances; + } + + bool RootInterfaceDBusStubAdapterInternal::registerManagedStubBranchInterface(std::shared_ptr<BranchInterfaceStub> stub, const std::string& instance) { + if (registeredBranchInterfaceInstances.find(instance) == registeredBranchInterfaceInstances.end()) { + std::string commonApiAddress = "local:commonapi.tests.managed.BranchInterface:" + instance; + + std::string interfaceName; + std::string connectionName; + std::string objectPath; + + CommonAPI::DBus::DBusAddressTranslator::getInstance().searchForDBusAddress( + commonApiAddress, + interfaceName, + connectionName, + objectPath); + + if (objectPath.compare(0, dbusObjectPath_.length(), dbusObjectPath_) == 0) { + auto dbusStubAdapter = factory_->createDBusStubAdapter(stub, "commonapi.tests.managed.BranchInterface", + instance, "commonapi.tests.managed.BranchInterface", "local"); + + bool success = CommonAPI::DBus::DBusServicePublisher::getInstance()->registerManagedService(dbusStubAdapter); + if (success) { + bool isServiceExportSuccessful = dbusConnection_->getDBusObjectManager()->exportManagedDBusStubAdapter(dbusObjectPath_, dbusStubAdapter); + if (isServiceExportSuccessful) { + registeredBranchInterfaceInstances.insert(instance); + return true; + } else { + const bool isManagedDeregistrationSuccessful = + CommonAPI::DBus::DBusServicePublisher::getInstance()->unregisterManagedService( + commonApiAddress); + } + } + } + } + return false; + } + + bool RootInterfaceDBusStubAdapterInternal::deregisterManagedStubBranchInterface(const std::string& instance) { + std::string commonApiAddress = "local:commonapi.tests.managed.BranchInterface:" + instance; + if (registeredBranchInterfaceInstances.find(instance) != registeredBranchInterfaceInstances.end()) { + std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> dbusStubAdapter = + CommonAPI::DBus::DBusServicePublisher::getInstance()->getRegisteredService(commonApiAddress); + if (dbusStubAdapter != nullptr) { + dbusConnection_->getDBusObjectManager()->unexportManagedDBusStubAdapter(dbusObjectPath_, dbusStubAdapter); + CommonAPI::DBus::DBusServicePublisher::getInstance()->unregisterManagedService(commonApiAddress); + registeredBranchInterfaceInstances.erase(instance); + return true; + } + } + return false; + } + + std::set<std::string>& RootInterfaceDBusStubAdapterInternal::getBranchInterfaceInstances() { + return registeredBranchInterfaceInstances; + } + + RootInterfaceDBusStubAdapterInternal::RootInterfaceDBusStubAdapterInternal( + const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, + const std::string& commonApiAddress, + const std::string& dbusInterfaceName, + const std::string& dbusBusName, + const std::string& dbusObjectPath, + const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection, + const std::shared_ptr<CommonAPI::StubBase>& stub): + CommonAPI::DBus::DBusStubAdapter( + factory, + commonApiAddress, + dbusInterfaceName, + dbusBusName, + dbusObjectPath, + dbusConnection, + true), + RootInterfaceDBusStubAdapterHelper(factory, commonApiAddress, dbusInterfaceName, dbusBusName, dbusObjectPath, + dbusConnection, std::dynamic_pointer_cast<RootInterfaceStub>(stub), + true), + stubDispatcherTable_({ + { { "testRootMethod", "is" }, &commonapi::tests::managed::testRootMethodStubDispatcher } + }) { + + } + + } // namespace managed + } // namespace tests + } // namespace commonapi diff --git a/src/test/commonapi/tests/managed/RootInterfaceDBusStubAdapter.h b/src/test/commonapi/tests/managed/RootInterfaceDBusStubAdapter.h index f8973a4..01ef3a4 100644 --- a/src/test/commonapi/tests/managed/RootInterfaceDBusStubAdapter.h +++ b/src/test/commonapi/tests/managed/RootInterfaceDBusStubAdapter.h @@ -1,6 +1,6 @@ /* * This file was generated by the CommonAPI Generators. -* Used org.genivi.commonapi.core 2.1.3.qualifier. +* Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. @@ -12,6 +12,7 @@ #include <commonapi/tests/managed/RootInterfaceStub.h> + #if !defined (COMMONAPI_INTERNAL_COMPILATION) #define COMMONAPI_INTERNAL_COMPILATION #endif @@ -29,9 +30,9 @@ namespace managed { typedef CommonAPI::DBus::DBusStubAdapterHelper<RootInterfaceStub> RootInterfaceDBusStubAdapterHelper; -class RootInterfaceDBusStubAdapter: public RootInterfaceStubAdapter, public RootInterfaceDBusStubAdapterHelper { +class RootInterfaceDBusStubAdapterInternal: public RootInterfaceStubAdapter, public RootInterfaceDBusStubAdapterHelper { public: - RootInterfaceDBusStubAdapter( + RootInterfaceDBusStubAdapterInternal( const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, const std::string& commonApiAddress, const std::string& dbusInterfaceName, @@ -40,7 +41,7 @@ class RootInterfaceDBusStubAdapter: public RootInterfaceStubAdapter, public Root const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection, const std::shared_ptr<CommonAPI::StubBase>& stub); - ~RootInterfaceDBusStubAdapter(); + ~RootInterfaceDBusStubAdapterInternal(); @@ -51,9 +52,10 @@ class RootInterfaceDBusStubAdapter: public RootInterfaceStubAdapter, public Root bool deregisterManagedStubBranchInterface(const std::string&); std::set<std::string>& getBranchInterfaceInstances(); - const StubDispatcherTable& getStubDispatcherTable(); + const RootInterfaceDBusStubAdapterHelper::StubDispatcherTable& getStubDispatcherTable(); void deactivateManagedInstances(); + protected: virtual const char* getMethodsDBusIntrospectionXmlData() const; @@ -61,6 +63,35 @@ class RootInterfaceDBusStubAdapter: public RootInterfaceStubAdapter, public Root private: std::set<std::string> registeredLeafInterfaceInstances; std::set<std::string> registeredBranchInterfaceInstances; + RootInterfaceDBusStubAdapterHelper::StubDispatcherTable stubDispatcherTable_; +}; + +class RootInterfaceDBusStubAdapter: public RootInterfaceDBusStubAdapterInternal, public std::enable_shared_from_this<RootInterfaceDBusStubAdapter> { +public: + RootInterfaceDBusStubAdapter( + const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, + const std::string& commonApiAddress, + const std::string& dbusInterfaceName, + const std::string& dbusBusName, + const std::string& dbusObjectPath, + const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection, + const std::shared_ptr<CommonAPI::StubBase>& stub) : + CommonAPI::DBus::DBusStubAdapter( + factory, + commonApiAddress, + dbusInterfaceName, + dbusBusName, + dbusObjectPath, + dbusConnection, + true), + RootInterfaceDBusStubAdapterInternal( + factory, + commonApiAddress, + dbusInterfaceName, + dbusBusName, + dbusObjectPath, + dbusConnection, + stub) { } }; } // namespace managed diff --git a/src/test/commonapi/tests/managed/RootInterfaceProxy.h b/src/test/commonapi/tests/managed/RootInterfaceProxy.h index b01808e..672c0d5 100644 --- a/src/test/commonapi/tests/managed/RootInterfaceProxy.h +++ b/src/test/commonapi/tests/managed/RootInterfaceProxy.h @@ -1,6 +1,6 @@ /* * This file was generated by the CommonAPI Generators. -* Used org.genivi.commonapi.core 2.1.3.qualifier. +* Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. @@ -12,6 +12,7 @@ #include "RootInterfaceProxyBase.h" + #if !defined (COMMONAPI_INTERNAL_COMPILATION) #define COMMONAPI_INTERNAL_COMPILATION #endif @@ -24,10 +25,14 @@ namespace tests { namespace managed { template <typename ... _AttributeExtensions> -class RootInterfaceProxy: virtual public RootInterface, virtual public RootInterfaceProxyBase, public _AttributeExtensions... { - public: +class RootInterfaceProxy: virtual public RootInterface, virtual public RootInterfaceProxyBase +, public _AttributeExtensions... { +public: RootInterfaceProxy(std::shared_ptr<CommonAPI::Proxy> delegate); ~RootInterfaceProxy(); + + typedef RootInterface InterfaceType; + diff --git a/src/test/commonapi/tests/managed/RootInterfaceProxyBase.h b/src/test/commonapi/tests/managed/RootInterfaceProxyBase.h index 7ebe721..550093f 100644 --- a/src/test/commonapi/tests/managed/RootInterfaceProxyBase.h +++ b/src/test/commonapi/tests/managed/RootInterfaceProxyBase.h @@ -1,6 +1,6 @@ /* * This file was generated by the CommonAPI Generators. -* Used org.genivi.commonapi.core 2.1.3.qualifier. +* Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. @@ -13,6 +13,7 @@ #include "RootInterface.h" + #include <commonapi/tests/managed/BranchInterfaceStub.h> #include <commonapi/tests/managed/LeafInterfaceStub.h> @@ -20,6 +21,7 @@ #define COMMONAPI_INTERNAL_COMPILATION #endif +#include <vector> #include <CommonAPI/ProxyManager.h> #include <CommonAPI/Proxy.h> diff --git a/src/test/commonapi/tests/managed/RootInterfaceStub.h b/src/test/commonapi/tests/managed/RootInterfaceStub.h index 749a26a..0dbd088 100644 --- a/src/test/commonapi/tests/managed/RootInterfaceStub.h +++ b/src/test/commonapi/tests/managed/RootInterfaceStub.h @@ -1,6 +1,6 @@ /* * This file was generated by the CommonAPI Generators. -* Used org.genivi.commonapi.core 2.1.3.qualifier. +* Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. @@ -21,6 +21,7 @@ #define COMMONAPI_INTERNAL_COMPILATION #endif +#include <vector> #include <CommonAPI/Stub.h> @@ -82,8 +83,8 @@ class RootInterfaceStubRemoteEvent { * This class and the one above are the ones an application developer needs to have * a look at if he wants to implement a service. */ -class RootInterfaceStub : public CommonAPI::Stub<RootInterfaceStubAdapter , RootInterfaceStubRemoteEvent> { - public: +class RootInterfaceStub : public virtual CommonAPI::Stub<RootInterfaceStubAdapter, RootInterfaceStubRemoteEvent> { +public: virtual ~RootInterfaceStub() { } @@ -96,6 +97,11 @@ class RootInterfaceStub : public CommonAPI::Stub<RootInterfaceStubAdapter , Root virtual bool registerManagedStubBranchInterface(std::shared_ptr<BranchInterfaceStub>, const std::string&) = 0; virtual bool deregisterManagedStubBranchInterface(const std::string&) = 0; virtual std::set<std::string>& getBranchInterfaceInstances() = 0; + + using CommonAPI::Stub<RootInterfaceStubAdapter, RootInterfaceStubRemoteEvent>::initStubAdapter; + typedef CommonAPI::Stub<RootInterfaceStubAdapter, RootInterfaceStubRemoteEvent>::StubAdapterType StubAdapterType; + typedef CommonAPI::Stub<RootInterfaceStubAdapter, RootInterfaceStubRemoteEvent>::RemoteEventHandlerType RemoteEventHandlerType; + }; } // namespace managed diff --git a/src/test/commonapi/tests/managed/RootInterfaceStubDefault.cpp b/src/test/commonapi/tests/managed/RootInterfaceStubDefault.cpp index a87861d..cf09dc0 100644 --- a/src/test/commonapi/tests/managed/RootInterfaceStubDefault.cpp +++ b/src/test/commonapi/tests/managed/RootInterfaceStubDefault.cpp @@ -1,6 +1,6 @@ /* * This file was generated by the CommonAPI Generators. -* Used org.genivi.commonapi.core 2.1.3.qualifier. +* Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. @@ -19,7 +19,7 @@ RootInterfaceStubDefault::RootInterfaceStubDefault(): } RootInterfaceStubRemoteEvent* RootInterfaceStubDefault::initStubAdapter(const std::shared_ptr<RootInterfaceStubAdapter>& stubAdapter) { - stubAdapter_ = stubAdapter; + CommonAPI::Stub<RootInterfaceStubAdapter, RootInterfaceStubRemoteEvent>::stubAdapter_ = stubAdapter; return &remoteEventHandler_; } diff --git a/src/test/commonapi/tests/managed/RootInterfaceStubDefault.h b/src/test/commonapi/tests/managed/RootInterfaceStubDefault.h index 6fdba46..1379a82 100644 --- a/src/test/commonapi/tests/managed/RootInterfaceStubDefault.h +++ b/src/test/commonapi/tests/managed/RootInterfaceStubDefault.h @@ -1,6 +1,6 @@ /* * This file was generated by the CommonAPI Generators. -* Used org.genivi.commonapi.core 2.1.3.qualifier. +* Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. @@ -10,6 +10,7 @@ #ifndef COMMONAPI_TESTS_MANAGED_Root_Interface_STUB_DEFAULT_H_ #define COMMONAPI_TESTS_MANAGED_Root_Interface_STUB_DEFAULT_H_ + #include <commonapi/tests/managed/RootInterfaceStub.h> #include <sstream> @@ -27,8 +28,8 @@ namespace managed { * that would be defined for this service, and/or if you do not need any non-default * behaviour. */ -class RootInterfaceStubDefault : public RootInterfaceStub { - public: +class RootInterfaceStubDefault : public virtual RootInterfaceStub { +public: RootInterfaceStubDefault(); RootInterfaceStubRemoteEvent* initStubAdapter(const std::shared_ptr<RootInterfaceStubAdapter>& stubAdapter); @@ -48,9 +49,8 @@ class RootInterfaceStubDefault : public RootInterfaceStub { bool deregisterManagedStubBranchInterface(const std::string&); std::set<std::string>& getBranchInterfaceInstances(); - protected: - std::shared_ptr<RootInterfaceStubAdapter> stubAdapter_; - private: +protected: +private: class RemoteEventHandler: public RootInterfaceStubRemoteEvent { public: RemoteEventHandler(RootInterfaceStubDefault* defaultStub); diff --git a/src/test/commonapi/tests/managed/SecondRoot.h b/src/test/commonapi/tests/managed/SecondRoot.h index 0b55364..4104797 100644 --- a/src/test/commonapi/tests/managed/SecondRoot.h +++ b/src/test/commonapi/tests/managed/SecondRoot.h @@ -1,6 +1,6 @@ /* * This file was generated by the CommonAPI Generators. -* Used org.genivi.commonapi.core 2.1.3.qualifier. +* Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. @@ -13,6 +13,7 @@ #include <set> + #if !defined (COMMONAPI_INTERNAL_COMPILATION) #define COMMONAPI_INTERNAL_COMPILATION #endif diff --git a/src/test/commonapi/tests/managed/SecondRootDBusProxy.cpp b/src/test/commonapi/tests/managed/SecondRootDBusProxy.cpp index b1eb31a..f43fde1 100644 --- a/src/test/commonapi/tests/managed/SecondRootDBusProxy.cpp +++ b/src/test/commonapi/tests/managed/SecondRootDBusProxy.cpp @@ -1,6 +1,6 @@ /* * This file was generated by the CommonAPI Generators. -* Used org.genivi.commonapi.core 2.1.3.qualifier. +* Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. diff --git a/src/test/commonapi/tests/managed/SecondRootDBusProxy.h b/src/test/commonapi/tests/managed/SecondRootDBusProxy.h index 4942927..81f752e 100644 --- a/src/test/commonapi/tests/managed/SecondRootDBusProxy.h +++ b/src/test/commonapi/tests/managed/SecondRootDBusProxy.h @@ -1,6 +1,6 @@ /* * This file was generated by the CommonAPI Generators. -* Used org.genivi.commonapi.core 2.1.3.qualifier. +* Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. @@ -12,6 +12,8 @@ #include <commonapi/tests/managed/SecondRootProxyBase.h> + + #if !defined (COMMONAPI_INTERNAL_COMPILATION) #define COMMONAPI_INTERNAL_COMPILATION #endif diff --git a/src/test/commonapi/tests/managed/SecondRootDBusStubAdapter.cpp b/src/test/commonapi/tests/managed/SecondRootDBusStubAdapter.cpp index e7e7719..fffe746 100644 --- a/src/test/commonapi/tests/managed/SecondRootDBusStubAdapter.cpp +++ b/src/test/commonapi/tests/managed/SecondRootDBusStubAdapter.cpp @@ -1,135 +1,145 @@ -/* -* This file was generated by the CommonAPI Generators. -* Used org.genivi.commonapi.core 2.1.3.qualifier. -* Used org.franca.core 0.8.10.201309262002. -* -* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. -* If a copy of the MPL was not distributed with this file, You can obtain one at -* http://mozilla.org/MPL/2.0/. -*/ -#include "SecondRootDBusStubAdapter.h" -#include <commonapi/tests/managed/SecondRoot.h> - -namespace commonapi { -namespace tests { -namespace managed { - -std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> createSecondRootDBusStubAdapter( - const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, - const std::string& commonApiAddress, - const std::string& interfaceName, - const std::string& busName, - const std::string& objectPath, - const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusProxyConnection, - const std::shared_ptr<CommonAPI::StubBase>& stubBase) { - return std::make_shared<SecondRootDBusStubAdapter>(factory, commonApiAddress, interfaceName, busName, objectPath, dbusProxyConnection, stubBase); -} - -__attribute__((constructor)) void registerSecondRootDBusStubAdapter(void) { - CommonAPI::DBus::DBusFactory::registerAdapterFactoryMethod(SecondRoot::getInterfaceId(), - &createSecondRootDBusStubAdapter); -} - -SecondRootDBusStubAdapter::SecondRootDBusStubAdapter( - const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, - const std::string& commonApiAddress, - const std::string& dbusInterfaceName, - const std::string& dbusBusName, - const std::string& dbusObjectPath, - const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection, - const std::shared_ptr<CommonAPI::StubBase>& stub): - SecondRootDBusStubAdapterHelper(factory, commonApiAddress, dbusInterfaceName, dbusBusName, dbusObjectPath, - dbusConnection, std::dynamic_pointer_cast<SecondRootStub>(stub), - true) { -} - -SecondRootDBusStubAdapter::~SecondRootDBusStubAdapter() { - deactivateManagedInstances(); - deinit(); - stub_.reset(); -} - -void SecondRootDBusStubAdapter::deactivateManagedInstances() { - for(std::set<std::string>::iterator iter = registeredLeafInterfaceInstances.begin(); - iter != registeredLeafInterfaceInstances.end(); ++iter) { - deregisterManagedStubLeafInterface(*iter); - } -} - -const char* SecondRootDBusStubAdapter::getMethodsDBusIntrospectionXmlData() const { - static const char* introspectionData = - - "" - ; - return introspectionData; -} - - - - - - -const SecondRootDBusStubAdapter::StubDispatcherTable& SecondRootDBusStubAdapter::getStubDispatcherTable() { - static const SecondRootDBusStubAdapter::StubDispatcherTable stubDispatcherTable = { - }; - return stubDispatcherTable; -} - - -bool SecondRootDBusStubAdapter::registerManagedStubLeafInterface(std::shared_ptr<LeafInterfaceStub> stub, const std::string& instance) { - if (registeredLeafInterfaceInstances.find(instance) == registeredLeafInterfaceInstances.end()) { - std::string commonApiAddress = "local:commonapi.tests.managed.LeafInterface:" + instance; - - std::string interfaceName; - std::string connectionName; - std::string objectPath; - - CommonAPI::DBus::DBusAddressTranslator::getInstance().searchForDBusAddress( - commonApiAddress, - interfaceName, - connectionName, - objectPath); - - if (objectPath.compare(0, dbusObjectPath_.length(), dbusObjectPath_) == 0) { - auto dbusStubAdapter = factory_->createDBusStubAdapter(stub, "commonapi.tests.managed.LeafInterface", - instance, "commonapi.tests.managed.LeafInterface", "local"); - - bool success = CommonAPI::DBus::DBusServicePublisher::getInstance()->registerManagedService(dbusStubAdapter); - if (success) { - bool isServiceExportSuccessful = dbusConnection_->getDBusObjectManager()->exportManagedDBusStubAdapter(dbusObjectPath_, dbusStubAdapter); - if (isServiceExportSuccessful) { - registeredLeafInterfaceInstances.insert(instance); - return true; - } else { - const bool isManagedDeregistrationSuccessful = - CommonAPI::DBus::DBusServicePublisher::getInstance()->unregisterManagedService( - commonApiAddress); - } - } - } - } - return false; -} - -bool SecondRootDBusStubAdapter::deregisterManagedStubLeafInterface(const std::string& instance) { - std::string commonApiAddress = "local:commonapi.tests.managed.LeafInterface:" + instance; - if (registeredLeafInterfaceInstances.find(instance) != registeredLeafInterfaceInstances.end()) { - std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> dbusStubAdapter = - CommonAPI::DBus::DBusServicePublisher::getInstance()->getRegisteredService(commonApiAddress); - if (dbusStubAdapter != nullptr) { - dbusConnection_->getDBusObjectManager()->unexportManagedDBusStubAdapter(dbusObjectPath_, dbusStubAdapter); - CommonAPI::DBus::DBusServicePublisher::getInstance()->unregisterManagedService(commonApiAddress); - registeredLeafInterfaceInstances.erase(instance); - return true; - } - } - return false; -} - -std::set<std::string>& SecondRootDBusStubAdapter::getLeafInterfaceInstances() { - return registeredLeafInterfaceInstances; -} - -} // namespace managed -} // namespace tests -} // namespace commonapi + /* + * This file was generated by the CommonAPI Generators. + * Used org.genivi.commonapi.core 2.1.4.qualifier. + * Used org.franca.core 0.8.10.201309262002. + * + * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. + * If a copy of the MPL was not distributed with this file, You can obtain one at + * http://mozilla.org/MPL/2.0/. + */ + #include "SecondRootDBusStubAdapter.h" + #include <commonapi/tests/managed/SecondRoot.h> + + namespace commonapi { + namespace tests { + namespace managed { + + std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> createSecondRootDBusStubAdapter( + const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, + const std::string& commonApiAddress, + const std::string& interfaceName, + const std::string& busName, + const std::string& objectPath, + const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusProxyConnection, + const std::shared_ptr<CommonAPI::StubBase>& stubBase) { + return std::make_shared<SecondRootDBusStubAdapter>(factory, commonApiAddress, interfaceName, busName, objectPath, dbusProxyConnection, stubBase); + } + + __attribute__((constructor)) void registerSecondRootDBusStubAdapter(void) { + CommonAPI::DBus::DBusFactory::registerAdapterFactoryMethod(SecondRoot::getInterfaceId(), + &createSecondRootDBusStubAdapter); + } + + + + SecondRootDBusStubAdapterInternal::~SecondRootDBusStubAdapterInternal() { + deactivateManagedInstances(); + SecondRootDBusStubAdapterHelper::deinit(); + SecondRootDBusStubAdapterHelper::stub_.reset(); + } + + void SecondRootDBusStubAdapterInternal::deactivateManagedInstances() { + for(std::set<std::string>::iterator iter = registeredLeafInterfaceInstances.begin(); + iter != registeredLeafInterfaceInstances.end(); ++iter) { + deregisterManagedStubLeafInterface(*iter); + } + } + + const char* SecondRootDBusStubAdapterInternal::getMethodsDBusIntrospectionXmlData() const { + static const std::string introspectionData = + + "" + ; + return introspectionData.c_str(); + } + + + + + + const SecondRootDBusStubAdapterHelper::StubDispatcherTable& SecondRootDBusStubAdapterInternal::getStubDispatcherTable() { + return stubDispatcherTable_; + } + + + bool SecondRootDBusStubAdapterInternal::registerManagedStubLeafInterface(std::shared_ptr<LeafInterfaceStub> stub, const std::string& instance) { + if (registeredLeafInterfaceInstances.find(instance) == registeredLeafInterfaceInstances.end()) { + std::string commonApiAddress = "local:commonapi.tests.managed.LeafInterface:" + instance; + + std::string interfaceName; + std::string connectionName; + std::string objectPath; + + CommonAPI::DBus::DBusAddressTranslator::getInstance().searchForDBusAddress( + commonApiAddress, + interfaceName, + connectionName, + objectPath); + + if (objectPath.compare(0, dbusObjectPath_.length(), dbusObjectPath_) == 0) { + auto dbusStubAdapter = factory_->createDBusStubAdapter(stub, "commonapi.tests.managed.LeafInterface", + instance, "commonapi.tests.managed.LeafInterface", "local"); + + bool success = CommonAPI::DBus::DBusServicePublisher::getInstance()->registerManagedService(dbusStubAdapter); + if (success) { + bool isServiceExportSuccessful = dbusConnection_->getDBusObjectManager()->exportManagedDBusStubAdapter(dbusObjectPath_, dbusStubAdapter); + if (isServiceExportSuccessful) { + registeredLeafInterfaceInstances.insert(instance); + return true; + } else { + const bool isManagedDeregistrationSuccessful = + CommonAPI::DBus::DBusServicePublisher::getInstance()->unregisterManagedService( + commonApiAddress); + } + } + } + } + return false; + } + + bool SecondRootDBusStubAdapterInternal::deregisterManagedStubLeafInterface(const std::string& instance) { + std::string commonApiAddress = "local:commonapi.tests.managed.LeafInterface:" + instance; + if (registeredLeafInterfaceInstances.find(instance) != registeredLeafInterfaceInstances.end()) { + std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> dbusStubAdapter = + CommonAPI::DBus::DBusServicePublisher::getInstance()->getRegisteredService(commonApiAddress); + if (dbusStubAdapter != nullptr) { + dbusConnection_->getDBusObjectManager()->unexportManagedDBusStubAdapter(dbusObjectPath_, dbusStubAdapter); + CommonAPI::DBus::DBusServicePublisher::getInstance()->unregisterManagedService(commonApiAddress); + registeredLeafInterfaceInstances.erase(instance); + return true; + } + } + return false; + } + + std::set<std::string>& SecondRootDBusStubAdapterInternal::getLeafInterfaceInstances() { + return registeredLeafInterfaceInstances; + } + + SecondRootDBusStubAdapterInternal::SecondRootDBusStubAdapterInternal( + const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, + const std::string& commonApiAddress, + const std::string& dbusInterfaceName, + const std::string& dbusBusName, + const std::string& dbusObjectPath, + const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection, + const std::shared_ptr<CommonAPI::StubBase>& stub): + CommonAPI::DBus::DBusStubAdapter( + factory, + commonApiAddress, + dbusInterfaceName, + dbusBusName, + dbusObjectPath, + dbusConnection, + true), + SecondRootDBusStubAdapterHelper(factory, commonApiAddress, dbusInterfaceName, dbusBusName, dbusObjectPath, + dbusConnection, std::dynamic_pointer_cast<SecondRootStub>(stub), + true), + stubDispatcherTable_({ + }) { + + } + + } // namespace managed + } // namespace tests + } // namespace commonapi diff --git a/src/test/commonapi/tests/managed/SecondRootDBusStubAdapter.h b/src/test/commonapi/tests/managed/SecondRootDBusStubAdapter.h index 8fdb7dc..fc646db 100644 --- a/src/test/commonapi/tests/managed/SecondRootDBusStubAdapter.h +++ b/src/test/commonapi/tests/managed/SecondRootDBusStubAdapter.h @@ -1,6 +1,6 @@ /* * This file was generated by the CommonAPI Generators. -* Used org.genivi.commonapi.core 2.1.3.qualifier. +* Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. @@ -12,6 +12,7 @@ #include <commonapi/tests/managed/SecondRootStub.h> + #if !defined (COMMONAPI_INTERNAL_COMPILATION) #define COMMONAPI_INTERNAL_COMPILATION #endif @@ -29,9 +30,9 @@ namespace managed { typedef CommonAPI::DBus::DBusStubAdapterHelper<SecondRootStub> SecondRootDBusStubAdapterHelper; -class SecondRootDBusStubAdapter: public SecondRootStubAdapter, public SecondRootDBusStubAdapterHelper { +class SecondRootDBusStubAdapterInternal: public SecondRootStubAdapter, public SecondRootDBusStubAdapterHelper { public: - SecondRootDBusStubAdapter( + SecondRootDBusStubAdapterInternal( const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, const std::string& commonApiAddress, const std::string& dbusInterfaceName, @@ -40,7 +41,7 @@ class SecondRootDBusStubAdapter: public SecondRootStubAdapter, public SecondRoot const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection, const std::shared_ptr<CommonAPI::StubBase>& stub); - ~SecondRootDBusStubAdapter(); + ~SecondRootDBusStubAdapterInternal(); @@ -48,15 +49,45 @@ class SecondRootDBusStubAdapter: public SecondRootStubAdapter, public SecondRoot bool deregisterManagedStubLeafInterface(const std::string&); std::set<std::string>& getLeafInterfaceInstances(); - const StubDispatcherTable& getStubDispatcherTable(); + const SecondRootDBusStubAdapterHelper::StubDispatcherTable& getStubDispatcherTable(); void deactivateManagedInstances(); + protected: virtual const char* getMethodsDBusIntrospectionXmlData() const; private: std::set<std::string> registeredLeafInterfaceInstances; + SecondRootDBusStubAdapterHelper::StubDispatcherTable stubDispatcherTable_; +}; + +class SecondRootDBusStubAdapter: public SecondRootDBusStubAdapterInternal, public std::enable_shared_from_this<SecondRootDBusStubAdapter> { +public: + SecondRootDBusStubAdapter( + const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, + const std::string& commonApiAddress, + const std::string& dbusInterfaceName, + const std::string& dbusBusName, + const std::string& dbusObjectPath, + const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection, + const std::shared_ptr<CommonAPI::StubBase>& stub) : + CommonAPI::DBus::DBusStubAdapter( + factory, + commonApiAddress, + dbusInterfaceName, + dbusBusName, + dbusObjectPath, + dbusConnection, + true), + SecondRootDBusStubAdapterInternal( + factory, + commonApiAddress, + dbusInterfaceName, + dbusBusName, + dbusObjectPath, + dbusConnection, + stub) { } }; } // namespace managed diff --git a/src/test/commonapi/tests/managed/SecondRootProxy.h b/src/test/commonapi/tests/managed/SecondRootProxy.h index 2eb8cc1..fa0cb20 100644 --- a/src/test/commonapi/tests/managed/SecondRootProxy.h +++ b/src/test/commonapi/tests/managed/SecondRootProxy.h @@ -1,6 +1,6 @@ /* * This file was generated by the CommonAPI Generators. -* Used org.genivi.commonapi.core 2.1.3.qualifier. +* Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. @@ -12,6 +12,7 @@ #include "SecondRootProxyBase.h" + #if !defined (COMMONAPI_INTERNAL_COMPILATION) #define COMMONAPI_INTERNAL_COMPILATION #endif @@ -24,10 +25,14 @@ namespace tests { namespace managed { template <typename ... _AttributeExtensions> -class SecondRootProxy: virtual public SecondRoot, virtual public SecondRootProxyBase, public _AttributeExtensions... { - public: +class SecondRootProxy: virtual public SecondRoot, virtual public SecondRootProxyBase +, public _AttributeExtensions... { +public: SecondRootProxy(std::shared_ptr<CommonAPI::Proxy> delegate); ~SecondRootProxy(); + + typedef SecondRoot InterfaceType; + diff --git a/src/test/commonapi/tests/managed/SecondRootProxyBase.h b/src/test/commonapi/tests/managed/SecondRootProxyBase.h index 2c6d805..8006139 100644 --- a/src/test/commonapi/tests/managed/SecondRootProxyBase.h +++ b/src/test/commonapi/tests/managed/SecondRootProxyBase.h @@ -1,6 +1,6 @@ /* * This file was generated by the CommonAPI Generators. -* Used org.genivi.commonapi.core 2.1.3.qualifier. +* Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. @@ -13,6 +13,7 @@ #include "SecondRoot.h" + #include <commonapi/tests/managed/LeafInterfaceStub.h> #if !defined (COMMONAPI_INTERNAL_COMPILATION) diff --git a/src/test/commonapi/tests/managed/SecondRootStub.h b/src/test/commonapi/tests/managed/SecondRootStub.h index 7789e5d..98a73cb 100644 --- a/src/test/commonapi/tests/managed/SecondRootStub.h +++ b/src/test/commonapi/tests/managed/SecondRootStub.h @@ -1,6 +1,6 @@ /* * This file was generated by the CommonAPI Generators. -* Used org.genivi.commonapi.core 2.1.3.qualifier. +* Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. @@ -78,8 +78,8 @@ class SecondRootStubRemoteEvent { * This class and the one above are the ones an application developer needs to have * a look at if he wants to implement a service. */ -class SecondRootStub : public CommonAPI::Stub<SecondRootStubAdapter , SecondRootStubRemoteEvent> { - public: +class SecondRootStub : public virtual CommonAPI::Stub<SecondRootStubAdapter, SecondRootStubRemoteEvent> { +public: virtual ~SecondRootStub() { } @@ -87,6 +87,11 @@ class SecondRootStub : public CommonAPI::Stub<SecondRootStubAdapter , SecondRoot virtual bool registerManagedStubLeafInterface(std::shared_ptr<LeafInterfaceStub>, const std::string&) = 0; virtual bool deregisterManagedStubLeafInterface(const std::string&) = 0; virtual std::set<std::string>& getLeafInterfaceInstances() = 0; + + using CommonAPI::Stub<SecondRootStubAdapter, SecondRootStubRemoteEvent>::initStubAdapter; + typedef CommonAPI::Stub<SecondRootStubAdapter, SecondRootStubRemoteEvent>::StubAdapterType StubAdapterType; + typedef CommonAPI::Stub<SecondRootStubAdapter, SecondRootStubRemoteEvent>::RemoteEventHandlerType RemoteEventHandlerType; + }; } // namespace managed diff --git a/src/test/commonapi/tests/managed/SecondRootStubDefault.cpp b/src/test/commonapi/tests/managed/SecondRootStubDefault.cpp index 2e1f42b..51feea1 100644 --- a/src/test/commonapi/tests/managed/SecondRootStubDefault.cpp +++ b/src/test/commonapi/tests/managed/SecondRootStubDefault.cpp @@ -1,6 +1,6 @@ /* * This file was generated by the CommonAPI Generators. -* Used org.genivi.commonapi.core 2.1.3.qualifier. +* Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. @@ -19,7 +19,7 @@ SecondRootStubDefault::SecondRootStubDefault(): } SecondRootStubRemoteEvent* SecondRootStubDefault::initStubAdapter(const std::shared_ptr<SecondRootStubAdapter>& stubAdapter) { - stubAdapter_ = stubAdapter; + CommonAPI::Stub<SecondRootStubAdapter, SecondRootStubRemoteEvent>::stubAdapter_ = stubAdapter; return &remoteEventHandler_; } diff --git a/src/test/commonapi/tests/managed/SecondRootStubDefault.h b/src/test/commonapi/tests/managed/SecondRootStubDefault.h index 7c3a99d..daaca19 100644 --- a/src/test/commonapi/tests/managed/SecondRootStubDefault.h +++ b/src/test/commonapi/tests/managed/SecondRootStubDefault.h @@ -1,6 +1,6 @@ /* * This file was generated by the CommonAPI Generators. -* Used org.genivi.commonapi.core 2.1.3.qualifier. +* Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. @@ -10,6 +10,7 @@ #ifndef COMMONAPI_TESTS_MANAGED_Second_Root_STUB_DEFAULT_H_ #define COMMONAPI_TESTS_MANAGED_Second_Root_STUB_DEFAULT_H_ + #include <commonapi/tests/managed/SecondRootStub.h> #include <sstream> @@ -27,8 +28,8 @@ namespace managed { * that would be defined for this service, and/or if you do not need any non-default * behaviour. */ -class SecondRootStubDefault : public SecondRootStub { - public: +class SecondRootStubDefault : public virtual SecondRootStub { +public: SecondRootStubDefault(); SecondRootStubRemoteEvent* initStubAdapter(const std::shared_ptr<SecondRootStubAdapter>& stubAdapter); @@ -41,9 +42,8 @@ class SecondRootStubDefault : public SecondRootStub { bool deregisterManagedStubLeafInterface(const std::string&); std::set<std::string>& getLeafInterfaceInstances(); - protected: - std::shared_ptr<SecondRootStubAdapter> stubAdapter_; - private: +protected: +private: class RemoteEventHandler: public SecondRootStubRemoteEvent { public: RemoteEventHandler(SecondRootStubDefault* defaultStub); diff --git a/src/test/fake/legacy/service/LegacyInterfaceProxy.h b/src/test/fake/legacy/service/LegacyInterfaceProxy.h index f73ce4d..f5c108c 100644 --- a/src/test/fake/legacy/service/LegacyInterfaceProxy.h +++ b/src/test/fake/legacy/service/LegacyInterfaceProxy.h @@ -29,6 +29,8 @@ class LegacyInterfaceProxy: virtual public LegacyInterface, virtual public Legac LegacyInterfaceProxy(std::shared_ptr<CommonAPI::Proxy> delegate); ~LegacyInterfaceProxy(); + typedef typename fake::legacy::service::LegacyInterface InterfaceType; + /** |