1

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?

CodingHero
  • 181
  • 13

1 Answers1

2

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

Mart10
  • 758
  • 3
  • 14
  • Good information. In addition to being new to EA I'm fairly new to modeling so keeping in mind that UML can't represent every detail of the implementation is definitely good advice. Thanks! – CodingHero Jun 14 '17 at 18:58