Apply to the classes that do not need CPP files.
Using TaggedValue
Using Stereotype
Apply to the operations that do not need definitions of the member functions, such as copy constructors and copy assignment operators.
Using TaggedValue
Using Stereotype
Using TaggedValue
Click an association element.
Select the TaggedValue tab.
Enter "collection_kind" in the Name, and a STL container type in the Value. The following STL container types can be entered. If this TaggedValue is not set, it is the same as setting "vector".
vector
list
deque
stack
queue
priority_queue
set
multiset
Select the Association End tab.
Enter “*” for the upper limit in the Multiplicity.
C++ Example Code
// ˅
// ˄
#ifndef FOO_H_
#define FOO_H_
// ˅
#include <list>
class Bar;
using namespace std;
// ˄
class Foo
{
// ˅
// ˄
private:
list<Bar*> cntBar;
// ˅
public:
protected:
private:
Foo(const Foo&) = delete;
Foo& operator=(const Foo&) = delete;
// ˄
};
// ˅
// ˄
#endif // FOO_H_
// ˅
// ˄
Using Stereotype
Click an association element.
Select the Stereotype tab.
Enter "collection_kind=(STL container type)" in the Name. The following STL container types can be entered. If this Stereotype is not set, it is the same as setting "vector".
vector
list
deque
stack
queue
priority_queue
set
multiset
Select the Association End tab.
Enter “*” for the upper limit in the Multiplicity.
C++ Example Code
// ˅
// ˄
#ifndef FOO_H_
#define FOO_H_
// ˅
#include <list>
class Bar;
using namespace std;
// ˄
class Foo
{
// ˅
// ˄
private:
list<Bar*> cntBar;
// ˅
public:
protected:
private:
Foo(const Foo&) = delete;
Foo& operator=(const Foo&) = delete;
// ˄
};
// ˅
// ˄
#endif // FOO_H_
// ˅
// ˄
Using TaggedValue
C++ Example Code
// ˅
// ˄
#ifndef FOO_H_
#define FOO_H_
// ˅
#include <map>
class Bar;
using namespace std;
// ˄
class Foo
{
// ˅
// ˄
private:
multimap<int, Bar*> cntBar;
// ˅
public:
protected:
private:
Foo(const Foo&) = delete;
Foo& operator=(const Foo&) = delete;
// ˄
};
// ˅
// ˄
#endif // FOO_H_
// ˅
// ˄
Using Stereotype
C++ Example Code
// ˅
// ˄
#ifndef FOO_H_
#define FOO_H_
// ˅
#include <map>
class Bar;
using namespace std;
// ˄
class Foo
{
// ˅
// ˄
private:
multimap<int, Bar*> cntBar;
// ˅
public:
protected:
private:
Foo(const Foo&) = delete;
Foo& operator=(const Foo&) = delete;
// ˄
};
// ˅
// ˄
#endif // FOO_H_
// ˅
// ˄
Using TaggedValue
C++ Example Code
// ˅
// ˄
#ifndef FOO_H_
#define FOO_H_
// ˅
#include <memory>
#include <vector>
#include "Bar.h"
using namespace std;
// ˄
class Foo
{
// ˅
// ˄
private:
vector<shared_ptr<Bar>> bar;
// ˅
public:
protected:
private:
Foo(const Foo&) = delete;
Foo& operator=(const Foo&) = delete;
// ˄
};
// ˅
// ˄
#endif // FOO_H_
// ˅
// ˄
Using Stereotype
C++ Example Code
// ˅
// ˄
#ifndef FOO_H_
#define FOO_H_
// ˅
#include <memory>
#include <vector>
#include "Bar.h"
using namespace std;
// ˄
class Foo
{
// ˅
// ˄
private:
vector<shared_ptr<Bar>> bar;
// ˅
public:
protected:
private:
Foo(const Foo&) = delete;
Foo& operator=(const Foo&) = delete;
// ˄
};
// ˅
// ˄
#endif // FOO_H_
// ˅
// ˄