Medical Imaging Interaction Toolkit  2018.4.99-4c24e3cb
Medical Imaging Interaction Toolkit
mitkIdentifiable.cpp
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #include <mitkIdentifiable.h>
14 #include <mitkUIDGenerator.h>
15 
16 struct mitk::Identifiable::Impl
17 {
18  UIDType uid;
19 };
20 
22  : m_Impl(new Impl)
23 {
24  UIDGenerator generator;
25  m_Impl->uid = generator.GetUID();
26 }
27 
29  : m_Impl(new Impl)
30 {
31  m_Impl->uid = uid;
32 }
33 
35  : m_Impl(other.m_Impl)
36 {
37  other.m_Impl = nullptr;
38 }
39 
41 {
42  delete m_Impl;
43 }
44 
46 {
47  delete m_Impl;
48  m_Impl = other.m_Impl;
49  other.m_Impl = nullptr;
50 
51  return *this;
52 }
53 
55 {
56  return m_Impl->uid;
57 }
58 
59  void mitk::Identifiable::SetUID(const UIDType &uid)
60 {
61  m_Impl->uid = uid;
62 }
Identifiable & operator=(const Identifiable &)=delete
Generated unique IDs.
UIDType GetUID() const
Get unique ID of an object.
Base class of identifiable objects.