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

Compile error related to extended structs with array member #10

Open
lucka-me opened this issue Jan 15, 2020 · 3 comments
Open

Compile error related to extended structs with array member #10

lucka-me opened this issue Jan 15, 2020 · 3 comments

Comments

@lucka-me
Copy link

Hello, I'm studying the SOME/IP by following the Wiki but encontered a compile error and I have no idea about how to solve it.

The .fidl file:

typeCollection CommonType {
    version { major 1 minor 0 }
    enumeration ValueType {
        Node            = 0
        LaneModel       = 4
        FormOfWay       = 16
        VersionSoftware = 52
    }
    struct ValueBase polymorphic {
    }
    struct Data {
        ValueType type
        ValueBase value
    }
    struct ValueA extends ValueBase {
         UInt32 id
    }
    struct Item {
        UInt32 size
    }
    struct ValueB extends ValueBase {
         Item [ ] items
    }
}

interface MessageBus {
    version { major 1 minor 0 }
    attribute CommonType.Data data readonly
}

After generating code with commonapi-generator and commonapisomeip_generator, I compiled my test code but failed with:

error: no matching function for call to 'CommonAPI::SomeIP::OutputStream::writeValue(const std::vector<v1::com::CommonType::Item>&, const CommonAPI::EmptyDeployment*&)'

I haven't dive into CommonAPI yet but it seems that the server write ValueBase with an EmptyDeployment, which doesn't work with array. The compile error won't occur if I remove ValueB and keep ValueA. Should I add something to the .fdepl file or replace the value in Data with a byte buffer and serialize the ValueA and ValueB by myself?

@lutzbichler
Copy link
Collaborator

Please check whether this problem persists with CommonAPI v3.2. If yes, please also provide the content of the .fdepl.

@lucka-me
Copy link
Author

lucka-me commented Dec 4, 2020

This problem persists with v3.2 (v3.2.0.1 of both tools).

The Sample.fidl:

package sample

typeCollection CommonType {
    version { major 1 minor 0 }

    enumeration ValueType {
        None            = 0
        Size            = 1
        Items           = 2
    }

    struct ValueBase polymorphic {
    }

    struct Data {
        ValueType type
        ValueBase value
    }
    struct ValueA extends ValueBase {
         UInt32 id
    }
    struct Item {
        UInt32 size
    }
    struct ValueB extends ValueBase {
         Item [ ] items
    }
}

interface MessageBus {
    version { major 1 minor 0 }
    attribute CommonType.Data data readonly
}

And Sample.fdepl:

import "platform:/plugin/org.genivi.commonapi.someip/deployment/CommonAPI-SOMEIP_deployment_spec.fdepl"
import "Sample.fidl"

define org.genivi.commonapi.someip.deployment for interface sample.MessageBus {
	SomeIpServiceID = 4660

    attribute data {
        SomeIpNotifierID = 33333
        SomeIpNotifierReliable = true
        SomeIpEventGroups = { 33333 }
        //SomeIpNotifierEventGroups = { 222 }
    }
}

define org.genivi.commonapi.someip.deployment for provider as SampleService {
	instance sample.MessageBus as bus {
		InstanceId = "test"
		SomeIpInstanceID = 22136
	}
}

Error:

<.>/capicxx-core-runtime/include/CommonAPI/OutputStream.hpp:121:47: error: no matching function for call to ‘CommonAPI::SomeIP::OutputStream::writeValue(const std::vector<v1::sample::CommonType::Item>&, const CommonAPI::EmptyDeployment*&)’

And there are two more errors:

<.>/src-gen/v1/sample/MessageBusSomeIPStubAdapter.hpp:79:36: error: ‘DataDeployment’ is not a member of ‘v1::sample::CommonType_’

<.>/src-gen/v1/sample/MessageBusSomeIPStubAdapter.hpp:102:128: error: ‘DataDeployment’ is not a member of ‘v1::sample::CommonType_’

By the way, src-gen/v1/sample/MessageBusStubDefault.cpp is not generated and I removed it from CMakeLists.txt.

@lucka-me
Copy link
Author

lucka-me commented May 8, 2021

Here is a work around (NOT solution) from my colleague: replace the array with a map.

In the sample I provided before, replace:

struct ValueB extends ValueBase {
    Item [ ] items
}

With:

map ItemMap {
    Int16 to Item
}

struct ValueB extends ValueBase {
    ItemMap items
}

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

No branches or pull requests

2 participants