Skip to content

Commit

Permalink
capicxx-someip-runtime 3.1.12.9
Browse files Browse the repository at this point in the history
  • Loading branch information
juergengehring committed Jan 25, 2018
1 parent 52c9d21 commit f15eaac
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
2 changes: 2 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
Changes
=======
v3.1.12.9
- support 'lock functors' in AttributeDispatcher(s)

v3.1.12.8
- Fixed data race in generated StubDefault when using attributes
Expand Down
28 changes: 17 additions & 11 deletions include/CommonAPI/SomeIP/StubAdapterHelper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -756,12 +756,13 @@ template <typename StubClass_, typename AttributeType_, typename AttributeDepl_
class GetAttributeStubDispatcher: public StubDispatcher<StubClass_> {
public:
typedef typename StubClass_::RemoteEventHandlerType RemoteEventHandlerType;
typedef void (StubClass_::*LockStubFunctor)(bool);
typedef const AttributeType_& (StubClass_::*GetStubFunctor)(std::shared_ptr<CommonAPI::ClientId>);
typedef typename StubClass_::StubAdapterType StubAdapterType;
typedef typename CommonAPI::Stub<StubAdapterType, typename StubClass_::RemoteEventType> StubType;

GetAttributeStubDispatcher(GetStubFunctor getStubFunctor, bool _isLittleEndian, AttributeDepl_ *_depl = nullptr)
: getStubFunctor_(getStubFunctor), isLittleEndian_(_isLittleEndian), depl_(_depl) {
GetAttributeStubDispatcher(LockStubFunctor _lockStubFunctor, GetStubFunctor getStubFunctor, bool _isLittleEndian, AttributeDepl_ *_depl = nullptr)
: lockStubFunctor_(_lockStubFunctor), getStubFunctor_(getStubFunctor), isLittleEndian_(_isLittleEndian), depl_(_depl) {
}

bool dispatchMessage(const Message &message, const std::shared_ptr<StubClass_> &stub,
Expand All @@ -780,17 +781,17 @@ class GetAttributeStubDispatcher: public StubDispatcher<StubClass_> {

std::shared_ptr<ClientId> clientId = std::make_shared<ClientId>(message.getClientId());

auto stubAdapter = stub->StubType::getStubAdapter();
stubAdapter->lockAttributes();
(stub.get()->*lockStubFunctor_)(true);
auto deployable = CommonAPI::Deployable<AttributeType_, AttributeDepl_>((stub.get()->*getStubFunctor_)(clientId), depl_);
stubAdapter->unlockAttributes();
(stub.get()->*lockStubFunctor_)(false);

outputStream << deployable;
outputStream.flush();

return _connection->sendMessage(reply);
}

LockStubFunctor lockStubFunctor_;
GetStubFunctor getStubFunctor_;
bool isLittleEndian_;
AttributeDepl_ *depl_;
Expand All @@ -802,16 +803,18 @@ class SetAttributeStubDispatcher: public GetAttributeStubDispatcher<StubClass_,
public:
typedef typename StubClass_::RemoteEventHandlerType RemoteEventHandlerType;

typedef typename GetAttributeStubDispatcher<StubClass_, AttributeType_, AttributeDepl_>::LockStubFunctor LockStubFunctor;
typedef typename GetAttributeStubDispatcher<StubClass_, AttributeType_, AttributeDepl_>::GetStubFunctor GetStubFunctor;
typedef bool (RemoteEventHandlerType::*OnRemoteSetFunctor)(std::shared_ptr<CommonAPI::ClientId>, AttributeType_);
typedef void (RemoteEventHandlerType::*OnRemoteChangedFunctor)();

SetAttributeStubDispatcher(GetStubFunctor getStubFunctor,
SetAttributeStubDispatcher(LockStubFunctor lockStubFunctor,
GetStubFunctor getStubFunctor,
OnRemoteSetFunctor onRemoteSetFunctor,
OnRemoteChangedFunctor onRemoteChangedFunctor,
bool _isLittleEndian,
AttributeDepl_ *_depl = nullptr)
: GetAttributeStubDispatcher<StubClass_, AttributeType_, AttributeDepl_>(getStubFunctor, _isLittleEndian, _depl),
: GetAttributeStubDispatcher<StubClass_, AttributeType_, AttributeDepl_>(lockStubFunctor, getStubFunctor, _isLittleEndian, _depl),
onRemoteSetFunctor_(onRemoteSetFunctor),
onRemoteChangedFunctor_(onRemoteChangedFunctor) {
}
Expand Down Expand Up @@ -871,19 +874,22 @@ class SetObservableAttributeStubDispatcher: public SetAttributeStubDispatcher<St
typedef typename StubClass_::RemoteEventHandlerType RemoteEventHandlerType;
typedef typename StubClass_::StubAdapterType StubAdapterType;

typedef typename SetAttributeStubDispatcher<StubClass_, AttributeType_, AttributeDepl_>::LockStubFunctor LockStubFunctor;
typedef typename SetAttributeStubDispatcher<StubClass_, AttributeType_, AttributeDepl_>::GetStubFunctor GetStubFunctor;
typedef typename SetAttributeStubDispatcher<StubClass_, AttributeType_, AttributeDepl_>::OnRemoteSetFunctor OnRemoteSetFunctor;
typedef typename SetAttributeStubDispatcher<StubClass_, AttributeType_, AttributeDepl_>::OnRemoteChangedFunctor OnRemoteChangedFunctor;
typedef typename CommonAPI::Stub<StubAdapterType, typename StubClass_::RemoteEventType> StubType;
typedef void (StubAdapterType::*FireChangedFunctor)(const AttributeType_&);

SetObservableAttributeStubDispatcher(GetStubFunctor getStubFunctor,
SetObservableAttributeStubDispatcher(LockStubFunctor lockStubFunctor,
GetStubFunctor getStubFunctor,
OnRemoteSetFunctor onRemoteSetFunctor,
OnRemoteChangedFunctor onRemoteChangedFunctor,
FireChangedFunctor fireChangedFunctor,
bool _isLittleEndian,
AttributeDepl_ *_depl = nullptr)
: SetAttributeStubDispatcher<StubClass_, AttributeType_, AttributeDepl_>(getStubFunctor,
: SetAttributeStubDispatcher<StubClass_, AttributeType_, AttributeDepl_>(lockStubFunctor,
getStubFunctor,
onRemoteSetFunctor,
onRemoteChangedFunctor,
_isLittleEndian,
Expand All @@ -910,9 +916,9 @@ class SetObservableAttributeStubDispatcher: public SetAttributeStubDispatcher<St
private:
inline void fireAttributeValueChanged(std::shared_ptr<CommonAPI::ClientId> _client, const std::shared_ptr<StubClass_> _stub) {
auto stubAdapter = _stub->StubType::getStubAdapter();
stubAdapter->lockAttributes();
(_stub.get()->*SetAttributeStubDispatcher<StubClass_, AttributeType_, AttributeDepl_>::lockStubFunctor_)(true);
(stubAdapter.get()->*fireChangedFunctor_)(this->getAttributeValue(_client, _stub));
stubAdapter->unlockAttributes();
(_stub.get()->*SetAttributeStubDispatcher<StubClass_, AttributeType_, AttributeDepl_>::lockStubFunctor_)(false);
}

const FireChangedFunctor fireChangedFunctor_;
Expand Down

0 comments on commit f15eaac

Please sign in to comment.