libzypp
17.25.2
ProvideNumericId.h
Go to the documentation of this file.
1
/*---------------------------------------------------------------------\
2
| ____ _ __ __ ___ |
3
| |__ / \ / / . \ . \ |
4
| / / \ V /| _/ _/ |
5
| / /__ | | | | | | |
6
| /_____||_| |_| |_| |
7
| |
8
\---------------------------------------------------------------------*/
12
#ifndef ZYPP_BASE_PROVIDENUMERICID_H
13
#define ZYPP_BASE_PROVIDENUMERICID_H
14
16
namespace
zypp
17
{
18
namespace
base
20
{
21
23
//
24
// CLASS NAME : ProvideNumericId
25
//
44
template
<
class
TDerived,
class
TNumericIdType>
45
struct
ProvideNumericId
46
{
47
public
:
49
TNumericIdType
numericId
()
const
50
{
return
_numericId
; }
51
52
protected
:
54
ProvideNumericId
()
55
:
_numericId
(
nextId
() )
56
{}
58
ProvideNumericId
(
const
ProvideNumericId
&
/*rhs*/
)
59
:
_numericId
(
nextId
() )
60
{}
62
ProvideNumericId
&
operator=
(
const
ProvideNumericId
&
/*rhs*/
)
63
{
return
*
this
; }
65
~ProvideNumericId
()
66
{}
67
protected
:
71
ProvideNumericId
(
const
void
*
const
)
72
:
_numericId
( 0 )
73
{}
74
private
:
76
static
TNumericIdType
nextId
()
77
{
78
static
TNumericIdType _staticCounter = 0;
79
// Assert not returning 0
80
return
++_staticCounter;
81
}
83
const
TNumericIdType
_numericId
;
84
};
86
88
}
// namespace base
91
}
// namespace zypp
93
#endif // ZYPP_BASE_PROVIDENUMERICID_H
zypp::base::ProvideNumericId::nextId
static TNumericIdType nextId()
Provide the next Id to use.
Definition:
ProvideNumericId.h:76
zypp::base::ProvideNumericId::ProvideNumericId
ProvideNumericId(const ProvideNumericId &)
Copy ctor.
Definition:
ProvideNumericId.h:58
zypp::base::ProvideNumericId::ProvideNumericId
ProvideNumericId(const void *const)
No-Id ctor (0).
Definition:
ProvideNumericId.h:71
zypp::base::ProvideNumericId::_numericId
const TNumericIdType _numericId
Definition:
ProvideNumericId.h:83
zypp::base::ProvideNumericId::operator=
ProvideNumericId & operator=(const ProvideNumericId &)
Assign.
Definition:
ProvideNumericId.h:62
zypp::base::ProvideNumericId
Base class for objects providing a numeric Id.
Definition:
ProvideNumericId.h:46
zypp
Easy-to use interface to the ZYPP dependency resolver.
Definition:
CodePitfalls.doc:2
zypp::base::ProvideNumericId::numericId
TNumericIdType numericId() const
Definition:
ProvideNumericId.h:49
zypp::base::ProvideNumericId::ProvideNumericId
ProvideNumericId()
Default ctor.
Definition:
ProvideNumericId.h:54
zypp::base::ProvideNumericId::~ProvideNumericId
~ProvideNumericId()
Dtor.
Definition:
ProvideNumericId.h:65
zypp
base
ProvideNumericId.h
Generated by
1.8.20