libzypp 17.31.23
zypp::base::ProvideNumericId< TDerived, TNumericIdType > Struct Template Reference

Base class for objects providing a numeric Id. More...

#include <base/providenumericid.h>

Public Member Functions

TNumericIdType numericId () const
 

Protected Member Functions

 ProvideNumericId ()
 Default ctor.
 
 ProvideNumericId (const ProvideNumericId &)
 Copy ctor.
 
ProvideNumericIdoperator= (const ProvideNumericId &)
 Assign.
 
 ProvideNumericId (ProvideNumericId &&rhs)
 Move ctor.
 
ProvideNumericIdoperator= (ProvideNumericId &&rhs)
 Move Assign.
 
 ~ProvideNumericId ()
 Dtor.
 
 ProvideNumericId (const void *const)
 No-Id ctor (0).
 

Static Private Member Functions

static TNumericIdType nextId ()
 Provide the next Id to use.
 

Private Attributes

const TNumericIdType _numericId
 

Detailed Description

template<class TDerived, class TNumericIdType>
struct zypp::base::ProvideNumericId< TDerived, TNumericIdType >

Base class for objects providing a numeric Id.

The ctor creates a NumericId from some static counter.

The only assertion is that 0 is not used as an Id, unless the derived class explicitly requests this by using ProvideNumericId( const void *const ).

Why should you want to use 0 as an Id? E.g if your class provides some (singleton) No-object. Might be desirable to make the No-object have No-Id.

struct Foo : public base::ProvideNumericId<Foo,unsigned>
{};
Foo foo;
foo.numericId(); // returns foo's NumericId.
Base class for objects providing a numeric Id.

Definition at line 45 of file providenumericid.h.

Constructor & Destructor Documentation

◆ ProvideNumericId() [1/4]

template<class TDerived , class TNumericIdType >
zypp::base::ProvideNumericId< TDerived, TNumericIdType >::ProvideNumericId ( )
inlineprotected

Default ctor.

Definition at line 54 of file providenumericid.h.

◆ ProvideNumericId() [2/4]

template<class TDerived , class TNumericIdType >
zypp::base::ProvideNumericId< TDerived, TNumericIdType >::ProvideNumericId ( const ProvideNumericId< TDerived, TNumericIdType > &  )
inlineprotected

Copy ctor.

Definition at line 58 of file providenumericid.h.

◆ ProvideNumericId() [3/4]

template<class TDerived , class TNumericIdType >
zypp::base::ProvideNumericId< TDerived, TNumericIdType >::ProvideNumericId ( ProvideNumericId< TDerived, TNumericIdType > &&  rhs)
inlineprotected

Move ctor.

Definition at line 65 of file providenumericid.h.

◆ ~ProvideNumericId()

template<class TDerived , class TNumericIdType >
zypp::base::ProvideNumericId< TDerived, TNumericIdType >::~ProvideNumericId ( )
inlineprotected

Dtor.

Definition at line 72 of file providenumericid.h.

◆ ProvideNumericId() [4/4]

template<class TDerived , class TNumericIdType >
zypp::base::ProvideNumericId< TDerived, TNumericIdType >::ProvideNumericId ( const void * const  )
inlineprotected

No-Id ctor (0).

Explicitly request Id 0. Use it with care!

Definition at line 78 of file providenumericid.h.

Member Function Documentation

◆ numericId()

template<class TDerived , class TNumericIdType >
TNumericIdType zypp::base::ProvideNumericId< TDerived, TNumericIdType >::numericId ( ) const
inline
Returns
The objects numeric Id.

Definition at line 49 of file providenumericid.h.

◆ operator=() [1/2]

template<class TDerived , class TNumericIdType >
ProvideNumericId & zypp::base::ProvideNumericId< TDerived, TNumericIdType >::operator= ( const ProvideNumericId< TDerived, TNumericIdType > &  )
inlineprotected

Assign.

Definition at line 62 of file providenumericid.h.

◆ operator=() [2/2]

template<class TDerived , class TNumericIdType >
ProvideNumericId & zypp::base::ProvideNumericId< TDerived, TNumericIdType >::operator= ( ProvideNumericId< TDerived, TNumericIdType > &&  rhs)
inlineprotected

Move Assign.

Definition at line 69 of file providenumericid.h.

◆ nextId()

template<class TDerived , class TNumericIdType >
static TNumericIdType zypp::base::ProvideNumericId< TDerived, TNumericIdType >::nextId ( )
inlinestaticprivate

Provide the next Id to use.

Definition at line 83 of file providenumericid.h.

Member Data Documentation

◆ _numericId

template<class TDerived , class TNumericIdType >
const TNumericIdType zypp::base::ProvideNumericId< TDerived, TNumericIdType >::_numericId
private

Definition at line 90 of file providenumericid.h.


The documentation for this struct was generated from the following file: