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

Support reading and writing vector value with EmptyDeployment #22

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lucka-me
Copy link

@lucka-me lucka-me commented Sep 24, 2021

It's about the compile error reported in COVESA/capicxx-someip-tools#10 and COVESA/capicxx-someip-tools#21.

Here is an example:

struct ContentBase polymorphic {
}

struct Container {
    ContentBase content
}

struct ListContent extends ContentBase {
    UInt32 [] items
}

In the header file generated by the tools, ListContent has methods to read and write its value with an EmptyDeployment:

template<class _Input>
void readValue(CommonAPI::InputStream<_Input> &_input, const CommonAPI::EmptyDeployment *_depl) {
    (void) _depl;
    _input.template readValue<CommonAPI::EmptyDeployment>(std::get< 0>(values_));
}

template<class _Output>
void writeValue(CommonAPI::OutputStream<_Output> &_output, const CommonAPI::EmptyDeployment *_depl) {
    (void) _depl;
    _output.template writeValue<CommonAPI::EmptyDeployment>(std::get< 0>(values_));
}

However, none of the template methods of InputStream and InputStream matching the call, which should be like:

// In InputStream.hpp
class InputStream: public CommonAPI::InputStream<InputStream> {
    // ...
    template<typename ElementType_>
    COMMONAPI_EXPORT InputStream &readValue(std::vector<ElementType_> &_value,
            const EmptyDeployment *_depl) {
        // ...
    }
    // ...
};

// In OutputStream.hpp
class OutputStream: public CommonAPI::OutputStream<OutputStream> {
    // ...
    template<typename ElementType_>
    COMMONAPI_EXPORT OutputStream &writeValue(const std::vector<ElementType_> &_value,
        const EmptyDeployment *_depl) {
        // ...
    }
    // ...
};

These template methods and their specialization for std::vector<int8_t> and std::vector<uint8_t> were added in the commit.

I've tested the changes with a simple example, no compile error any more and it works properly.

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.

1 participant