1
votes

I am admittedly an Enterprise Architect newbie. I'd like to model a template function but haven't found any resources that explain how to do so. The closest was another topic here on Stack Overflow that has no answers in over 2 years: UML template function modelling in enterprise architect

My goal is to implement a class that can handle data of any type but does not itself need to know details of the type. The outline of such a class would look something like the following:

class Foo {
    public:
    Foo();
    ~Foo();

    template<typename T>
    bool SendData(T const& data);

    private:
    int attribute1;
    char attribute2;
}

I don't want to make this a template class as only one or two operations actually need (or should) to be generic. I know I could add a custom stereotype and modify the code generation templates, but I don't know how to do this "the right way." The best I can envision is applying some custom stereotype to an operation that ALWAYS prepends template <typename T> verbatim to a method and has no room for flexibility.

Does anyone know the "correct" way to achieve this in Enterprise Architect?

1
this is forward engineering right? What is the uml way to represent this?Mart10

1 Answers

2
votes

Template Functions are not supported by UML, so I doubt that Enterprise Architect would.

Here's a similar answer

Which itself is referring to this

But in short, keep in mind that UML is a designing language, not a programming language, so you cannot expect it to have an answer to every semantics of every programming language