diff options
Diffstat (limited to 'src/test/commonapi/tests')
37 files changed, 680 insertions, 153 deletions
diff --git a/src/test/commonapi/tests/ExtendedInterfaceDBusProxy.cpp b/src/test/commonapi/tests/ExtendedInterfaceDBusProxy.cpp index 0e81757..d46c5e1 100644 --- a/src/test/commonapi/tests/ExtendedInterfaceDBusProxy.cpp +++ b/src/test/commonapi/tests/ExtendedInterfaceDBusProxy.cpp @@ -22,7 +22,7 @@ std::shared_ptr<CommonAPI::DBus::DBusProxy> createExtendedInterfaceDBusProxy( return std::make_shared<ExtendedInterfaceDBusProxy>(factory, commonApiAddress, interfaceName, busName, objectPath, dbusProxyConnection); } -__attribute__((constructor)) void registerExtendedInterfaceDBusProxy(void) { +INITIALIZER(registerExtendedInterfaceDBusProxy) { CommonAPI::DBus::DBusFactory::registerProxyFactoryMethod(ExtendedInterface::getInterfaceId(), &createExtendedInterfaceDBusProxy); } diff --git a/src/test/commonapi/tests/ExtendedInterfaceDBusStubAdapter.cpp b/src/test/commonapi/tests/ExtendedInterfaceDBusStubAdapter.cpp index a2303a4..59cf9cd 100644 --- a/src/test/commonapi/tests/ExtendedInterfaceDBusStubAdapter.cpp +++ b/src/test/commonapi/tests/ExtendedInterfaceDBusStubAdapter.cpp @@ -24,7 +24,7 @@ std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> createExtendedInterfaceDBusStu return std::make_shared<ExtendedInterfaceDBusStubAdapter>(factory, commonApiAddress, interfaceName, busName, objectPath, dbusProxyConnection, stubBase); } -__attribute__((constructor)) void registerExtendedInterfaceDBusStubAdapter(void) { +INITIALIZER(registerExtendedInterfaceDBusStubAdapter) { CommonAPI::DBus::DBusFactory::registerAdapterFactoryMethod(ExtendedInterface::getInterfaceId(), &createExtendedInterfaceDBusStubAdapter); } @@ -37,6 +37,7 @@ ExtendedInterfaceDBusStubAdapterInternal::~ExtendedInterfaceDBusStubAdapterInter } void ExtendedInterfaceDBusStubAdapterInternal::deactivateManagedInstances() { + } const char* ExtendedInterfaceDBusStubAdapterInternal::getMethodsDBusIntrospectionXmlData() const { @@ -50,19 +51,138 @@ const char* ExtendedInterfaceDBusStubAdapterInternal::getMethodsDBusIntrospectio return introspectionData.c_str(); } -static CommonAPI::DBus::DBusGetAttributeStubDispatcher< +CommonAPI::DBus::DBusGetAttributeStubDispatcher< ExtendedInterfaceStub, CommonAPI::Version - > getExtendedInterfaceInterfaceVersionStubDispatcher(&ExtendedInterfaceStub::getInterfaceVersion, "uu"); + > ExtendedInterfaceDBusStubAdapterInternal::getExtendedInterfaceInterfaceVersionStubDispatcher(&ExtendedInterfaceStub::getInterfaceVersion, "uu"); -static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< +#ifdef WIN32 +CommonAPI::DBus::DBusGetAttributeStubDispatcher< + ExtendedInterfaceStub, + uint32_t + > ExtendedInterfaceDBusStubAdapterInternal::getTestPredefinedTypeAttributeAttributeStubDispatcher(&ExtendedInterfaceStub::getTestPredefinedTypeAttributeAttribute, "u"); +CommonAPI::DBus::DBusSetObservableAttributeStubDispatcher< + ExtendedInterfaceStub, + uint32_t + > ExtendedInterfaceDBusStubAdapterInternal::setTestPredefinedTypeAttributeAttributeStubDispatcher( + &ExtendedInterfaceStub::getTestPredefinedTypeAttributeAttribute, + &ExtendedInterfaceStubRemoteEvent::onRemoteSetTestPredefinedTypeAttributeAttribute, + &ExtendedInterfaceStubRemoteEvent::onRemoteTestPredefinedTypeAttributeAttributeChanged, + &ExtendedInterfaceStubAdapter::fireTestPredefinedTypeAttributeAttributeChanged, + "u"); +CommonAPI::DBus::DBusGetAttributeStubDispatcher< + ExtendedInterfaceStub, + DerivedTypeCollection::TestStructExtended + > ExtendedInterfaceDBusStubAdapterInternal::getTestDerivedStructAttributeAttributeStubDispatcher(&ExtendedInterfaceStub::getTestDerivedStructAttributeAttribute, "(sqi)"); +CommonAPI::DBus::DBusSetObservableAttributeStubDispatcher< + ExtendedInterfaceStub, + DerivedTypeCollection::TestStructExtended + > ExtendedInterfaceDBusStubAdapterInternal::setTestDerivedStructAttributeAttributeStubDispatcher( + &ExtendedInterfaceStub::getTestDerivedStructAttributeAttribute, + &ExtendedInterfaceStubRemoteEvent::onRemoteSetTestDerivedStructAttributeAttribute, + &ExtendedInterfaceStubRemoteEvent::onRemoteTestDerivedStructAttributeAttributeChanged, + &ExtendedInterfaceStubAdapter::fireTestDerivedStructAttributeAttributeChanged, + "(sqi)"); +CommonAPI::DBus::DBusGetAttributeStubDispatcher< + ExtendedInterfaceStub, + DerivedTypeCollection::TestArrayUInt64 + > ExtendedInterfaceDBusStubAdapterInternal::getTestDerivedArrayAttributeAttributeStubDispatcher(&ExtendedInterfaceStub::getTestDerivedArrayAttributeAttribute, "at"); +CommonAPI::DBus::DBusSetObservableAttributeStubDispatcher< + ExtendedInterfaceStub, + DerivedTypeCollection::TestArrayUInt64 + > ExtendedInterfaceDBusStubAdapterInternal::setTestDerivedArrayAttributeAttributeStubDispatcher( + &ExtendedInterfaceStub::getTestDerivedArrayAttributeAttribute, + &ExtendedInterfaceStubRemoteEvent::onRemoteSetTestDerivedArrayAttributeAttribute, + &ExtendedInterfaceStubRemoteEvent::onRemoteTestDerivedArrayAttributeAttributeChanged, + &ExtendedInterfaceStubAdapter::fireTestDerivedArrayAttributeAttributeChanged, + "at"); +#endif + +CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< ExtendedInterfaceStub, std::tuple<uint32_t>, std::tuple<> - > testIntMethodExtendedStubDispatcher(&ExtendedInterfaceStub::TestIntMethodExtended, ""); + > ExtendedInterfaceDBusStubAdapterInternal::testIntMethodExtendedStubDispatcher(&ExtendedInterfaceStub::TestIntMethodExtended, ""); + +#ifdef WIN32 +CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< + ExtendedInterfaceStub, + std::tuple<>, + std::tuple<> + > ExtendedInterfaceDBusStubAdapterInternal::testEmptyMethodStubDispatcher(&ExtendedInterfaceStub::testEmptyMethod, ""); +CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< + ExtendedInterfaceStub, + std::tuple<uint32_t, std::string>, + std::tuple<> + > ExtendedInterfaceDBusStubAdapterInternal::testVoidPredefinedTypeMethodStubDispatcher(&ExtendedInterfaceStub::testVoidPredefinedTypeMethod, ""); +CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< + ExtendedInterfaceStub, + std::tuple<uint32_t, std::string>, + std::tuple<uint32_t, std::string> + > ExtendedInterfaceDBusStubAdapterInternal::testPredefinedTypeMethodStubDispatcher(&ExtendedInterfaceStub::testPredefinedTypeMethod, "us"); +CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< + ExtendedInterfaceStub, + std::tuple<DerivedTypeCollection::TestEnumExtended2, DerivedTypeCollection::TestMap>, + std::tuple<> + > ExtendedInterfaceDBusStubAdapterInternal::testVoidDerivedTypeMethodStubDispatcher(&ExtendedInterfaceStub::testVoidDerivedTypeMethod, ""); +CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< + ExtendedInterfaceStub, + std::tuple<DerivedTypeCollection::TestEnumExtended2, DerivedTypeCollection::TestMap>, + std::tuple<DerivedTypeCollection::TestEnumExtended2, DerivedTypeCollection::TestMap> + > ExtendedInterfaceDBusStubAdapterInternal::testDerivedTypeMethodStubDispatcher(&ExtendedInterfaceStub::testDerivedTypeMethod, "ia{ua(sq)}"); +CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< + ExtendedInterfaceStub, + std::tuple<std::vector<std::shared_ptr<DerivedTypeCollection::TestPolymorphicStruct>>>, + std::tuple<> + > ExtendedInterfaceDBusStubAdapterInternal::testArrayOfPolymorphicStructMethodStubDispatcher(&ExtendedInterfaceStub::TestArrayOfPolymorphicStructMethod, ""); +CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< + ExtendedInterfaceStub, + std::tuple<DerivedTypeCollection::MapIntToPolymorphic>, + std::tuple<> + > ExtendedInterfaceDBusStubAdapterInternal::testMapOfPolymorphicStructMethodStubDispatcher(&ExtendedInterfaceStub::TestMapOfPolymorphicStructMethod, ""); +CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< + ExtendedInterfaceStub, + std::tuple<DerivedTypeCollection::StructWithPolymorphicMember>, + std::tuple<> + > ExtendedInterfaceDBusStubAdapterInternal::testStructWithPolymorphicMemberMethodStubDispatcher(&ExtendedInterfaceStub::TestStructWithPolymorphicMemberMethod, ""); +CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< + ExtendedInterfaceStub, + std::tuple<DerivedTypeCollection::StructWithEnumKeyMap>, + std::tuple<> + > ExtendedInterfaceDBusStubAdapterInternal::testStructWithEnumKeyMapMemberStubDispatcher(&ExtendedInterfaceStub::TestStructWithEnumKeyMapMember, ""); +#endif + +#ifdef WIN32 +CommonAPI::DBus::DBusMethodWithReplyAdapterDispatcher< + ExtendedInterfaceStub, + ExtendedInterfaceStubAdapter, + std::tuple<>, + std::tuple<bool> + > ExtendedInterfaceDBusStubAdapterInternal::subscribeTestSelectiveBroadcastSelectiveStubDispatcher(&ExtendedInterfaceStubAdapter::subscribeForTestSelectiveBroadcastSelective, "b"); + +CommonAPI::DBus::DBusMethodWithReplyAdapterDispatcher< + ExtendedInterfaceStub, + ExtendedInterfaceStubAdapter, + std::tuple<>, + std::tuple<> + > ExtendedInterfaceDBusStubAdapterInternal::unsubscribeTestSelectiveBroadcastSelectiveStubDispatcher(&ExtendedInterfaceStubAdapter::unsubscribeFromTestSelectiveBroadcastSelective, ""); +CommonAPI::DBus::DBusMethodWithReplyAdapterDispatcher< + ExtendedInterfaceStub, + ExtendedInterfaceStubAdapter, + std::tuple<>, + std::tuple<bool> + > ExtendedInterfaceDBusStubAdapterInternal::subscribeTestBroadcastWithOutArgsSelectiveStubDispatcher(&ExtendedInterfaceStubAdapter::subscribeForTestBroadcastWithOutArgsSelective, "b"); + +CommonAPI::DBus::DBusMethodWithReplyAdapterDispatcher< + ExtendedInterfaceStub, + ExtendedInterfaceStubAdapter, + std::tuple<>, + std::tuple<> + > ExtendedInterfaceDBusStubAdapterInternal::unsubscribeTestBroadcastWithOutArgsSelectiveStubDispatcher(&ExtendedInterfaceStubAdapter::unsubscribeFromTestBroadcastWithOutArgsSelective, ""); +#endif const ExtendedInterfaceDBusStubAdapterHelper::StubDispatcherTable& ExtendedInterfaceDBusStubAdapterInternal::getStubDispatcherTable() { return stubDispatcherTable_; @@ -103,18 +223,48 @@ ExtendedInterfaceDBusStubAdapterInternal::ExtendedInterfaceDBusStubAdapterIntern dbusConnection, stub), stubDispatcherTable_({ - { { "TestIntMethodExtended", "u" }, &commonapi::tests::testIntMethodExtendedStubDispatcher } + { { "TestIntMethodExtended", "u" }, &commonapi::tests::ExtendedInterfaceDBusStubAdapterInternal::testIntMethodExtendedStubDispatcher } + #ifdef WIN32 + , + { { "getTestPredefinedTypeAttributeAttribute", "" }, &commonapi::tests::ExtendedInterfaceDBusStubAdapterInternal::getTestPredefinedTypeAttributeAttributeStubDispatcher } + , { { "setTestPredefinedTypeAttributeAttribute", "u" }, &commonapi::tests::ExtendedInterfaceDBusStubAdapterInternal::setTestPredefinedTypeAttributeAttributeStubDispatcher }, + { { "getTestDerivedStructAttributeAttribute", "" }, &commonapi::tests::ExtendedInterfaceDBusStubAdapterInternal::getTestDerivedStructAttributeAttributeStubDispatcher } + , { { "setTestDerivedStructAttributeAttribute", "(sqi)" }, &commonapi::tests::ExtendedInterfaceDBusStubAdapterInternal::setTestDerivedStructAttributeAttributeStubDispatcher }, + { { "getTestDerivedArrayAttributeAttribute", "" }, &commonapi::tests::ExtendedInterfaceDBusStubAdapterInternal::getTestDerivedArrayAttributeAttributeStubDispatcher } + , { { "setTestDerivedArrayAttributeAttribute", "at" }, &commonapi::tests::ExtendedInterfaceDBusStubAdapterInternal::setTestDerivedArrayAttributeAttributeStubDispatcher } + , + { { "testEmptyMethod", "" }, &commonapi::tests::ExtendedInterfaceDBusStubAdapterInternal::testEmptyMethodStubDispatcher }, + { { "testVoidPredefinedTypeMethod", "us" }, &commonapi::tests::ExtendedInterfaceDBusStubAdapterInternal::testVoidPredefinedTypeMethodStubDispatcher }, + { { "testPredefinedTypeMethod", "us" }, &commonapi::tests::ExtendedInterfaceDBusStubAdapterInternal::testPredefinedTypeMethodStubDispatcher }, + { { "testVoidDerivedTypeMethod", "ia{ua(sq)}" }, &commonapi::tests::ExtendedInterfaceDBusStubAdapterInternal::testVoidDerivedTypeMethodStubDispatcher }, + { { "testDerivedTypeMethod", "ia{ua(sq)}" }, &commonapi::tests::ExtendedInterfaceDBusStubAdapterInternal::testDerivedTypeMethodStubDispatcher }, + { { "TestArrayOfPolymorphicStructMethod", "a(uv)" }, &commonapi::tests::ExtendedInterfaceDBusStubAdapterInternal::testArrayOfPolymorphicStructMethodStubDispatcher }, + { { "TestMapOfPolymorphicStructMethod", "a{y(uv)}" }, &commonapi::tests::ExtendedInterfaceDBusStubAdapterInternal::testMapOfPolymorphicStructMethodStubDispatcher }, + { { "TestStructWithPolymorphicMemberMethod", "(u(uv))" }, &commonapi::tests::ExtendedInterfaceDBusStubAdapterInternal::testStructWithPolymorphicMemberMethodStubDispatcher }, + { { "TestStructWithEnumKeyMapMember", "(a{is})" }, &commonapi::tests::ExtendedInterfaceDBusStubAdapterInternal::testStructWithEnumKeyMapMemberStubDispatcher } + , + { { "subscribeForTestSelectiveBroadcastSelective", "" }, &commonapi::tests::ExtendedInterfaceDBusStubAdapterInternal::subscribeTestSelectiveBroadcastSelectiveStubDispatcher } + , + { { "unsubscribeFromTestSelectiveBroadcastSelective", "" }, &commonapi::tests::ExtendedInterfaceDBusStubAdapterInternal::unsubscribeTestSelectiveBroadcastSelectiveStubDispatcher }, + { { "subscribeForTestBroadcastWithOutArgsSelective", "" }, &commonapi::tests::ExtendedInterfaceDBusStubAdapterInternal::subscribeTestBroadcastWithOutArgsSelectiveStubDispatcher } + , + { { "unsubscribeFromTestBroadcastWithOutArgsSelective", "" }, &commonapi::tests::ExtendedInterfaceDBusStubAdapterInternal::unsubscribeTestBroadcastWithOutArgsSelectiveStubDispatcher } + #endif }) { + #ifdef WIN32 + stubDispatcherTable_.insert({ { "getInterfaceVersion", "" }, &commonapi::tests::ExtendedInterfaceDBusStubAdapterInternal::getExtendedInterfaceInterfaceVersionStubDispatcher }); + #else auto parentDispatcherTable = TestInterfaceDBusStubAdapterInternal::getStubDispatcherTable(); stubDispatcherTable_.insert(parentDispatcherTable.begin(), parentDispatcherTable.end()); auto interfaceVersionGetter = stubDispatcherTable_.find({ "getInterfaceVersion", "" }); if(interfaceVersionGetter != stubDispatcherTable_.end()) { - interfaceVersionGetter->second = &commonapi::tests::getExtendedInterfaceInterfaceVersionStubDispatcher; + interfaceVersionGetter->second = &commonapi::tests::ExtendedInterfaceDBusStubAdapterInternal::getExtendedInterfaceInterfaceVersionStubDispatcher; } else { - stubDispatcherTable_.insert({ { "getInterfaceVersion", "" }, &commonapi::tests::getExtendedInterfaceInterfaceVersionStubDispatcher }); + stubDispatcherTable_.insert({ { "getInterfaceVersion", "" }, &commonapi::tests::ExtendedInterfaceDBusStubAdapterInternal::getExtendedInterfaceInterfaceVersionStubDispatcher }); } + #endif } } // namespace tests diff --git a/src/test/commonapi/tests/ExtendedInterfaceDBusStubAdapter.h b/src/test/commonapi/tests/ExtendedInterfaceDBusStubAdapter.h index b713f45..3d2f23e 100644 --- a/src/test/commonapi/tests/ExtendedInterfaceDBusStubAdapter.h +++ b/src/test/commonapi/tests/ExtendedInterfaceDBusStubAdapter.h @@ -29,7 +29,7 @@ namespace tests { typedef CommonAPI::DBus::DBusStubAdapterHelper<ExtendedInterfaceStub> ExtendedInterfaceDBusStubAdapterHelper; -class ExtendedInterfaceDBusStubAdapterInternal: public ExtendedInterfaceStubAdapter, public ExtendedInterfaceDBusStubAdapterHelper, public TestInterfaceDBusStubAdapterInternal { +class ExtendedInterfaceDBusStubAdapterInternal: public virtual ExtendedInterfaceStubAdapter, public ExtendedInterfaceDBusStubAdapterHelper, public TestInterfaceDBusStubAdapterInternal { public: ExtendedInterfaceDBusStubAdapterInternal( const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, @@ -66,17 +66,134 @@ class ExtendedInterfaceDBusStubAdapterInternal: public ExtendedInterfaceStubAdap } virtual void init(std::shared_ptr<DBusStubAdapter> instance) { - return DBusStubAdapter::init(instance); + return ExtendedInterfaceDBusStubAdapterHelper::init(instance); } virtual void deinit() { - return DBusStubAdapter::deinit(); + return ExtendedInterfaceDBusStubAdapterHelper::deinit(); } virtual bool onInterfaceDBusMessage(const CommonAPI::DBus::DBusMessage& dbusMessage) { return ExtendedInterfaceDBusStubAdapterHelper::onInterfaceDBusMessage(dbusMessage); } +static CommonAPI::DBus::DBusGetAttributeStubDispatcher< + ExtendedInterfaceStub, + CommonAPI::Version + > getExtendedInterfaceInterfaceVersionStubDispatcher; + + +#ifdef WIN32 +static CommonAPI::DBus::DBusGetAttributeStubDispatcher< + ExtendedInterfaceStub, + uint32_t + > getTestPredefinedTypeAttributeAttributeStubDispatcher; +static CommonAPI::DBus::DBusSetObservableAttributeStubDispatcher< + ExtendedInterfaceStub, + uint32_t + > setTestPredefinedTypeAttributeAttributeStubDispatcher; +static CommonAPI::DBus::DBusGetAttributeStubDispatcher< + ExtendedInterfaceStub, + DerivedTypeCollection::TestStructExtended + > getTestDerivedStructAttributeAttributeStubDispatcher; +static CommonAPI::DBus::DBusSetObservableAttributeStubDispatcher< + ExtendedInterfaceStub, + DerivedTypeCollection::TestStructExtended + > setTestDerivedStructAttributeAttributeStubDispatcher; +static CommonAPI::DBus::DBusGetAttributeStubDispatcher< + ExtendedInterfaceStub, + DerivedTypeCollection::TestArrayUInt64 + > getTestDerivedArrayAttributeAttributeStubDispatcher; +static CommonAPI::DBus::DBusSetObservableAttributeStubDispatcher< + ExtendedInterfaceStub, + DerivedTypeCollection::TestArrayUInt64 + > setTestDerivedArrayAttributeAttributeStubDispatcher; +#endif + +static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< + ExtendedInterfaceStub, + std::tuple<uint32_t>, + std::tuple<> + > testIntMethodExtendedStubDispatcher; + +#ifdef WIN32 +static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< + ExtendedInterfaceStub, + std::tuple<>, + std::tuple<> + > testEmptyMethodStubDispatcher; +static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< + ExtendedInterfaceStub, + std::tuple<uint32_t, std::string>, + std::tuple<> + > testVoidPredefinedTypeMethodStubDispatcher; +static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< + ExtendedInterfaceStub, + std::tuple<uint32_t, std::string>, + std::tuple<uint32_t, std::string> + > testPredefinedTypeMethodStubDispatcher; +static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< + ExtendedInterfaceStub, + std::tuple<DerivedTypeCollection::TestEnumExtended2, DerivedTypeCollection::TestMap>, + std::tuple<> + > testVoidDerivedTypeMethodStubDispatcher; +static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< + ExtendedInterfaceStub, + std::tuple<DerivedTypeCollection::TestEnumExtended2, DerivedTypeCollection::TestMap>, + std::tuple<DerivedTypeCollection::TestEnumExtended2, DerivedTypeCollection::TestMap> + > testDerivedTypeMethodStubDispatcher; +static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< + ExtendedInterfaceStub, + std::tuple<std::vector<std::shared_ptr<DerivedTypeCollection::TestPolymorphicStruct>>>, + std::tuple<> + > testArrayOfPolymorphicStructMethodStubDispatcher; +static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< + ExtendedInterfaceStub, + std::tuple<DerivedTypeCollection::MapIntToPolymorphic>, + std::tuple<> + > testMapOfPolymorphicStructMethodStubDispatcher; +static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< + ExtendedInterfaceStub, + std::tuple<DerivedTypeCollection::StructWithPolymorphicMember>, + std::tuple<> + > testStructWithPolymorphicMemberMethodStubDispatcher; +static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< + ExtendedInterfaceStub, + std::tuple<DerivedTypeCollection::StructWithEnumKeyMap>, + std::tuple<> + > testStructWithEnumKeyMapMemberStubDispatcher; +#endif + + +#ifdef WIN32 +static CommonAPI::DBus::DBusMethodWithReplyAdapterDispatcher< + ExtendedInterfaceStub, + ExtendedInterfaceStubAdapter, + std::tuple<>, + std::tuple<bool> + > subscribeTestSelectiveBroadcastSelectiveStubDispatcher; + +static CommonAPI::DBus::DBusMethodWithReplyAdapterDispatcher< + ExtendedInterfaceStub, + ExtendedInterfaceStubAdapter, + std::tuple<>, + std::tuple<> + > unsubscribeTestSelectiveBroadcastSelectiveStubDispatcher; +static CommonAPI::DBus::DBusMethodWithReplyAdapterDispatcher< + ExtendedInterfaceStub, + ExtendedInterfaceStubAdapter, + std::tuple<>, + std::tuple<bool> + > subscribeTestBroadcastWithOutArgsSelectiveStubDispatcher; + +static CommonAPI::DBus::DBusMethodWithReplyAdapterDispatcher< + ExtendedInterfaceStub, + ExtendedInterfaceStubAdapter, + std::tuple<>, + std::tuple<> + > unsubscribeTestBroadcastWithOutArgsSelectiveStubDispatcher; +#endif + protected: virtual const char* getMethodsDBusIntrospectionXmlData() const; diff --git a/src/test/commonapi/tests/ExtendedInterfaceProxy.h b/src/test/commonapi/tests/ExtendedInterfaceProxy.h index af09b7f..18bae29 100644 --- a/src/test/commonapi/tests/ExtendedInterfaceProxy.h +++ b/src/test/commonapi/tests/ExtendedInterfaceProxy.h @@ -108,6 +108,12 @@ public: std::shared_ptr<ExtendedInterfaceProxyBase> delegate_; }; +#ifdef WIN32 + typedef ExtendedInterfaceProxy<CommonAPI::WINDummyAttributeExtension<CommonAPI::WINDummyAttribute>> ExtendedInterfaceProxyDefault; +#else + typedef ExtendedInterfaceProxy<> ExtendedInterfaceProxyDefault; +#endif + // // ExtendedInterfaceProxy Implementation diff --git a/src/test/commonapi/tests/ExtendedInterfaceStub.h b/src/test/commonapi/tests/ExtendedInterfaceStub.h index b8b42d0..7e253ac 100644 --- a/src/test/commonapi/tests/ExtendedInterfaceStub.h +++ b/src/test/commonapi/tests/ExtendedInterfaceStub.h @@ -35,7 +35,7 @@ namespace tests { * 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 { +class ExtendedInterfaceStubAdapter: virtual public CommonAPI::StubAdapter, public ExtendedInterface, public virtual TestInterfaceStubAdapter { public: @@ -61,7 +61,7 @@ protected: * 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 { +class ExtendedInterfaceStubRemoteEvent: public virtual TestInterfaceStubRemoteEvent { public: virtual ~ExtendedInterfaceStubRemoteEvent() { } @@ -74,7 +74,7 @@ class ExtendedInterfaceStubRemoteEvent { * 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 { +class ExtendedInterfaceStub: public virtual CommonAPI::Stub<ExtendedInterfaceStubAdapter, ExtendedInterfaceStubRemoteEvent>, public virtual TestInterfaceStub { public: virtual ~ExtendedInterfaceStub() { } virtual const CommonAPI::Version& getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> clientId) = 0; @@ -86,6 +86,8 @@ public: using CommonAPI::Stub<ExtendedInterfaceStubAdapter, ExtendedInterfaceStubRemoteEvent>::initStubAdapter; typedef CommonAPI::Stub<ExtendedInterfaceStubAdapter, ExtendedInterfaceStubRemoteEvent>::StubAdapterType StubAdapterType; typedef CommonAPI::Stub<ExtendedInterfaceStubAdapter, ExtendedInterfaceStubRemoteEvent>::RemoteEventHandlerType RemoteEventHandlerType; + typedef ExtendedInterfaceStubRemoteEvent RemoteEventType; + typedef ExtendedInterface StubInterface; }; } // namespace tests diff --git a/src/test/commonapi/tests/ExtendedInterfaceStubDefault.cpp b/src/test/commonapi/tests/ExtendedInterfaceStubDefault.cpp index d5d4f62..468a5e7 100644 --- a/src/test/commonapi/tests/ExtendedInterfaceStubDefault.cpp +++ b/src/test/commonapi/tests/ExtendedInterfaceStubDefault.cpp @@ -22,6 +22,7 @@ const CommonAPI::Version& ExtendedInterfaceStubDefault::getInterfaceVersion(std: } ExtendedInterfaceStubRemoteEvent* ExtendedInterfaceStubDefault::initStubAdapter(const std::shared_ptr<ExtendedInterfaceStubAdapter>& stubAdapter) { + TestInterfaceStubDefault::initStubAdapter(stubAdapter); CommonAPI::Stub<ExtendedInterfaceStubAdapter, ExtendedInterfaceStubRemoteEvent>::stubAdapter_ = stubAdapter; return &remoteEventHandler_; } @@ -39,6 +40,7 @@ void ExtendedInterfaceStubDefault::TestIntMethodExtended(uint32_t inInt) { ExtendedInterfaceStubDefault::RemoteEventHandler::RemoteEventHandler(ExtendedInterfaceStubDefault* defaultStub): + TestInterfaceStubDefault::RemoteEventHandler(defaultStub), defaultStub_(defaultStub) { } diff --git a/src/test/commonapi/tests/ExtendedInterfaceStubDefault.h b/src/test/commonapi/tests/ExtendedInterfaceStubDefault.h index d7601f3..7117532 100644 --- a/src/test/commonapi/tests/ExtendedInterfaceStubDefault.h +++ b/src/test/commonapi/tests/ExtendedInterfaceStubDefault.h @@ -44,8 +44,7 @@ public: protected: -private: - class RemoteEventHandler: public ExtendedInterfaceStubRemoteEvent { + class RemoteEventHandler: public virtual ExtendedInterfaceStubRemoteEvent, public virtual TestInterfaceStubDefault::RemoteEventHandler { public: RemoteEventHandler(ExtendedInterfaceStubDefault* defaultStub); @@ -53,8 +52,8 @@ private: private: ExtendedInterfaceStubDefault* defaultStub_; }; - - RemoteEventHandler remoteEventHandler_; +private: + ExtendedInterfaceStubDefault::RemoteEventHandler remoteEventHandler_; CommonAPI::Version interfaceVersion_; diff --git a/src/test/commonapi/tests/TestInterfaceDBusProxy.cpp b/src/test/commonapi/tests/TestInterfaceDBusProxy.cpp index c04c828..bb0d482 100644 --- a/src/test/commonapi/tests/TestInterfaceDBusProxy.cpp +++ b/src/test/commonapi/tests/TestInterfaceDBusProxy.cpp @@ -22,7 +22,7 @@ std::shared_ptr<CommonAPI::DBus::DBusProxy> createTestInterfaceDBusProxy( return std::make_shared<TestInterfaceDBusProxy>(factory, commonApiAddress, interfaceName, busName, objectPath, dbusProxyConnection); } -__attribute__((constructor)) void registerTestInterfaceDBusProxy(void) { +INITIALIZER(registerTestInterfaceDBusProxy) { CommonAPI::DBus::DBusFactory::registerProxyFactoryMethod(TestInterface::getInterfaceId(), &createTestInterfaceDBusProxy); } diff --git a/src/test/commonapi/tests/TestInterfaceDBusStubAdapter.cpp b/src/test/commonapi/tests/TestInterfaceDBusStubAdapter.cpp index ed057ba..32d2294 100644 --- a/src/test/commonapi/tests/TestInterfaceDBusStubAdapter.cpp +++ b/src/test/commonapi/tests/TestInterfaceDBusStubAdapter.cpp @@ -24,7 +24,7 @@ std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> createTestInterfaceDBusStubAda return std::make_shared<TestInterfaceDBusStubAdapter>(factory, commonApiAddress, interfaceName, busName, objectPath, dbusProxyConnection, stubBase); } -__attribute__((constructor)) void registerTestInterfaceDBusStubAdapter(void) { +INITIALIZER(registerTestInterfaceDBusStubAdapter) { CommonAPI::DBus::DBusFactory::registerAdapterFactoryMethod(TestInterface::getInterfaceId(), &createTestInterfaceDBusStubAdapter); } @@ -37,6 +37,7 @@ TestInterfaceDBusStubAdapterInternal::~TestInterfaceDBusStubAdapterInternal() { } void TestInterfaceDBusStubAdapterInternal::deactivateManagedInstances() { + } const char* TestInterfaceDBusStubAdapterInternal::getMethodsDBusIntrospectionXmlData() const { @@ -123,47 +124,45 @@ const char* TestInterfaceDBusStubAdapterInternal::getMethodsDBusIntrospectionXml return introspectionData.c_str(); } -static CommonAPI::DBus::DBusGetAttributeStubDispatcher< +CommonAPI::DBus::DBusGetAttributeStubDispatcher< TestInterfaceStub, CommonAPI::Version - > getTestInterfaceInterfaceVersionStubDispatcher(&TestInterfaceStub::getInterfaceVersion, "uu"); + > TestInterfaceDBusStubAdapterInternal::getTestInterfaceInterfaceVersionStubDispatcher(&TestInterfaceStub::getInterfaceVersion, "uu"); -static CommonAPI::DBus::DBusGetAttributeStubDispatcher< +CommonAPI::DBus::DBusGetAttributeStubDispatcher< TestInterfaceStub, uint32_t - > getTestPredefinedTypeAttributeAttributeStubDispatcher(&TestInterfaceStub::getTestPredefinedTypeAttributeAttribute, "u"); -static CommonAPI::DBus::DBusSetObservableAttributeStubDispatcher< + > TestInterfaceDBusStubAdapterInternal::getTestPredefinedTypeAttributeAttributeStubDispatcher(&TestInterfaceStub::getTestPredefinedTypeAttributeAttribute, "u"); +CommonAPI::DBus::DBusSetObservableAttributeStubDispatcher< TestInterfaceStub, uint32_t - > setTestPredefinedTypeAttributeAttributeStubDispatcher( + > TestInterfaceDBusStubAdapterInternal::setTestPredefinedTypeAttributeAttributeStubDispatcher( &TestInterfaceStub::getTestPredefinedTypeAttributeAttribute, &TestInterfaceStubRemoteEvent::onRemoteSetTestPredefinedTypeAttributeAttribute, &TestInterfaceStubRemoteEvent::onRemoteTestPredefinedTypeAttributeAttributeChanged, &TestInterfaceStubAdapter::fireTestPredefinedTypeAttributeAttributeChanged, "u"); - -static CommonAPI::DBus::DBusGetAttributeStubDispatcher< +CommonAPI::DBus::DBusGetAttributeStubDispatcher< TestInterfaceStub, DerivedTypeCollection::TestStructExtended - > getTestDerivedStructAttributeAttributeStubDispatcher(&TestInterfaceStub::getTestDerivedStructAttributeAttribute, "(sqi)"); -static CommonAPI::DBus::DBusSetObservableAttributeStubDispatcher< + > TestInterfaceDBusStubAdapterInternal::getTestDerivedStructAttributeAttributeStubDispatcher(&TestInterfaceStub::getTestDerivedStructAttributeAttribute, "(sqi)"); +CommonAPI::DBus::DBusSetObservableAttributeStubDispatcher< TestInterfaceStub, DerivedTypeCollection::TestStructExtended - > setTestDerivedStructAttributeAttributeStubDispatcher( + > TestInterfaceDBusStubAdapterInternal::setTestDerivedStructAttributeAttributeStubDispatcher( &TestInterfaceStub::getTestDerivedStructAttributeAttribute, &TestInterfaceStubRemoteEvent::onRemoteSetTestDerivedStructAttributeAttribute, &TestInterfaceStubRemoteEvent::onRemoteTestDerivedStructAttributeAttributeChanged, &TestInterfaceStubAdapter::fireTestDerivedStructAttributeAttributeChanged, "(sqi)"); - -static CommonAPI::DBus::DBusGetAttributeStubDispatcher< +CommonAPI::DBus::DBusGetAttributeStubDispatcher< TestInterfaceStub, DerivedTypeCollection::TestArrayUInt64 - > getTestDerivedArrayAttributeAttributeStubDispatcher(&TestInterfaceStub::getTestDerivedArrayAttributeAttribute, "at"); -static CommonAPI::DBus::DBusSetObservableAttributeStubDispatcher< + > TestInterfaceDBusStubAdapterInternal::getTestDerivedArrayAttributeAttributeStubDispatcher(&TestInterfaceStub::getTestDerivedArrayAttributeAttribute, "at"); +CommonAPI::DBus::DBusSetObservableAttributeStubDispatcher< TestInterfaceStub, DerivedTypeCollection::TestArrayUInt64 - > setTestDerivedArrayAttributeAttributeStubDispatcher( + > TestInterfaceDBusStubAdapterInternal::setTestDerivedArrayAttributeAttributeStubDispatcher( &TestInterfaceStub::getTestDerivedArrayAttributeAttribute, &TestInterfaceStubRemoteEvent::onRemoteSetTestDerivedArrayAttributeAttribute, &TestInterfaceStubRemoteEvent::onRemoteTestDerivedArrayAttributeAttributeChanged, @@ -171,51 +170,52 @@ static CommonAPI::DBus::DBusSetObservableAttributeStubDispatcher< "at"); -static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< +CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< TestInterfaceStub, std::tuple<>, std::tuple<> - > testEmptyMethodStubDispatcher(&TestInterfaceStub::testEmptyMethod, ""); -static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< + > TestInterfaceDBusStubAdapterInternal::testEmptyMethodStubDispatcher(&TestInterfaceStub::testEmptyMethod, ""); +CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< TestInterfaceStub, std::tuple<uint32_t, std::string>, std::tuple<> - > testVoidPredefinedTypeMethodStubDispatcher(&TestInterfaceStub::testVoidPredefinedTypeMethod, ""); -static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< + > TestInterfaceDBusStubAdapterInternal::testVoidPredefinedTypeMethodStubDispatcher(&TestInterfaceStub::testVoidPredefinedTypeMethod, ""); +CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< TestInterfaceStub, std::tuple<uint32_t, std::string>, std::tuple<uint32_t, std::string> - > testPredefinedTypeMethodStubDispatcher(&TestInterfaceStub::testPredefinedTypeMethod, "us"); -static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< + > TestInterfaceDBusStubAdapterInternal::testPredefinedTypeMethodStubDispatcher(&TestInterfaceStub::testPredefinedTypeMethod, "us"); +CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< TestInterfaceStub, std::tuple<DerivedTypeCollection::TestEnumExtended2, DerivedTypeCollection::TestMap>, std::tuple<> - > testVoidDerivedTypeMethodStubDispatcher(&TestInterfaceStub::testVoidDerivedTypeMethod, ""); -static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< + > TestInterfaceDBusStubAdapterInternal::testVoidDerivedTypeMethodStubDispatcher(&TestInterfaceStub::testVoidDerivedTypeMethod, ""); +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< + > TestInterfaceDBusStubAdapterInternal::testDerivedTypeMethodStubDispatcher(&TestInterfaceStub::testDerivedTypeMethod, "ia{ua(sq)}"); +CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< TestInterfaceStub, std::tuple<std::vector<std::shared_ptr<DerivedTypeCollection::TestPolymorphicStruct>>>, std::tuple<> - > testArrayOfPolymorphicStructMethodStubDispatcher(&TestInterfaceStub::TestArrayOfPolymorphicStructMethod, ""); -static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< + > TestInterfaceDBusStubAdapterInternal::testArrayOfPolymorphicStructMethodStubDispatcher(&TestInterfaceStub::TestArrayOfPolymorphicStructMethod, ""); +CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< TestInterfaceStub, std::tuple<DerivedTypeCollection::MapIntToPolymorphic>, std::tuple<> - > testMapOfPolymorphicStructMethodStubDispatcher(&TestInterfaceStub::TestMapOfPolymorphicStructMethod, ""); -static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< + > TestInterfaceDBusStubAdapterInternal::testMapOfPolymorphicStructMethodStubDispatcher(&TestInterfaceStub::TestMapOfPolymorphicStructMethod, ""); +CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< TestInterfaceStub, std::tuple<DerivedTypeCollection::StructWithPolymorphicMember>, std::tuple<> - > testStructWithPolymorphicMemberMethodStubDispatcher(&TestInterfaceStub::TestStructWithPolymorphicMemberMethod, ""); -static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< + > TestInterfaceDBusStubAdapterInternal::testStructWithPolymorphicMemberMethodStubDispatcher(&TestInterfaceStub::TestStructWithPolymorphicMemberMethod, ""); +CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< TestInterfaceStub, std::tuple<DerivedTypeCollection::StructWithEnumKeyMap>, std::tuple<> - > testStructWithEnumKeyMapMemberStubDispatcher(&TestInterfaceStub::TestStructWithEnumKeyMapMember, ""); + > TestInterfaceDBusStubAdapterInternal::testStructWithEnumKeyMapMemberStubDispatcher(&TestInterfaceStub::TestStructWithEnumKeyMapMember, ""); + void TestInterfaceDBusStubAdapterInternal::fireTestPredefinedTypeAttributeAttributeChanged(const uint32_t& value) { CommonAPI::DBus::DBusStubSignalHelper<CommonAPI::DBus::DBusSerializableArguments<uint32_t>> @@ -254,20 +254,19 @@ void TestInterfaceDBusStubAdapterInternal::fireTestPredefinedTypeBroadcastEvent( uint32Value, stringValue ); } -static CommonAPI::DBus::DBusMethodWithReplyAdapterDispatcher< +CommonAPI::DBus::DBusMethodWithReplyAdapterDispatcher< TestInterfaceStub, TestInterfaceStubAdapter, std::tuple<>, std::tuple<bool> - > subscribeTestSelectiveBroadcastSelectiveStubDispatcher(&TestInterfaceStubAdapter::subscribeForTestSelectiveBroadcastSelective, "b"); + > TestInterfaceDBusStubAdapterInternal::subscribeTestSelectiveBroadcastSelectiveStubDispatcher(&TestInterfaceStubAdapter::subscribeForTestSelectiveBroadcastSelective, "b"); -static CommonAPI::DBus::DBusMethodWithReplyAdapterDispatcher< +CommonAPI::DBus::DBusMethodWithReplyAdapterDispatcher< TestInterfaceStub, TestInterfaceStubAdapter, std::tuple<>, std::tuple<> - > unsubscribeTestSelectiveBroadcastSelectiveStubDispatcher(&TestInterfaceStubAdapter::unsubscribeFromTestSelectiveBroadcastSelective, ""); - + > TestInterfaceDBusStubAdapterInternal::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); @@ -323,20 +322,19 @@ std::shared_ptr<CommonAPI::ClientIdList> const TestInterfaceDBusStubAdapterInter return subscribersForTestSelectiveBroadcastSelective_; } -static CommonAPI::DBus::DBusMethodWithReplyAdapterDispatcher< +CommonAPI::DBus::DBusMethodWithReplyAdapterDispatcher< TestInterfaceStub, TestInterfaceStubAdapter, std::tuple<>, std::tuple<bool> - > subscribeTestBroadcastWithOutArgsSelectiveStubDispatcher(&TestInterfaceStubAdapter::subscribeForTestBroadcastWithOutArgsSelective, "b"); + > TestInterfaceDBusStubAdapterInternal::subscribeTestBroadcastWithOutArgsSelectiveStubDispatcher(&TestInterfaceStubAdapter::subscribeForTestBroadcastWithOutArgsSelective, "b"); -static CommonAPI::DBus::DBusMethodWithReplyAdapterDispatcher< +CommonAPI::DBus::DBusMethodWithReplyAdapterDispatcher< TestInterfaceStub, TestInterfaceStubAdapter, std::tuple<>, std::tuple<> - > unsubscribeTestBroadcastWithOutArgsSelectiveStubDispatcher(&TestInterfaceStubAdapter::unsubscribeFromTestBroadcastWithOutArgsSelective, ""); - + > TestInterfaceDBusStubAdapterInternal::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); @@ -394,6 +392,7 @@ std::shared_ptr<CommonAPI::ClientIdList> const TestInterfaceDBusStubAdapterInter } + const TestInterfaceDBusStubAdapterHelper::StubDispatcherTable& TestInterfaceDBusStubAdapterInternal::getStubDispatcherTable() { return stubDispatcherTable_; } @@ -425,32 +424,34 @@ TestInterfaceDBusStubAdapterInternal::TestInterfaceDBusStubAdapterInternal( 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 } + { { "getTestPredefinedTypeAttributeAttribute", "" }, &commonapi::tests::TestInterfaceDBusStubAdapterInternal::getTestPredefinedTypeAttributeAttributeStubDispatcher } + , { { "setTestPredefinedTypeAttributeAttribute", "u" }, &commonapi::tests::TestInterfaceDBusStubAdapterInternal::setTestPredefinedTypeAttributeAttributeStubDispatcher }, + { { "getTestDerivedStructAttributeAttribute", "" }, &commonapi::tests::TestInterfaceDBusStubAdapterInternal::getTestDerivedStructAttributeAttributeStubDispatcher } + , { { "setTestDerivedStructAttributeAttribute", "(sqi)" }, &commonapi::tests::TestInterfaceDBusStubAdapterInternal::setTestDerivedStructAttributeAttributeStubDispatcher }, + { { "getTestDerivedArrayAttributeAttribute", "" }, &commonapi::tests::TestInterfaceDBusStubAdapterInternal::getTestDerivedArrayAttributeAttributeStubDispatcher } + , { { "setTestDerivedArrayAttributeAttribute", "at" }, &commonapi::tests::TestInterfaceDBusStubAdapterInternal::setTestDerivedArrayAttributeAttributeStubDispatcher } + , + { { "testEmptyMethod", "" }, &commonapi::tests::TestInterfaceDBusStubAdapterInternal::testEmptyMethodStubDispatcher }, + { { "testVoidPredefinedTypeMethod", "us" }, &commonapi::tests::TestInterfaceDBusStubAdapterInternal::testVoidPredefinedTypeMethodStubDispatcher }, + { { "testPredefinedTypeMethod", "us" }, &commonapi::tests::TestInterfaceDBusStubAdapterInternal::testPredefinedTypeMethodStubDispatcher }, + { { "testVoidDerivedTypeMethod", "ia{ua(sq)}" }, &commonapi::tests::TestInterfaceDBusStubAdapterInternal::testVoidDerivedTypeMethodStubDispatcher }, + { { "testDerivedTypeMethod", "ia{ua(sq)}" }, &commonapi::tests::TestInterfaceDBusStubAdapterInternal::testDerivedTypeMethodStubDispatcher }, + { { "TestArrayOfPolymorphicStructMethod", "a(uv)" }, &commonapi::tests::TestInterfaceDBusStubAdapterInternal::testArrayOfPolymorphicStructMethodStubDispatcher }, + { { "TestMapOfPolymorphicStructMethod", "a{y(uv)}" }, &commonapi::tests::TestInterfaceDBusStubAdapterInternal::testMapOfPolymorphicStructMethodStubDispatcher }, + { { "TestStructWithPolymorphicMemberMethod", "(u(uv))" }, &commonapi::tests::TestInterfaceDBusStubAdapterInternal::testStructWithPolymorphicMemberMethodStubDispatcher }, + { { "TestStructWithEnumKeyMapMember", "(a{is})" }, &commonapi::tests::TestInterfaceDBusStubAdapterInternal::testStructWithEnumKeyMapMemberStubDispatcher } + , + { { "subscribeForTestSelectiveBroadcastSelective", "" }, &commonapi::tests::TestInterfaceDBusStubAdapterInternal::subscribeTestSelectiveBroadcastSelectiveStubDispatcher } , - { { "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", "(a{is})" }, &commonapi::tests::testStructWithEnumKeyMapMemberStubDispatcher } + { { "unsubscribeFromTestSelectiveBroadcastSelective", "" }, &commonapi::tests::TestInterfaceDBusStubAdapterInternal::unsubscribeTestSelectiveBroadcastSelectiveStubDispatcher }, + { { "subscribeForTestBroadcastWithOutArgsSelective", "" }, &commonapi::tests::TestInterfaceDBusStubAdapterInternal::subscribeTestBroadcastWithOutArgsSelectiveStubDispatcher } , - { { "subscribeForTestSelectiveBroadcastSelective", "" }, &commonapi::tests::subscribeTestSelectiveBroadcastSelectiveStubDispatcher }, - { { "unsubscribeFromTestSelectiveBroadcastSelective", "" }, &commonapi::tests::unsubscribeTestSelectiveBroadcastSelectiveStubDispatcher }, - { { "subscribeForTestBroadcastWithOutArgsSelective", "" }, &commonapi::tests::subscribeTestBroadcastWithOutArgsSelectiveStubDispatcher }, - { { "unsubscribeFromTestBroadcastWithOutArgsSelective", "" }, &commonapi::tests::unsubscribeTestBroadcastWithOutArgsSelectiveStubDispatcher } + { { "unsubscribeFromTestBroadcastWithOutArgsSelective", "" }, &commonapi::tests::TestInterfaceDBusStubAdapterInternal::unsubscribeTestBroadcastWithOutArgsSelectiveStubDispatcher } }) { subscribersForTestSelectiveBroadcastSelective_ = std::make_shared<CommonAPI::ClientIdList>(); subscribersForTestBroadcastWithOutArgsSelective_ = std::make_shared<CommonAPI::ClientIdList>(); - stubDispatcherTable_.insert({ { "getInterfaceVersion", "" }, &commonapi::tests::getTestInterfaceInterfaceVersionStubDispatcher }); + stubDispatcherTable_.insert({ { "getInterfaceVersion", "" }, &commonapi::tests::TestInterfaceDBusStubAdapterInternal::getTestInterfaceInterfaceVersionStubDispatcher }); } } // namespace tests diff --git a/src/test/commonapi/tests/TestInterfaceDBusStubAdapter.h b/src/test/commonapi/tests/TestInterfaceDBusStubAdapter.h index 2596cfe..f0f31ff 100644 --- a/src/test/commonapi/tests/TestInterfaceDBusStubAdapter.h +++ b/src/test/commonapi/tests/TestInterfaceDBusStubAdapter.h @@ -28,7 +28,7 @@ namespace tests { typedef CommonAPI::DBus::DBusStubAdapterHelper<TestInterfaceStub> TestInterfaceDBusStubAdapterHelper; -class TestInterfaceDBusStubAdapterInternal: public TestInterfaceStubAdapter, public TestInterfaceDBusStubAdapterHelper { +class TestInterfaceDBusStubAdapterInternal: public virtual TestInterfaceStubAdapter, public TestInterfaceDBusStubAdapterHelper { public: TestInterfaceDBusStubAdapterInternal( const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, @@ -63,6 +63,112 @@ class TestInterfaceDBusStubAdapterInternal: public TestInterfaceStubAdapter, pub void deactivateManagedInstances(); +static CommonAPI::DBus::DBusGetAttributeStubDispatcher< + TestInterfaceStub, + CommonAPI::Version + > getTestInterfaceInterfaceVersionStubDispatcher; + +static CommonAPI::DBus::DBusGetAttributeStubDispatcher< + TestInterfaceStub, + uint32_t + > getTestPredefinedTypeAttributeAttributeStubDispatcher; +static CommonAPI::DBus::DBusSetObservableAttributeStubDispatcher< + TestInterfaceStub, + uint32_t + > setTestPredefinedTypeAttributeAttributeStubDispatcher; +static CommonAPI::DBus::DBusGetAttributeStubDispatcher< + TestInterfaceStub, + DerivedTypeCollection::TestStructExtended + > getTestDerivedStructAttributeAttributeStubDispatcher; +static CommonAPI::DBus::DBusSetObservableAttributeStubDispatcher< + TestInterfaceStub, + DerivedTypeCollection::TestStructExtended + > setTestDerivedStructAttributeAttributeStubDispatcher; +static CommonAPI::DBus::DBusGetAttributeStubDispatcher< + TestInterfaceStub, + DerivedTypeCollection::TestArrayUInt64 + > getTestDerivedArrayAttributeAttributeStubDispatcher; +static CommonAPI::DBus::DBusSetObservableAttributeStubDispatcher< + TestInterfaceStub, + DerivedTypeCollection::TestArrayUInt64 + > setTestDerivedArrayAttributeAttributeStubDispatcher; + + +static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< + TestInterfaceStub, + std::tuple<>, + std::tuple<> + > testEmptyMethodStubDispatcher; +static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< + TestInterfaceStub, + std::tuple<uint32_t, std::string>, + std::tuple<> + > testVoidPredefinedTypeMethodStubDispatcher; +static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< + TestInterfaceStub, + std::tuple<uint32_t, std::string>, + std::tuple<uint32_t, std::string> + > testPredefinedTypeMethodStubDispatcher; +static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< + TestInterfaceStub, + std::tuple<DerivedTypeCollection::TestEnumExtended2, DerivedTypeCollection::TestMap>, + std::tuple<> + > testVoidDerivedTypeMethodStubDispatcher; +static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< + TestInterfaceStub, + std::tuple<DerivedTypeCollection::TestEnumExtended2, DerivedTypeCollection::TestMap>, + std::tuple<DerivedTypeCollection::TestEnumExtended2, DerivedTypeCollection::TestMap> + > testDerivedTypeMethodStubDispatcher; +static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< + TestInterfaceStub, + std::tuple<std::vector<std::shared_ptr<DerivedTypeCollection::TestPolymorphicStruct>>>, + std::tuple<> + > testArrayOfPolymorphicStructMethodStubDispatcher; +static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< + TestInterfaceStub, + std::tuple<DerivedTypeCollection::MapIntToPolymorphic>, + std::tuple<> + > testMapOfPolymorphicStructMethodStubDispatcher; +static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< + TestInterfaceStub, + std::tuple<DerivedTypeCollection::StructWithPolymorphicMember>, + std::tuple<> + > testStructWithPolymorphicMemberMethodStubDispatcher; +static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< + TestInterfaceStub, + std::tuple<DerivedTypeCollection::StructWithEnumKeyMap>, + std::tuple<> + > testStructWithEnumKeyMapMemberStubDispatcher; + + +static CommonAPI::DBus::DBusMethodWithReplyAdapterDispatcher< + TestInterfaceStub, + TestInterfaceStubAdapter, + std::tuple<>, + std::tuple<bool> + > subscribeTestSelectiveBroadcastSelectiveStubDispatcher; + +static CommonAPI::DBus::DBusMethodWithReplyAdapterDispatcher< + TestInterfaceStub, + TestInterfaceStubAdapter, + std::tuple<>, + std::tuple<> + > unsubscribeTestSelectiveBroadcastSelectiveStubDispatcher; +static CommonAPI::DBus::DBusMethodWithReplyAdapterDispatcher< + TestInterfaceStub, + TestInterfaceStubAdapter, + std::tuple<>, + std::tuple<bool> + > subscribeTestBroadcastWithOutArgsSelectiveStubDispatcher; + +static CommonAPI::DBus::DBusMethodWithReplyAdapterDispatcher< + TestInterfaceStub, + TestInterfaceStubAdapter, + std::tuple<>, + std::tuple<> + > unsubscribeTestBroadcastWithOutArgsSelectiveStubDispatcher; + + protected: virtual const char* getMethodsDBusIntrospectionXmlData() const; diff --git a/src/test/commonapi/tests/TestInterfaceProxy.h b/src/test/commonapi/tests/TestInterfaceProxy.h index 13ac60c..52491e2 100644 --- a/src/test/commonapi/tests/TestInterfaceProxy.h +++ b/src/test/commonapi/tests/TestInterfaceProxy.h @@ -302,6 +302,12 @@ public: std::shared_ptr<TestInterfaceProxyBase> delegate_; }; +#ifdef WIN32 + typedef TestInterfaceProxy<CommonAPI::WINDummyAttributeExtension<CommonAPI::WINDummyAttribute>> TestInterfaceProxyDefault; +#else + typedef TestInterfaceProxy<> TestInterfaceProxyDefault; +#endif + namespace TestInterfaceExtensions { template <template <typename > class _ExtensionType> class TestPredefinedTypeAttributeAttributeExtension { @@ -310,6 +316,9 @@ namespace TestInterfaceExtensions { static_assert(std::is_base_of<typename CommonAPI::AttributeExtension<TestInterfaceProxyBase::TestPredefinedTypeAttributeAttribute>, extension_type>::value, "Not CommonAPI Attribute Extension!"); + #ifdef WIN32 + TestPredefinedTypeAttributeAttributeExtension() {} + #endif TestPredefinedTypeAttributeAttributeExtension(TestInterfaceProxyBase& proxy): attributeExtension_(proxy.getTestPredefinedTypeAttributeAttribute()) { } @@ -329,6 +338,9 @@ namespace TestInterfaceExtensions { static_assert(std::is_base_of<typename CommonAPI::AttributeExtension<TestInterfaceProxyBase::TestDerivedStructAttributeAttribute>, extension_type>::value, "Not CommonAPI Attribute Extension!"); + #ifdef WIN32 + TestDerivedStructAttributeAttributeExtension() {} + #endif TestDerivedStructAttributeAttributeExtension(TestInterfaceProxyBase& proxy): attributeExtension_(proxy.getTestDerivedStructAttributeAttribute()) { } @@ -348,6 +360,9 @@ namespace TestInterfaceExtensions { static_assert(std::is_base_of<typename CommonAPI::AttributeExtension<TestInterfaceProxyBase::TestDerivedArrayAttributeAttribute>, extension_type>::value, "Not CommonAPI Attribute Extension!"); + #ifdef WIN32 + TestDerivedArrayAttributeAttributeExtension() {} + #endif TestDerivedArrayAttributeAttributeExtension(TestInterfaceProxyBase& proxy): attributeExtension_(proxy.getTestDerivedArrayAttributeAttribute()) { } diff --git a/src/test/commonapi/tests/TestInterfaceStub.h b/src/test/commonapi/tests/TestInterfaceStub.h index 77b72cf..d45ad3b 100644 --- a/src/test/commonapi/tests/TestInterfaceStub.h +++ b/src/test/commonapi/tests/TestInterfaceStub.h @@ -127,7 +127,7 @@ 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 virtual CommonAPI::Stub<TestInterfaceStubAdapter, TestInterfaceStubRemoteEvent> { +class TestInterfaceStub: public virtual CommonAPI::Stub<TestInterfaceStubAdapter, TestInterfaceStubRemoteEvent> { public: virtual ~TestInterfaceStub() { } virtual const CommonAPI::Version& getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> clientId) = 0; @@ -187,6 +187,8 @@ public: using CommonAPI::Stub<TestInterfaceStubAdapter, TestInterfaceStubRemoteEvent>::initStubAdapter; typedef CommonAPI::Stub<TestInterfaceStubAdapter, TestInterfaceStubRemoteEvent>::StubAdapterType StubAdapterType; typedef CommonAPI::Stub<TestInterfaceStubAdapter, TestInterfaceStubRemoteEvent>::RemoteEventHandlerType RemoteEventHandlerType; + typedef TestInterfaceStubRemoteEvent RemoteEventType; + typedef TestInterface StubInterface; }; } // namespace tests diff --git a/src/test/commonapi/tests/TestInterfaceStubDefault.h b/src/test/commonapi/tests/TestInterfaceStubDefault.h index 8eb7f93..e24ecdb 100644 --- a/src/test/commonapi/tests/TestInterfaceStubDefault.h +++ b/src/test/commonapi/tests/TestInterfaceStubDefault.h @@ -101,8 +101,7 @@ protected: virtual bool trySetTestDerivedArrayAttributeAttribute(DerivedTypeCollection::TestArrayUInt64 value); virtual bool validateTestDerivedArrayAttributeAttributeRequestedValue(const DerivedTypeCollection::TestArrayUInt64& value); virtual void onRemoteTestDerivedArrayAttributeAttributeChanged(); -private: - class RemoteEventHandler: public TestInterfaceStubRemoteEvent { + class RemoteEventHandler: public virtual TestInterfaceStubRemoteEvent { public: RemoteEventHandler(TestInterfaceStubDefault* defaultStub); @@ -122,8 +121,8 @@ private: private: TestInterfaceStubDefault* defaultStub_; }; - - RemoteEventHandler remoteEventHandler_; +private: + TestInterfaceStubDefault::RemoteEventHandler remoteEventHandler_; uint32_t testPredefinedTypeAttributeAttributeValue_; DerivedTypeCollection::TestStructExtended testDerivedStructAttributeAttributeValue_; diff --git a/src/test/commonapi/tests/managed/BranchInterfaceDBusProxy.cpp b/src/test/commonapi/tests/managed/BranchInterfaceDBusProxy.cpp index 1b62005..4757c27 100644 --- a/src/test/commonapi/tests/managed/BranchInterfaceDBusProxy.cpp +++ b/src/test/commonapi/tests/managed/BranchInterfaceDBusProxy.cpp @@ -23,7 +23,7 @@ std::shared_ptr<CommonAPI::DBus::DBusProxy> createBranchInterfaceDBusProxy( return std::make_shared<BranchInterfaceDBusProxy>(factory, commonApiAddress, interfaceName, busName, objectPath, dbusProxyConnection); } -__attribute__((constructor)) void registerBranchInterfaceDBusProxy(void) { +INITIALIZER(registerBranchInterfaceDBusProxy) { CommonAPI::DBus::DBusFactory::registerProxyFactoryMethod(BranchInterface::getInterfaceId(), &createBranchInterfaceDBusProxy); } diff --git a/src/test/commonapi/tests/managed/BranchInterfaceDBusStubAdapter.cpp b/src/test/commonapi/tests/managed/BranchInterfaceDBusStubAdapter.cpp index 70f9b51..9411f53 100644 --- a/src/test/commonapi/tests/managed/BranchInterfaceDBusStubAdapter.cpp +++ b/src/test/commonapi/tests/managed/BranchInterfaceDBusStubAdapter.cpp @@ -25,7 +25,7 @@ std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> createBranchInterfaceDBusStubA return std::make_shared<BranchInterfaceDBusStubAdapter>(factory, commonApiAddress, interfaceName, busName, objectPath, dbusProxyConnection, stubBase); } -__attribute__((constructor)) void registerBranchInterfaceDBusStubAdapter(void) { +INITIALIZER(registerBranchInterfaceDBusStubAdapter) { CommonAPI::DBus::DBusFactory::registerAdapterFactoryMethod(BranchInterface::getInterfaceId(), &createBranchInterfaceDBusStubAdapter); } @@ -38,6 +38,7 @@ BranchInterfaceDBusStubAdapterInternal::~BranchInterfaceDBusStubAdapterInternal( } void BranchInterfaceDBusStubAdapterInternal::deactivateManagedInstances() { + } const char* BranchInterfaceDBusStubAdapterInternal::getMethodsDBusIntrospectionXmlData() const { @@ -57,17 +58,20 @@ const char* BranchInterfaceDBusStubAdapterInternal::getMethodsDBusIntrospectionX return introspectionData.c_str(); } -static CommonAPI::DBus::DBusGetAttributeStubDispatcher< +CommonAPI::DBus::DBusGetAttributeStubDispatcher< BranchInterfaceStub, CommonAPI::Version - > getBranchInterfaceInterfaceVersionStubDispatcher(&BranchInterfaceStub::getInterfaceVersion, "uu"); + > BranchInterfaceDBusStubAdapterInternal::getBranchInterfaceInterfaceVersionStubDispatcher(&BranchInterfaceStub::getInterfaceVersion, "uu"); + -static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< +CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< BranchInterfaceStub, std::tuple<int32_t, std::string>, std::tuple<BranchInterface::testBranchMethodError, int32_t, std::string> - > testBranchMethodStubDispatcher(&BranchInterfaceStub::testBranchMethod, "iis"); + > BranchInterfaceDBusStubAdapterInternal::testBranchMethodStubDispatcher(&BranchInterfaceStub::testBranchMethod, "iis"); + + @@ -102,10 +106,10 @@ BranchInterfaceDBusStubAdapterInternal::BranchInterfaceDBusStubAdapterInternal( std::dynamic_pointer_cast<BranchInterfaceStub>(stub), false), stubDispatcherTable_({ - { { "testBranchMethod", "is" }, &commonapi::tests::managed::testBranchMethodStubDispatcher } + { { "testBranchMethod", "is" }, &commonapi::tests::managed::BranchInterfaceDBusStubAdapterInternal::testBranchMethodStubDispatcher } }) { - stubDispatcherTable_.insert({ { "getInterfaceVersion", "" }, &commonapi::tests::managed::getBranchInterfaceInterfaceVersionStubDispatcher }); + stubDispatcherTable_.insert({ { "getInterfaceVersion", "" }, &commonapi::tests::managed::BranchInterfaceDBusStubAdapterInternal::getBranchInterfaceInterfaceVersionStubDispatcher }); } } // namespace managed diff --git a/src/test/commonapi/tests/managed/BranchInterfaceDBusStubAdapter.h b/src/test/commonapi/tests/managed/BranchInterfaceDBusStubAdapter.h index bc9cfc8..730a0e5 100644 --- a/src/test/commonapi/tests/managed/BranchInterfaceDBusStubAdapter.h +++ b/src/test/commonapi/tests/managed/BranchInterfaceDBusStubAdapter.h @@ -29,7 +29,7 @@ namespace managed { typedef CommonAPI::DBus::DBusStubAdapterHelper<BranchInterfaceStub> BranchInterfaceDBusStubAdapterHelper; -class BranchInterfaceDBusStubAdapterInternal: public BranchInterfaceStubAdapter, public BranchInterfaceDBusStubAdapterHelper { +class BranchInterfaceDBusStubAdapterInternal: public virtual BranchInterfaceStubAdapter, public BranchInterfaceDBusStubAdapterHelper { public: BranchInterfaceDBusStubAdapterInternal( const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, @@ -50,6 +50,22 @@ class BranchInterfaceDBusStubAdapterInternal: public BranchInterfaceStubAdapter, void deactivateManagedInstances(); +static CommonAPI::DBus::DBusGetAttributeStubDispatcher< + BranchInterfaceStub, + CommonAPI::Version + > getBranchInterfaceInterfaceVersionStubDispatcher; + + + +static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< + BranchInterfaceStub, + std::tuple<int32_t, std::string>, + std::tuple<BranchInterface::testBranchMethodError, int32_t, std::string> + > testBranchMethodStubDispatcher; + + + + protected: virtual const char* getMethodsDBusIntrospectionXmlData() const; diff --git a/src/test/commonapi/tests/managed/BranchInterfaceProxy.h b/src/test/commonapi/tests/managed/BranchInterfaceProxy.h index 35ab437..c543d36 100644 --- a/src/test/commonapi/tests/managed/BranchInterfaceProxy.h +++ b/src/test/commonapi/tests/managed/BranchInterfaceProxy.h @@ -105,6 +105,12 @@ public: std::shared_ptr<BranchInterfaceProxyBase> delegate_; }; +#ifdef WIN32 + typedef BranchInterfaceProxy<CommonAPI::WINDummyAttributeExtension<CommonAPI::WINDummyAttribute>> BranchInterfaceProxyDefault; +#else + typedef BranchInterfaceProxy<> BranchInterfaceProxyDefault; +#endif + // // BranchInterfaceProxy Implementation diff --git a/src/test/commonapi/tests/managed/BranchInterfaceStub.h b/src/test/commonapi/tests/managed/BranchInterfaceStub.h index 034316b..e94b775 100644 --- a/src/test/commonapi/tests/managed/BranchInterfaceStub.h +++ b/src/test/commonapi/tests/managed/BranchInterfaceStub.h @@ -74,7 +74,7 @@ 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 virtual CommonAPI::Stub<BranchInterfaceStubAdapter, BranchInterfaceStubRemoteEvent> { +class BranchInterfaceStub: public virtual CommonAPI::Stub<BranchInterfaceStubAdapter, BranchInterfaceStubRemoteEvent> { public: virtual ~BranchInterfaceStub() { } virtual const CommonAPI::Version& getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> clientId) = 0; @@ -86,6 +86,8 @@ public: using CommonAPI::Stub<BranchInterfaceStubAdapter, BranchInterfaceStubRemoteEvent>::initStubAdapter; typedef CommonAPI::Stub<BranchInterfaceStubAdapter, BranchInterfaceStubRemoteEvent>::StubAdapterType StubAdapterType; typedef CommonAPI::Stub<BranchInterfaceStubAdapter, BranchInterfaceStubRemoteEvent>::RemoteEventHandlerType RemoteEventHandlerType; + typedef BranchInterfaceStubRemoteEvent RemoteEventType; + typedef BranchInterface StubInterface; }; } // namespace managed diff --git a/src/test/commonapi/tests/managed/BranchInterfaceStubDefault.h b/src/test/commonapi/tests/managed/BranchInterfaceStubDefault.h index 7d992c9..bb1459b 100644 --- a/src/test/commonapi/tests/managed/BranchInterfaceStubDefault.h +++ b/src/test/commonapi/tests/managed/BranchInterfaceStubDefault.h @@ -44,8 +44,7 @@ public: protected: -private: - class RemoteEventHandler: public BranchInterfaceStubRemoteEvent { + class RemoteEventHandler: public virtual BranchInterfaceStubRemoteEvent { public: RemoteEventHandler(BranchInterfaceStubDefault* defaultStub); @@ -53,8 +52,8 @@ private: private: BranchInterfaceStubDefault* defaultStub_; }; - - RemoteEventHandler remoteEventHandler_; +private: + BranchInterfaceStubDefault::RemoteEventHandler remoteEventHandler_; CommonAPI::Version interfaceVersion_; diff --git a/src/test/commonapi/tests/managed/LeafInterfaceDBusProxy.cpp b/src/test/commonapi/tests/managed/LeafInterfaceDBusProxy.cpp index 0a6eb8a..4616c17 100644 --- a/src/test/commonapi/tests/managed/LeafInterfaceDBusProxy.cpp +++ b/src/test/commonapi/tests/managed/LeafInterfaceDBusProxy.cpp @@ -23,7 +23,7 @@ std::shared_ptr<CommonAPI::DBus::DBusProxy> createLeafInterfaceDBusProxy( return std::make_shared<LeafInterfaceDBusProxy>(factory, commonApiAddress, interfaceName, busName, objectPath, dbusProxyConnection); } -__attribute__((constructor)) void registerLeafInterfaceDBusProxy(void) { +INITIALIZER(registerLeafInterfaceDBusProxy) { CommonAPI::DBus::DBusFactory::registerProxyFactoryMethod(LeafInterface::getInterfaceId(), &createLeafInterfaceDBusProxy); } diff --git a/src/test/commonapi/tests/managed/LeafInterfaceDBusStubAdapter.cpp b/src/test/commonapi/tests/managed/LeafInterfaceDBusStubAdapter.cpp index 1a43690..5411efa 100644 --- a/src/test/commonapi/tests/managed/LeafInterfaceDBusStubAdapter.cpp +++ b/src/test/commonapi/tests/managed/LeafInterfaceDBusStubAdapter.cpp @@ -25,7 +25,7 @@ std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> createLeafInterfaceDBusStubAda return std::make_shared<LeafInterfaceDBusStubAdapter>(factory, commonApiAddress, interfaceName, busName, objectPath, dbusProxyConnection, stubBase); } -__attribute__((constructor)) void registerLeafInterfaceDBusStubAdapter(void) { +INITIALIZER(registerLeafInterfaceDBusStubAdapter) { CommonAPI::DBus::DBusFactory::registerAdapterFactoryMethod(LeafInterface::getInterfaceId(), &createLeafInterfaceDBusStubAdapter); } @@ -38,6 +38,7 @@ LeafInterfaceDBusStubAdapterInternal::~LeafInterfaceDBusStubAdapterInternal() { } void LeafInterfaceDBusStubAdapterInternal::deactivateManagedInstances() { + } const char* LeafInterfaceDBusStubAdapterInternal::getMethodsDBusIntrospectionXmlData() const { @@ -57,17 +58,20 @@ const char* LeafInterfaceDBusStubAdapterInternal::getMethodsDBusIntrospectionXml return introspectionData.c_str(); } -static CommonAPI::DBus::DBusGetAttributeStubDispatcher< +CommonAPI::DBus::DBusGetAttributeStubDispatcher< LeafInterfaceStub, CommonAPI::Version - > getLeafInterfaceInterfaceVersionStubDispatcher(&LeafInterfaceStub::getInterfaceVersion, "uu"); + > LeafInterfaceDBusStubAdapterInternal::getLeafInterfaceInterfaceVersionStubDispatcher(&LeafInterfaceStub::getInterfaceVersion, "uu"); + -static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< +CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< LeafInterfaceStub, std::tuple<int32_t, std::string>, std::tuple<LeafInterface::testLeafMethodError, int32_t, std::string> - > testLeafMethodStubDispatcher(&LeafInterfaceStub::testLeafMethod, "iis"); + > LeafInterfaceDBusStubAdapterInternal::testLeafMethodStubDispatcher(&LeafInterfaceStub::testLeafMethod, "iis"); + + @@ -102,10 +106,10 @@ LeafInterfaceDBusStubAdapterInternal::LeafInterfaceDBusStubAdapterInternal( std::dynamic_pointer_cast<LeafInterfaceStub>(stub), false), stubDispatcherTable_({ - { { "testLeafMethod", "is" }, &commonapi::tests::managed::testLeafMethodStubDispatcher } + { { "testLeafMethod", "is" }, &commonapi::tests::managed::LeafInterfaceDBusStubAdapterInternal::testLeafMethodStubDispatcher } }) { - stubDispatcherTable_.insert({ { "getInterfaceVersion", "" }, &commonapi::tests::managed::getLeafInterfaceInterfaceVersionStubDispatcher }); + stubDispatcherTable_.insert({ { "getInterfaceVersion", "" }, &commonapi::tests::managed::LeafInterfaceDBusStubAdapterInternal::getLeafInterfaceInterfaceVersionStubDispatcher }); } } // namespace managed diff --git a/src/test/commonapi/tests/managed/LeafInterfaceDBusStubAdapter.h b/src/test/commonapi/tests/managed/LeafInterfaceDBusStubAdapter.h index 1dc3d81..4819095 100644 --- a/src/test/commonapi/tests/managed/LeafInterfaceDBusStubAdapter.h +++ b/src/test/commonapi/tests/managed/LeafInterfaceDBusStubAdapter.h @@ -29,7 +29,7 @@ namespace managed { typedef CommonAPI::DBus::DBusStubAdapterHelper<LeafInterfaceStub> LeafInterfaceDBusStubAdapterHelper; -class LeafInterfaceDBusStubAdapterInternal: public LeafInterfaceStubAdapter, public LeafInterfaceDBusStubAdapterHelper { +class LeafInterfaceDBusStubAdapterInternal: public virtual LeafInterfaceStubAdapter, public LeafInterfaceDBusStubAdapterHelper { public: LeafInterfaceDBusStubAdapterInternal( const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, @@ -50,6 +50,22 @@ class LeafInterfaceDBusStubAdapterInternal: public LeafInterfaceStubAdapter, pub void deactivateManagedInstances(); +static CommonAPI::DBus::DBusGetAttributeStubDispatcher< + LeafInterfaceStub, + CommonAPI::Version + > getLeafInterfaceInterfaceVersionStubDispatcher; + + + +static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< + LeafInterfaceStub, + std::tuple<int32_t, std::string>, + std::tuple<LeafInterface::testLeafMethodError, int32_t, std::string> + > testLeafMethodStubDispatcher; + + + + protected: virtual const char* getMethodsDBusIntrospectionXmlData() const; diff --git a/src/test/commonapi/tests/managed/LeafInterfaceProxy.h b/src/test/commonapi/tests/managed/LeafInterfaceProxy.h index f83f6e6..289e3c3 100644 --- a/src/test/commonapi/tests/managed/LeafInterfaceProxy.h +++ b/src/test/commonapi/tests/managed/LeafInterfaceProxy.h @@ -105,6 +105,12 @@ public: std::shared_ptr<LeafInterfaceProxyBase> delegate_; }; +#ifdef WIN32 + typedef LeafInterfaceProxy<CommonAPI::WINDummyAttributeExtension<CommonAPI::WINDummyAttribute>> LeafInterfaceProxyDefault; +#else + typedef LeafInterfaceProxy<> LeafInterfaceProxyDefault; +#endif + // // LeafInterfaceProxy Implementation diff --git a/src/test/commonapi/tests/managed/LeafInterfaceStub.h b/src/test/commonapi/tests/managed/LeafInterfaceStub.h index 2224922..e93cdf0 100644 --- a/src/test/commonapi/tests/managed/LeafInterfaceStub.h +++ b/src/test/commonapi/tests/managed/LeafInterfaceStub.h @@ -74,7 +74,7 @@ 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 virtual CommonAPI::Stub<LeafInterfaceStubAdapter, LeafInterfaceStubRemoteEvent> { +class LeafInterfaceStub: public virtual CommonAPI::Stub<LeafInterfaceStubAdapter, LeafInterfaceStubRemoteEvent> { public: virtual ~LeafInterfaceStub() { } virtual const CommonAPI::Version& getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> clientId) = 0; @@ -86,6 +86,8 @@ public: using CommonAPI::Stub<LeafInterfaceStubAdapter, LeafInterfaceStubRemoteEvent>::initStubAdapter; typedef CommonAPI::Stub<LeafInterfaceStubAdapter, LeafInterfaceStubRemoteEvent>::StubAdapterType StubAdapterType; typedef CommonAPI::Stub<LeafInterfaceStubAdapter, LeafInterfaceStubRemoteEvent>::RemoteEventHandlerType RemoteEventHandlerType; + typedef LeafInterfaceStubRemoteEvent RemoteEventType; + typedef LeafInterface StubInterface; }; } // namespace managed diff --git a/src/test/commonapi/tests/managed/LeafInterfaceStubDefault.h b/src/test/commonapi/tests/managed/LeafInterfaceStubDefault.h index dfaadb2..c0bd5b1 100644 --- a/src/test/commonapi/tests/managed/LeafInterfaceStubDefault.h +++ b/src/test/commonapi/tests/managed/LeafInterfaceStubDefault.h @@ -44,8 +44,7 @@ public: protected: -private: - class RemoteEventHandler: public LeafInterfaceStubRemoteEvent { + class RemoteEventHandler: public virtual LeafInterfaceStubRemoteEvent { public: RemoteEventHandler(LeafInterfaceStubDefault* defaultStub); @@ -53,8 +52,8 @@ private: private: LeafInterfaceStubDefault* defaultStub_; }; - - RemoteEventHandler remoteEventHandler_; +private: + LeafInterfaceStubDefault::RemoteEventHandler remoteEventHandler_; CommonAPI::Version interfaceVersion_; diff --git a/src/test/commonapi/tests/managed/RootInterfaceDBusProxy.cpp b/src/test/commonapi/tests/managed/RootInterfaceDBusProxy.cpp index ddfe44c..1c4e8c8 100644 --- a/src/test/commonapi/tests/managed/RootInterfaceDBusProxy.cpp +++ b/src/test/commonapi/tests/managed/RootInterfaceDBusProxy.cpp @@ -23,7 +23,7 @@ std::shared_ptr<CommonAPI::DBus::DBusProxy> createRootInterfaceDBusProxy( return std::make_shared<RootInterfaceDBusProxy>(factory, commonApiAddress, interfaceName, busName, objectPath, dbusProxyConnection); } -__attribute__((constructor)) void registerRootInterfaceDBusProxy(void) { +INITIALIZER(registerRootInterfaceDBusProxy) { CommonAPI::DBus::DBusFactory::registerProxyFactoryMethod(RootInterface::getInterfaceId(), &createRootInterfaceDBusProxy); } diff --git a/src/test/commonapi/tests/managed/RootInterfaceDBusStubAdapter.cpp b/src/test/commonapi/tests/managed/RootInterfaceDBusStubAdapter.cpp index 5f56fe5..7fa1c1b 100644 --- a/src/test/commonapi/tests/managed/RootInterfaceDBusStubAdapter.cpp +++ b/src/test/commonapi/tests/managed/RootInterfaceDBusStubAdapter.cpp @@ -25,7 +25,7 @@ std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> createRootInterfaceDBusStubAda return std::make_shared<RootInterfaceDBusStubAdapter>(factory, commonApiAddress, interfaceName, busName, objectPath, dbusProxyConnection, stubBase); } -__attribute__((constructor)) void registerRootInterfaceDBusStubAdapter(void) { +INITIALIZER(registerRootInterfaceDBusStubAdapter) { CommonAPI::DBus::DBusFactory::registerAdapterFactoryMethod(RootInterface::getInterfaceId(), &createRootInterfaceDBusStubAdapter); } @@ -38,13 +38,30 @@ RootInterfaceDBusStubAdapterInternal::~RootInterfaceDBusStubAdapterInternal() { } void RootInterfaceDBusStubAdapterInternal::deactivateManagedInstances() { - for(std::set<std::string>::iterator iter = registeredLeafInterfaceInstances.begin(); - iter != registeredLeafInterfaceInstances.end(); ++iter) { - deregisterManagedStubLeafInterface(*iter); + std::set<std::string>::iterator iter; + std::set<std::string>::iterator iterNext; + + iter = registeredLeafInterfaceInstances.begin(); + while (iter != registeredLeafInterfaceInstances.end()) { + iterNext = std::next(iter); + + if (deregisterManagedStubLeafInterface(*iter)) { + iter = iterNext; + } + else { + iter++; + } } - for(std::set<std::string>::iterator iter = registeredBranchInterfaceInstances.begin(); - iter != registeredBranchInterfaceInstances.end(); ++iter) { - deregisterManagedStubBranchInterface(*iter); + iter = registeredBranchInterfaceInstances.begin(); + while (iter != registeredBranchInterfaceInstances.end()) { + iterNext = std::next(iter); + + if (deregisterManagedStubBranchInterface(*iter)) { + iter = iterNext; + } + else { + iter++; + } } } @@ -65,17 +82,20 @@ const char* RootInterfaceDBusStubAdapterInternal::getMethodsDBusIntrospectionXml return introspectionData.c_str(); } -static CommonAPI::DBus::DBusGetAttributeStubDispatcher< +CommonAPI::DBus::DBusGetAttributeStubDispatcher< RootInterfaceStub, CommonAPI::Version - > getRootInterfaceInterfaceVersionStubDispatcher(&RootInterfaceStub::getInterfaceVersion, "uu"); + > RootInterfaceDBusStubAdapterInternal::getRootInterfaceInterfaceVersionStubDispatcher(&RootInterfaceStub::getInterfaceVersion, "uu"); + -static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< +CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< RootInterfaceStub, std::tuple<int32_t, std::string>, std::tuple<RootInterface::testRootMethodError, int32_t, std::string> - > testRootMethodStubDispatcher(&RootInterfaceStub::testRootMethod, "iis"); + > RootInterfaceDBusStubAdapterInternal::testRootMethodStubDispatcher(&RootInterfaceStub::testRootMethod, "iis"); + + @@ -218,10 +238,10 @@ RootInterfaceDBusStubAdapterInternal::RootInterfaceDBusStubAdapterInternal( std::dynamic_pointer_cast<RootInterfaceStub>(stub), true), stubDispatcherTable_({ - { { "testRootMethod", "is" }, &commonapi::tests::managed::testRootMethodStubDispatcher } + { { "testRootMethod", "is" }, &commonapi::tests::managed::RootInterfaceDBusStubAdapterInternal::testRootMethodStubDispatcher } }) { - stubDispatcherTable_.insert({ { "getInterfaceVersion", "" }, &commonapi::tests::managed::getRootInterfaceInterfaceVersionStubDispatcher }); + stubDispatcherTable_.insert({ { "getInterfaceVersion", "" }, &commonapi::tests::managed::RootInterfaceDBusStubAdapterInternal::getRootInterfaceInterfaceVersionStubDispatcher }); } } // namespace managed diff --git a/src/test/commonapi/tests/managed/RootInterfaceDBusStubAdapter.h b/src/test/commonapi/tests/managed/RootInterfaceDBusStubAdapter.h index fadd1d3..929e6c5 100644 --- a/src/test/commonapi/tests/managed/RootInterfaceDBusStubAdapter.h +++ b/src/test/commonapi/tests/managed/RootInterfaceDBusStubAdapter.h @@ -29,7 +29,7 @@ namespace managed { typedef CommonAPI::DBus::DBusStubAdapterHelper<RootInterfaceStub> RootInterfaceDBusStubAdapterHelper; -class RootInterfaceDBusStubAdapterInternal: public RootInterfaceStubAdapter, public RootInterfaceDBusStubAdapterHelper { +class RootInterfaceDBusStubAdapterInternal: public virtual RootInterfaceStubAdapter, public RootInterfaceDBusStubAdapterHelper { public: RootInterfaceDBusStubAdapterInternal( const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, @@ -56,6 +56,22 @@ class RootInterfaceDBusStubAdapterInternal: public RootInterfaceStubAdapter, pub void deactivateManagedInstances(); +static CommonAPI::DBus::DBusGetAttributeStubDispatcher< + RootInterfaceStub, + CommonAPI::Version + > getRootInterfaceInterfaceVersionStubDispatcher; + + + +static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< + RootInterfaceStub, + std::tuple<int32_t, std::string>, + std::tuple<RootInterface::testRootMethodError, int32_t, std::string> + > testRootMethodStubDispatcher; + + + + protected: virtual const char* getMethodsDBusIntrospectionXmlData() const; diff --git a/src/test/commonapi/tests/managed/RootInterfaceProxy.h b/src/test/commonapi/tests/managed/RootInterfaceProxy.h index 511090f..e128995 100644 --- a/src/test/commonapi/tests/managed/RootInterfaceProxy.h +++ b/src/test/commonapi/tests/managed/RootInterfaceProxy.h @@ -107,6 +107,12 @@ public: std::shared_ptr<RootInterfaceProxyBase> delegate_; }; +#ifdef WIN32 + typedef RootInterfaceProxy<CommonAPI::WINDummyAttributeExtension<CommonAPI::WINDummyAttribute>> RootInterfaceProxyDefault; +#else + typedef RootInterfaceProxy<> RootInterfaceProxyDefault; +#endif + // // RootInterfaceProxy Implementation diff --git a/src/test/commonapi/tests/managed/RootInterfaceStub.h b/src/test/commonapi/tests/managed/RootInterfaceStub.h index 2e1f878..de224f6 100644 --- a/src/test/commonapi/tests/managed/RootInterfaceStub.h +++ b/src/test/commonapi/tests/managed/RootInterfaceStub.h @@ -82,7 +82,7 @@ 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 virtual CommonAPI::Stub<RootInterfaceStubAdapter, RootInterfaceStubRemoteEvent> { +class RootInterfaceStub: public virtual CommonAPI::Stub<RootInterfaceStubAdapter, RootInterfaceStubRemoteEvent> { public: virtual ~RootInterfaceStub() { } virtual const CommonAPI::Version& getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> clientId) = 0; @@ -100,6 +100,8 @@ public: using CommonAPI::Stub<RootInterfaceStubAdapter, RootInterfaceStubRemoteEvent>::initStubAdapter; typedef CommonAPI::Stub<RootInterfaceStubAdapter, RootInterfaceStubRemoteEvent>::StubAdapterType StubAdapterType; typedef CommonAPI::Stub<RootInterfaceStubAdapter, RootInterfaceStubRemoteEvent>::RemoteEventHandlerType RemoteEventHandlerType; + typedef RootInterfaceStubRemoteEvent RemoteEventType; + typedef RootInterface StubInterface; }; } // namespace managed diff --git a/src/test/commonapi/tests/managed/RootInterfaceStubDefault.h b/src/test/commonapi/tests/managed/RootInterfaceStubDefault.h index 3bcb0f5..a68bde3 100644 --- a/src/test/commonapi/tests/managed/RootInterfaceStubDefault.h +++ b/src/test/commonapi/tests/managed/RootInterfaceStubDefault.h @@ -52,8 +52,7 @@ public: std::set<std::string>& getBranchInterfaceInstances(); protected: -private: - class RemoteEventHandler: public RootInterfaceStubRemoteEvent { + class RemoteEventHandler: public virtual RootInterfaceStubRemoteEvent { public: RemoteEventHandler(RootInterfaceStubDefault* defaultStub); @@ -61,8 +60,8 @@ private: private: RootInterfaceStubDefault* defaultStub_; }; - - RemoteEventHandler remoteEventHandler_; +private: + RootInterfaceStubDefault::RemoteEventHandler remoteEventHandler_; uint32_t autoInstanceCounter_; diff --git a/src/test/commonapi/tests/managed/SecondRootDBusProxy.cpp b/src/test/commonapi/tests/managed/SecondRootDBusProxy.cpp index dbb2bd1..25e0588 100644 --- a/src/test/commonapi/tests/managed/SecondRootDBusProxy.cpp +++ b/src/test/commonapi/tests/managed/SecondRootDBusProxy.cpp @@ -23,7 +23,7 @@ std::shared_ptr<CommonAPI::DBus::DBusProxy> createSecondRootDBusProxy( return std::make_shared<SecondRootDBusProxy>(factory, commonApiAddress, interfaceName, busName, objectPath, dbusProxyConnection); } -__attribute__((constructor)) void registerSecondRootDBusProxy(void) { +INITIALIZER(registerSecondRootDBusProxy) { CommonAPI::DBus::DBusFactory::registerProxyFactoryMethod(SecondRoot::getInterfaceId(), &createSecondRootDBusProxy); } diff --git a/src/test/commonapi/tests/managed/SecondRootDBusStubAdapter.cpp b/src/test/commonapi/tests/managed/SecondRootDBusStubAdapter.cpp index 2664ca2..20ccd2b 100644 --- a/src/test/commonapi/tests/managed/SecondRootDBusStubAdapter.cpp +++ b/src/test/commonapi/tests/managed/SecondRootDBusStubAdapter.cpp @@ -25,7 +25,7 @@ std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> createSecondRootDBusStubAdapte return std::make_shared<SecondRootDBusStubAdapter>(factory, commonApiAddress, interfaceName, busName, objectPath, dbusProxyConnection, stubBase); } -__attribute__((constructor)) void registerSecondRootDBusStubAdapter(void) { +INITIALIZER(registerSecondRootDBusStubAdapter) { CommonAPI::DBus::DBusFactory::registerAdapterFactoryMethod(SecondRoot::getInterfaceId(), &createSecondRootDBusStubAdapter); } @@ -38,9 +38,19 @@ SecondRootDBusStubAdapterInternal::~SecondRootDBusStubAdapterInternal() { } void SecondRootDBusStubAdapterInternal::deactivateManagedInstances() { - for(std::set<std::string>::iterator iter = registeredLeafInterfaceInstances.begin(); - iter != registeredLeafInterfaceInstances.end(); ++iter) { - deregisterManagedStubLeafInterface(*iter); + std::set<std::string>::iterator iter; + std::set<std::string>::iterator iterNext; + + iter = registeredLeafInterfaceInstances.begin(); + while (iter != registeredLeafInterfaceInstances.end()) { + iterNext = std::next(iter); + + if (deregisterManagedStubLeafInterface(*iter)) { + iter = iterNext; + } + else { + iter++; + } } } @@ -55,10 +65,13 @@ const char* SecondRootDBusStubAdapterInternal::getMethodsDBusIntrospectionXmlDat return introspectionData.c_str(); } -static CommonAPI::DBus::DBusGetAttributeStubDispatcher< +CommonAPI::DBus::DBusGetAttributeStubDispatcher< SecondRootStub, CommonAPI::Version - > getSecondRootInterfaceVersionStubDispatcher(&SecondRootStub::getInterfaceVersion, "uu"); + > SecondRootDBusStubAdapterInternal::getSecondRootInterfaceVersionStubDispatcher(&SecondRootStub::getInterfaceVersion, "uu"); + + + @@ -151,7 +164,7 @@ SecondRootDBusStubAdapterInternal::SecondRootDBusStubAdapterInternal( stubDispatcherTable_({ }) { - stubDispatcherTable_.insert({ { "getInterfaceVersion", "" }, &commonapi::tests::managed::getSecondRootInterfaceVersionStubDispatcher }); + stubDispatcherTable_.insert({ { "getInterfaceVersion", "" }, &commonapi::tests::managed::SecondRootDBusStubAdapterInternal::getSecondRootInterfaceVersionStubDispatcher }); } } // namespace managed diff --git a/src/test/commonapi/tests/managed/SecondRootDBusStubAdapter.h b/src/test/commonapi/tests/managed/SecondRootDBusStubAdapter.h index 70ef6eb..4a2afde 100644 --- a/src/test/commonapi/tests/managed/SecondRootDBusStubAdapter.h +++ b/src/test/commonapi/tests/managed/SecondRootDBusStubAdapter.h @@ -29,7 +29,7 @@ namespace managed { typedef CommonAPI::DBus::DBusStubAdapterHelper<SecondRootStub> SecondRootDBusStubAdapterHelper; -class SecondRootDBusStubAdapterInternal: public SecondRootStubAdapter, public SecondRootDBusStubAdapterHelper { +class SecondRootDBusStubAdapterInternal: public virtual SecondRootStubAdapter, public SecondRootDBusStubAdapterHelper { public: SecondRootDBusStubAdapterInternal( const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, @@ -53,6 +53,17 @@ class SecondRootDBusStubAdapterInternal: public SecondRootStubAdapter, public Se void deactivateManagedInstances(); +static CommonAPI::DBus::DBusGetAttributeStubDispatcher< + SecondRootStub, + CommonAPI::Version + > getSecondRootInterfaceVersionStubDispatcher; + + + + + + + protected: virtual const char* getMethodsDBusIntrospectionXmlData() const; diff --git a/src/test/commonapi/tests/managed/SecondRootProxy.h b/src/test/commonapi/tests/managed/SecondRootProxy.h index 4926155..0ce5699 100644 --- a/src/test/commonapi/tests/managed/SecondRootProxy.h +++ b/src/test/commonapi/tests/managed/SecondRootProxy.h @@ -85,6 +85,12 @@ public: std::shared_ptr<SecondRootProxyBase> delegate_; }; +#ifdef WIN32 + typedef SecondRootProxy<CommonAPI::WINDummyAttributeExtension<CommonAPI::WINDummyAttribute>> SecondRootProxyDefault; +#else + typedef SecondRootProxy<> SecondRootProxyDefault; +#endif + // // SecondRootProxy Implementation diff --git a/src/test/commonapi/tests/managed/SecondRootStub.h b/src/test/commonapi/tests/managed/SecondRootStub.h index b155f04..3eeb974 100644 --- a/src/test/commonapi/tests/managed/SecondRootStub.h +++ b/src/test/commonapi/tests/managed/SecondRootStub.h @@ -77,7 +77,7 @@ 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 virtual CommonAPI::Stub<SecondRootStubAdapter, SecondRootStubRemoteEvent> { +class SecondRootStub: public virtual CommonAPI::Stub<SecondRootStubAdapter, SecondRootStubRemoteEvent> { public: virtual ~SecondRootStub() { } virtual const CommonAPI::Version& getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> clientId) = 0; @@ -90,6 +90,8 @@ public: using CommonAPI::Stub<SecondRootStubAdapter, SecondRootStubRemoteEvent>::initStubAdapter; typedef CommonAPI::Stub<SecondRootStubAdapter, SecondRootStubRemoteEvent>::StubAdapterType StubAdapterType; typedef CommonAPI::Stub<SecondRootStubAdapter, SecondRootStubRemoteEvent>::RemoteEventHandlerType RemoteEventHandlerType; + typedef SecondRootStubRemoteEvent RemoteEventType; + typedef SecondRoot StubInterface; }; } // namespace managed diff --git a/src/test/commonapi/tests/managed/SecondRootStubDefault.h b/src/test/commonapi/tests/managed/SecondRootStubDefault.h index 22c095b..bf5025e 100644 --- a/src/test/commonapi/tests/managed/SecondRootStubDefault.h +++ b/src/test/commonapi/tests/managed/SecondRootStubDefault.h @@ -45,8 +45,7 @@ public: std::set<std::string>& getLeafInterfaceInstances(); protected: -private: - class RemoteEventHandler: public SecondRootStubRemoteEvent { + class RemoteEventHandler: public virtual SecondRootStubRemoteEvent { public: RemoteEventHandler(SecondRootStubDefault* defaultStub); @@ -54,8 +53,8 @@ private: private: SecondRootStubDefault* defaultStub_; }; - - RemoteEventHandler remoteEventHandler_; +private: + SecondRootStubDefault::RemoteEventHandler remoteEventHandler_; uint32_t autoInstanceCounter_; |