libzypp  13.10.6
zypp::base::ProvideNumericId< _Derived, _NumericIdType > Struct Template Reference

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

#include <ProvideNumericId.h>

Public Member Functions

_NumericIdType numericId () const
 

Protected Member Functions

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

Static Private Member Functions

static _NumericIdType nextId ()
 Provide the next Id to use. More...
 

Private Attributes

const _NumericIdType _numericId
 

Detailed Description

template<class _Derived, class _NumericIdType>
struct zypp::base::ProvideNumericId< _Derived, _NumericIdType >

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.
*

Definition at line 45 of file ProvideNumericId.h.

Constructor & Destructor Documentation

template<class _Derived, class _NumericIdType>
zypp::base::ProvideNumericId< _Derived, _NumericIdType >::ProvideNumericId ( )
inlineprotected

Default ctor.

Definition at line 54 of file ProvideNumericId.h.

template<class _Derived, class _NumericIdType>
zypp::base::ProvideNumericId< _Derived, _NumericIdType >::ProvideNumericId ( const ProvideNumericId< _Derived, _NumericIdType > &  )
inlineprotected

Copy ctor.

Definition at line 58 of file ProvideNumericId.h.

template<class _Derived, class _NumericIdType>
zypp::base::ProvideNumericId< _Derived, _NumericIdType >::~ProvideNumericId ( )
inlineprotected

Dtor.

Definition at line 65 of file ProvideNumericId.h.

template<class _Derived, class _NumericIdType>
zypp::base::ProvideNumericId< _Derived, _NumericIdType >::ProvideNumericId ( const void *  const)
inlineprotected

No-Id ctor (0).

Explicitly request Id 0. Use it with care!

Definition at line 71 of file ProvideNumericId.h.

Member Function Documentation

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

Definition at line 49 of file ProvideNumericId.h.

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

Assign.

Definition at line 62 of file ProvideNumericId.h.

template<class _Derived, class _NumericIdType>
static _NumericIdType zypp::base::ProvideNumericId< _Derived, _NumericIdType >::nextId ( )
inlinestaticprivate

Provide the next Id to use.

Definition at line 76 of file ProvideNumericId.h.

Member Data Documentation

template<class _Derived, class _NumericIdType>
const _NumericIdType zypp::base::ProvideNumericId< _Derived, _NumericIdType >::_numericId
private

Definition at line 83 of file ProvideNumericId.h.


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