summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Rauwolf <rauwolf@itestra.de>2013-06-07 10:51:13 +0200
committerGerrit Code Review <qqmthk1@lpmodthk02.bmwgroup.net>2013-06-07 10:51:13 +0200
commitd9c34a751946950ad54360cff1ede66d073eb194 (patch)
tree0d4a849372861a22171a01a6822d29b7dd04e70c
parent152cd2b8f24ae2cdac8b6bed5f05c0cf3a40c4bf (diff)
parent9e619ce84bc8b9901192897abe2ec8a87a71b95b (diff)
downloadgenivi-common-api-dbus-runtime-d9c34a751946950ad54360cff1ede66d073eb194.tar.gz
Merge changes Ia821835a,I1a2f334b,I8912bdc8
* changes: tests: refactor to support clang compiler stream: fix assert logic for signature length object manager: add explicit map instantiation
-rw-r--r--src/CommonAPI/DBus/DBusInputStream.h1
-rw-r--r--src/CommonAPI/DBus/DBusObjectManager.cpp13
-rw-r--r--src/CommonAPI/DBus/DBusOutputStream.cpp10
-rw-r--r--src/test/DBusVariantTest.cpp2
-rw-r--r--src/test/commonapi/tests/DerivedTypeCollection.h18
-rw-r--r--src/test/commonapi/tests/TestInterfaceDBusStubAdapter.cpp32
-rw-r--r--src/test/commonapi/tests/TestInterfaceProxy.h38
7 files changed, 52 insertions, 62 deletions
diff --git a/src/CommonAPI/DBus/DBusInputStream.h b/src/CommonAPI/DBus/DBusInputStream.h
index f09be98..fb190c9 100644
--- a/src/CommonAPI/DBus/DBusInputStream.h
+++ b/src/CommonAPI/DBus/DBusInputStream.h
@@ -206,7 +206,6 @@ class DBusInputStream: public InputStream {
inline void skipOverSignature() {
uint8_t signatureLength;
readValue(signatureLength);
- assert(signatureLength < 256);
readRawData(signatureLength + 1);
}
diff --git a/src/CommonAPI/DBus/DBusObjectManager.cpp b/src/CommonAPI/DBus/DBusObjectManager.cpp
index 09ff9ba..6e78993 100644
--- a/src/CommonAPI/DBus/DBusObjectManager.cpp
+++ b/src/CommonAPI/DBus/DBusObjectManager.cpp
@@ -106,19 +106,20 @@ bool DBusObjectManager::onObjectManagerInterfaceDBusMessage(const DBusMessage& d
return false;
}
- DBusDaemonProxy::DBusObjectToInterfaceDict ObjectPathsInterfacesAndPropertiesDict;
+ DBusDaemonProxy::DBusObjectToInterfaceDict resultObjectPathsInterfacesAndPropertiesDict;
objectPathLock_.lock();
auto registeredObjectsIterator = dbusRegisteredObjectsTable_.begin();
while(registeredObjectsIterator != dbusRegisteredObjectsTable_.end()) {
DBusInterfaceHandlerPath handlerPath = registeredObjectsIterator->first;
- auto foundDictEntry = ObjectPathsInterfacesAndPropertiesDict.find(handlerPath.first);
+ auto foundDictEntry = resultObjectPathsInterfacesAndPropertiesDict.find(handlerPath.first);
- if (foundDictEntry == ObjectPathsInterfacesAndPropertiesDict.end()) {
- ObjectPathsInterfacesAndPropertiesDict.insert( { handlerPath.first, { { handlerPath.second, {} } } } );
+ if (foundDictEntry == resultObjectPathsInterfacesAndPropertiesDict.end()) {
+ resultObjectPathsInterfacesAndPropertiesDict.insert(
+ { handlerPath.first, { { handlerPath.second, DBusDaemonProxy::PropertyDictStub() } } } );
} else {
- foundDictEntry->second.insert( {handlerPath.second, {} } );
+ foundDictEntry->second.insert( {handlerPath.second, DBusDaemonProxy::PropertyDictStub() } );
}
++registeredObjectsIterator;
@@ -129,7 +130,7 @@ bool DBusObjectManager::onObjectManagerInterfaceDBusMessage(const DBusMessage& d
DBusMessage dbusMessageReply = dbusMessage.createMethodReturn(getManagedObjectsDBusSignature);
DBusOutputStream outStream(dbusMessageReply);
- outStream << ObjectPathsInterfacesAndPropertiesDict;
+ outStream << resultObjectPathsInterfacesAndPropertiesDict;
outStream.flush();
return dbusConnection->sendDBusMessage(dbusMessageReply);
diff --git a/src/CommonAPI/DBus/DBusOutputStream.cpp b/src/CommonAPI/DBus/DBusOutputStream.cpp
index cf84fe8..701a628 100644
--- a/src/CommonAPI/DBus/DBusOutputStream.cpp
+++ b/src/CommonAPI/DBus/DBusOutputStream.cpp
@@ -308,10 +308,12 @@ void DBusOutputStream::beginWriteGenericVector() {
}
void DBusOutputStream::writeSignature(const std::string& signature) {
- uint8_t length = (uint8_t) signature.length();
- assert(length < 256);
- *this << length;
- writeRawData(signature.c_str(), length + 1);
+ const auto& signatureLength = signature.length();
+ assert(signatureLength > 0 && signatureLength < 256);
+
+ const uint8_t wireLength = (uint8_t) signatureLength;
+ *this << wireLength;
+ writeRawData(signature.c_str(), wireLength + 1);
}
void DBusOutputStream::rememberCurrentStreamPosition() {
diff --git a/src/test/DBusVariantTest.cpp b/src/test/DBusVariantTest.cpp
index dae542f..c027a3f 100644
--- a/src/test/DBusVariantTest.cpp
+++ b/src/test/DBusVariantTest.cpp
@@ -17,7 +17,7 @@ class VariantTest: public ::testing::Test {
void SetUp() {
fromInt = 5;
- fromDouble = 12.344d;
+ fromDouble = 12.344;
fromString = "123abcsadfaljkawlöfasklöerklöfjasklfjysklfjaskfjsklösdfdko4jdfasdjioögjopefgip3rtgjiprg!";
}
diff --git a/src/test/commonapi/tests/DerivedTypeCollection.h b/src/test/commonapi/tests/DerivedTypeCollection.h
index 26409d6..5471910 100644
--- a/src/test/commonapi/tests/DerivedTypeCollection.h
+++ b/src/test/commonapi/tests/DerivedTypeCollection.h
@@ -49,10 +49,10 @@ namespace DerivedTypeCollection {
struct TestEnumComparator;
enum class TestEnumExtended: int32_t {
- E_UNKNOWN = TestEnum::E_UNKNOWN,
- E_OK = TestEnum::E_OK,
- E_OUT_OF_RANGE = TestEnum::E_OUT_OF_RANGE,
- E_NOT_USED = TestEnum::E_NOT_USED
+ E_UNKNOWN = (int32_t) TestEnum::E_UNKNOWN,
+ E_OK = (int32_t) TestEnum::E_OK,
+ E_OUT_OF_RANGE = (int32_t) TestEnum::E_OUT_OF_RANGE,
+ E_NOT_USED = (int32_t) TestEnum::E_NOT_USED
,
E_NEW = 4
};
@@ -61,12 +61,12 @@ namespace DerivedTypeCollection {
struct TestEnumExtendedComparator;
enum class TestEnumExtended2: int32_t {
- E_UNKNOWN = TestEnum::E_UNKNOWN,
- E_OK = TestEnum::E_OK,
- E_OUT_OF_RANGE = TestEnum::E_OUT_OF_RANGE,
- E_NOT_USED = TestEnum::E_NOT_USED,
+ E_UNKNOWN = (int32_t) TestEnum::E_UNKNOWN,
+ E_OK = (int32_t) TestEnum::E_OK,
+ E_OUT_OF_RANGE = (int32_t) TestEnum::E_OUT_OF_RANGE,
+ E_NOT_USED = (int32_t) TestEnum::E_NOT_USED,
- E_NEW = TestEnumExtended::E_NEW
+ E_NEW = (int32_t) TestEnumExtended::E_NEW
,
E_NEW2 = 5
};
diff --git a/src/test/commonapi/tests/TestInterfaceDBusStubAdapter.cpp b/src/test/commonapi/tests/TestInterfaceDBusStubAdapter.cpp
index 9145d2c..7a08c35 100644
--- a/src/test/commonapi/tests/TestInterfaceDBusStubAdapter.cpp
+++ b/src/test/commonapi/tests/TestInterfaceDBusStubAdapter.cpp
@@ -168,22 +168,6 @@ static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
> testDerivedTypeMethodStubDispatcher(&TestInterfaceStub::testDerivedTypeMethod, "ia{ua(sq)}");
-template<>
-const TestInterfaceDBusStubAdapterHelper::StubDispatcherTable TestInterfaceDBusStubAdapterHelper::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 }
-};
-
void TestInterfaceDBusStubAdapter::fireTestPredefinedTypeAttributeAttributeChanged(const uint32_t& value) {
CommonAPI::DBus::DBusStubSignalHelper<CommonAPI::DBus::DBusSerializableArguments<uint32_t>>
::sendSignal(
@@ -224,3 +208,19 @@ void TestInterfaceDBusStubAdapter::fireTestPredefinedTypeBroadcastEvent(const ui
} // namespace tests
} // namespace commonapi
+
+template<>
+const commonapi::tests::TestInterfaceDBusStubAdapterHelper::StubDispatcherTable commonapi::tests::TestInterfaceDBusStubAdapterHelper::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 }
+};
diff --git a/src/test/commonapi/tests/TestInterfaceProxy.h b/src/test/commonapi/tests/TestInterfaceProxy.h
index 7ab5cdc..36194fb 100644
--- a/src/test/commonapi/tests/TestInterfaceProxy.h
+++ b/src/test/commonapi/tests/TestInterfaceProxy.h
@@ -18,14 +18,23 @@ class TestInterfaceProxy: virtual public TestInterface, virtual public TestInter
~TestInterfaceProxy();
/// Returns the wrapper class that provides access to the attribute TestPredefinedTypeAttribute.
- virtual TestPredefinedTypeAttributeAttribute& getTestPredefinedTypeAttributeAttribute();
+ virtual TestPredefinedTypeAttributeAttribute& getTestPredefinedTypeAttributeAttribute() {
+ return delegate_->getTestPredefinedTypeAttributeAttribute();
+ }
+
/// Returns the wrapper class that provides access to the attribute TestDerivedStructAttribute.
- virtual TestDerivedStructAttributeAttribute& getTestDerivedStructAttributeAttribute();
+ virtual TestDerivedStructAttributeAttribute& getTestDerivedStructAttributeAttribute() {
+ return delegate_->getTestDerivedStructAttributeAttribute();
+ }
/// Returns the wrapper class that provides access to the attribute TestDerivedArrayAttribute.
- virtual TestDerivedArrayAttributeAttribute& getTestDerivedArrayAttributeAttribute();
+ virtual TestDerivedArrayAttributeAttribute& getTestDerivedArrayAttributeAttribute() {
+ return delegate_->getTestDerivedArrayAttributeAttribute();
+ }
/// Returns the wrapper class that provides access to the broadcast TestPredefinedTypeBroadcast.
- virtual TestPredefinedTypeBroadcastEvent& getTestPredefinedTypeBroadcastEvent();
+ virtual TestPredefinedTypeBroadcastEvent& getTestPredefinedTypeBroadcastEvent() {
+ return delegate_->getTestPredefinedTypeBroadcastEvent();
+ }
/**
@@ -243,27 +252,6 @@ template <typename ... _AttributeExtensions>
TestInterfaceProxy<_AttributeExtensions...>::~TestInterfaceProxy() {
}
-template <typename ... _AttributeExtensions>
-typename TestInterfaceProxy<_AttributeExtensions...>::TestPredefinedTypeAttributeAttribute& TestInterfaceProxy<_AttributeExtensions...>::getTestPredefinedTypeAttributeAttribute() {
- return delegate_->getTestPredefinedTypeAttributeAttribute();
-}
-
-template <typename ... _AttributeExtensions>
-typename TestInterfaceProxy<_AttributeExtensions...>::TestDerivedStructAttributeAttribute& TestInterfaceProxy<_AttributeExtensions...>::getTestDerivedStructAttributeAttribute() {
- return delegate_->getTestDerivedStructAttributeAttribute();
-}
-
-template <typename ... _AttributeExtensions>
-typename TestInterfaceProxy<_AttributeExtensions...>::TestDerivedArrayAttributeAttribute& TestInterfaceProxy<_AttributeExtensions...>::getTestDerivedArrayAttributeAttribute() {
- return delegate_->getTestDerivedArrayAttributeAttribute();
-}
-
-
-template <typename ... _AttributeExtensions>
-typename TestInterfaceProxy<_AttributeExtensions...>::TestPredefinedTypeBroadcastEvent& TestInterfaceProxy<_AttributeExtensions...>::getTestPredefinedTypeBroadcastEvent() {
- return delegate_->getTestPredefinedTypeBroadcastEvent();
-}
-
template <typename ... _AttributeExtensions>
void TestInterfaceProxy<_AttributeExtensions...>::testEmptyMethod(CommonAPI::CallStatus& callStatus) {