Problem with association and Smart Pointer

Hi there.
My company finally purchased VP, mainly due to a lot of pressure I’ve put to replace Visio. I’ve imported my C++ classes from code and Visio. It looks great and the current version + sp looks far more mature than the evaluation I’ve tried a year ago.

The first thing that troubles me is that I use a lot of Smart Pointers (mainly boost library Shared Pointer template).

A lot of Class’s Data members that look like this:

-m_Member : boost.shared_ptr<Associated_Class>

Are actually associations to the class – regular pointers wrapped by mini-garbage collector. VP however doesn’t recognize those members as associations to the Associated_Class, but as associations to boost.shared_ptr.
This is a reasonable behavior, but is there any way to bypass that?
boost.shared_ptr is really the same (UML wise) as *X (A pointer to class X).
I want VP to interpret boost.shared_ptr as a regular association type with my Class X.

Hi orenshochat,

Thank you for choosing Visual Paradigm, and bringing your problem into our attention. I will ask our engineers if we can support your requirement. Will keep you informed.

Best regards,
Jick

Hi orenshochat,

Could you provide me with some sample code to reproduce the problem?

Best regards,
Jick

This is not really a bug, it is a WAD - Worked As Designed.
But I’m looking for a way to bypass that.

Some background:
A smart pointer is a template for holding a simple pointer. It provides with automatic memory freeing once the pointer loses scope. It is very common practice in C++.
I’m using Boost free library smart pointers (also a common practice in c++)

Sample

Class A
{
};

Class B
{

boost::smart_ptr m_pToType_A;
};

Class B has a smart pointer member that points to an A type object. This is really similar to :

Class B
{

A* m_pToType_A;
};

However visual paradigm doesn’t see it that way and doesn’t create the association between Class A and B. Instead it builds an association between B and smart_ptr.

I need a way to bypass that, a way to tell VP that "boost::smart_ptr " is the same as “*A” regarding association

Sorry “A*” and not “*A”

Hello orenshochat,

Thanks for the samples. I’ve forwarded the details to our engineers to follow-up. Once there are any feedbacks, I’ll comeback to you immediately. If you need any help, please do not hesitate to contact me again.

Best regards,
Rain Wong

Hello orenshochat,

Our engineers had tested your issue but unable to repeat your problem. Attached is the sample we used and the generated project file. Can you have a look and see is the sample correct?

Best regards,
Rain Wong
output.vpp
a.h

Take the sample you placed.
Delete the association arrow. Now we have class A and Class B on the Static (class) diagam.
Left Click on Class B Attribute - "-m_pToType_A : boost.smart_ptr"
Right Click on it. The popup menu has only “Create association” not SHOW association.
It can only create association between B and boost.smart_ptr.
I wish to bypass that.

Hi orenshochat,

Thank you for your details. Our engineers have investigated and fixed the problem already. Please download and try the patch in the following link and see if it solves the problem.
http://files4.visual-paradigm.com/200803/Patch/sp1_20080311x/VP_Suite_Windows_3_2_sp1_20080311x.exe

To use the patch:

  1. Exit any running instance of VP
  2. Install by overwriting the current installation
  3. Restart the product.

Note: This patch is made for VP Suite 3.2 SP1 (VP-UML 6.2 SP1). Please make sure you have a valid product license. Otherwise you won’t be able to start up the product after the installation.

If there are any inquiries, please feel free to contact me.

Best regards,
Lilian Wong