Book a Demo

Author Topic: Templates (parameterized class) and UML  (Read 2726 times)

mayac

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Templates (parameterized class) and UML
« on: July 15, 2004, 04:14:50 am »
 I am trying to write a class diagram for a system with templates, and finding it very difficult. I looked for information in the index help and found only one page which describes how to sign a class a template.
My question is which connector should I use in order to express a specialization  relation, and which one to express an instantiation one.

Example:
template <class T>
class G
{
public:
  T get(){return val;}
private:
  T val;
};

A specialization:
template<>
class G<MyType>
{
public:
  MyType get(){cout << "my implementation";
                         return val;}
private:
   MyType val;
}

typedef G<MyType> GMy;
How can I express the relation between GMy and G in class diagram?


An instantiation:
typedef G<bool> Gbool;
How can I express the relation between Gbool and G in class diagram?

Thanks

Barry_Pearce

  • EA User
  • **
  • Posts: 70
  • Karma: +0/-0
    • View Profile
Re: Templates (parameterized class) and UML
« Reply #1 on: July 22, 2004, 04:20:06 am »
The typedef isnt possible using the C++ code gen templates - the issue has been raised with EA - there is also a UML conformance issue here - and the use of the bind stereotype.

I would imagine that c# has a similar typedef restriction....
« Last Edit: July 22, 2004, 04:20:37 am by Barry_Pearce »