Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

resolve action name using the signature (#30) #31

Merged
merged 3 commits into from
Dec 11, 2019
Merged

resolve action name using the signature (#30) #31

merged 3 commits into from
Dec 11, 2019

Conversation

lugu
Copy link
Owner

@lugu lugu commented Dec 5, 2019

An object can have several methods or signature with the same name. This
is the case of the ALMotion.moveTo API. In such case we need to search
an action based on the name and the signature.

Unfortunatly QiLoop have concept of compatible signatures. Here is an
example of missmatch:

(dlv) p sig
"(Is)<serviceRemoved,serviceID,name>"
(dlv) p m.Signals
map[uint32]github.com/lugu/qiloop/type/object.MetaSignal [
    86: {
	    Uid: 86,
	    Name: "traceObject",
	    Signature: "((IiIm(ll)<timeval,tv_sec,tv_usec>llII)<EventTrace,id,kind,slotI...+75 more",},
    106: {
	    Uid: 106,
	    Name: "serviceAdded",
	    Signature: "(Is)",},
    107: {
	    Uid: 107,
	    Name: "serviceRemoved",
	    Signature: "(Is)",},
]

Until a proper signature comparison method is found, we rely on the
hack:

For methods, find the first with:
- name, param and return type
- name, param type
- name

For signals and properties:
- try to match both name and signature
- if not a tuple, convert to tuple and try again
- match only the name

This is clearly not satisfactory and a proper signature comparison
algorithm is needed. It can be cased on a flatten conversion to tuple.
Like:

  • (ii)<a,b,c> => (ii)
  • (ii) => (ii)
  • i => (i)

An object can have several methods or signature with the same name. This
is the case of the ALMotion.moveTo API. In such case we need to search
an action based on the name and the signature.

Unfortunatly QiLoop have concept of compatible signatures. Here is an
example of missmatch:

    (dlv) p sig
    "(Is)<serviceRemoved,serviceID,name>"
    (dlv) p m.Signals
    map[uint32]github.com/lugu/qiloop/type/object.MetaSignal [
	    86: {
		    Uid: 86,
		    Name: "traceObject",
		    Signature: "((IiIm(ll)<timeval,tv_sec,tv_usec>llII)<EventTrace,id,kind,slotI...+75 more",},
	    106: {
		    Uid: 106,
		    Name: "serviceAdded",
		    Signature: "(Is)",},
	    107: {
		    Uid: 107,
		    Name: "serviceRemoved",
		    Signature: "(Is)",},
    ]

Until a proper signature comparison method is found, we rely on the
hack:

For methods, find the first with:
        - name, param and return type
        - name, param type
        - name

For signals and properties:
        - try to match both name and signature
        - if not a tuple, convert to tuple and try again
        - match only the name

This is clearly not satisfactory and a proper signature comparison
algorithm is needed. It can be cased on a flatten conversion to tuple.
Like:
- (ii)<a,b,c> => (ii)
- (ii) => (ii)
- i => (i)
@codecov-io
Copy link

codecov-io commented Dec 5, 2019

Codecov Report

Merging #31 into master will decrease coverage by 0.73%.
The diff coverage is 47.73%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #31      +/-   ##
==========================================
- Coverage   68.35%   67.61%   -0.74%     
==========================================
  Files          51       51              
  Lines        8876     9013     +137     
==========================================
+ Hits         6067     6094      +27     
- Misses       2169     2244      +75     
- Partials      640      675      +35
Impacted Files Coverage Δ
bus/proxy.go 72.34% <0%> (-14.76%) ⬇️
bus/object.go 62.8% <100%> (ø) ⬆️
meta/idl/proxy.go 92.12% <100%> (+0.07%) ⬆️
examples/space/space_stub_gen.go 51.86% <28.57%> (-0.39%) ⬇️
bus/logger/logger_stub_gen.go 48.78% <39.28%> (-0.74%) ⬇️
bus/object_stub_gen.go 28.21% <44.44%> (+0.03%) ⬆️
bus/directory/directory_stub_gen.go 63.56% <47.36%> (-1.76%) ⬇️
type/object/metaobject_decorator.go 55.22% <50%> (-8.86%) ⬇️
examples/clock/clock_stub_gen.go 59.49% <50%> (-1.04%) ⬇️
examples/pong/ping_stub_gen.go 61.43% <54.54%> (-1.15%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e8385b3...325f5c7. Read the comment docs.

@lugu lugu merged commit 76bf14f into master Dec 11, 2019
@lugu lugu deleted the testing branch December 11, 2019 22:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants