SG::AuxTypeVector< T, CONT > Class Template Reference

Implementation of IAuxTypeVector for specific types. More...

#include <AuxTypeVector.h>

Inheritance diagram for SG::AuxTypeVector< T, CONT >:
SG::IAuxTypeVector

List of all members.

Public Types

typedef CONT vector_type
 Type of the STL vector used for storage.
typedef AuxDataTraits< T >
::element_type 
element_type
 Type that the user sees.
typedef vector_type::value_type vector_value_type
 Vector element type.

Public Member Functions

 AuxTypeVector (size_t size, size_t capacity)
 Constructor. Makes a new vector.
vector_typevec ()
 Return a reference to the payload vector.
virtual IAuxTypeVectorclone () const ATH_OVERRIDE
 Make a copy of this vector.
virtual void * toPtr () ATH_OVERRIDE
 Return a pointer to the start of the vector's data.
virtual void * toVector () ATH_OVERRIDE
 Return a pointer to the STL vector itself.
virtual const std::type_info * objType () const ATH_OVERRIDE
 Return the type of the payload object for this instance.
virtual size_t size () const ATH_OVERRIDE
 Return the size of the vector.
virtual void resize (size_t sz) ATH_OVERRIDE
 Change the size of the vector.
virtual void reserve (size_t sz) ATH_OVERRIDE
 Change the capacity of the vector.
virtual bool setOption (const AuxDataOption &option) ATH_OVERRIDE
 Make an option setting.
virtual void shift (size_t pos, ptrdiff_t offs) ATH_OVERRIDE
 Shift the elements of the vector.
virtual IAuxTypeVectortoPacked () ATH_OVERRIDE
 Try to convert this aux vector to a PackedContainer.

Static Public Member Functions

static void copy (void *dst, size_t dst_index, const void *src, size_t src_index)
 Copy an element between vectors (static method).
static void swap (void *a, size_t aindex, void *b, size_t bindex)
 Swap an element between vectors (static method).
static void clear (void *dst, size_t dst_index)
 Clear an element within a vector (static method).

Detailed Description

template<class T, class CONT = typename AuxDataTraits<T>::vector_type>
class SG::AuxTypeVector< T, CONT >

Implementation of IAuxTypeVector for specific types.

The auxiliary data for a container is stored in a set of STL vectors, one for each data item. However, we want to allow storing arbitrary types in these vectors. Thus, we define this abstract interface to operate on the vectors. This template class provides the concrete implementations of this interface.


Constructor & Destructor Documentation

template<class T , class CONT >
SG::AuxTypeVector< T, CONT >::AuxTypeVector ( size_t  size,
size_t  capacity 
) [inline]

Constructor. Makes a new vector.

Parameters:
size Initial size of the new vector.
capacity Initial capacity of the new vector.

Member Function Documentation

template<class T , class CONT >
void SG::AuxTypeVector< T, CONT >::clear ( void *  dst,
size_t  dst_index 
) [inline, static]

Clear an element within a vector (static method).

Parameters:
dst Pointer to the start of the vector's data.
dst_index Index of the element in the vector.
template<class T , class CONT >
void SG::AuxTypeVector< T, CONT >::copy ( void *  dst,
size_t  dst_index,
const void *  src,
size_t  src_index 
) [inline, static]

Copy an element between vectors (static method).

Parameters:
dst Pointer to the start of the destination vector's data.
dst_index Index of destination element in the vector.
src Pointer to the start of the source vector's data.
src_index Index of source element in the vector.

dst and @ src can be either the same or different.

template<class T , class CONT >
const std::type_info * SG::AuxTypeVector< T, CONT >::objType (  )  const [inline, virtual]

Return the type of the payload object for this instance.

Return the type of the complete payload object.

May be different from what we get from the registry; if packing is used, for example.

Reimplemented from SG::IAuxTypeVector.

template<class T , class CONT >
void SG::AuxTypeVector< T, CONT >::reserve ( size_t  sz  )  [inline, virtual]

Change the capacity of the vector.

Parameters:
sz The new vector capacity.

Implements SG::IAuxTypeVector.

template<class T , class CONT >
void SG::AuxTypeVector< T, CONT >::resize ( size_t  sz  )  [inline, virtual]

Change the size of the vector.

Parameters:
sz The new vector size.

Implements SG::IAuxTypeVector.

template<class T , class CONT >
bool SG::AuxTypeVector< T, CONT >::setOption ( const AuxDataOption option  )  [inline, virtual]

Make an option setting.

Parameters:
option The option to set.

The interpretation of the option depends on the concrete class.

Returns true if the option setting was successful; false otherwise.

Reimplemented from SG::IAuxTypeVector.

template<class T , class CONT >
void SG::AuxTypeVector< T, CONT >::shift ( size_t  pos,
ptrdiff_t  offs 
) [inline, virtual]

Shift the elements of the vector.

Parameters:
pos The starting index for the shift.
offs The (signed) amount of the shift.

This operation shifts the elements in the vectors for all aux data items, to implement an insertion or deletion. offs may be either positive or negative.

If offs is positive, then the container is growing. The container size should be increased by offs, the element at pos moved to pos + offs, and similarly for following elements. The elements between pos and pos + offs should be default-initialized.

If offs is negative, then the container is shrinking. The element at pos should be moved to pos + offs, and similarly for following elements. The container should then be shrunk by -offs elements (running destructors as appropriate).

Implements SG::IAuxTypeVector.

template<class T , class CONT >
void SG::AuxTypeVector< T, CONT >::swap ( void *  a,
size_t  aindex,
void *  b,
size_t  bindex 
) [inline, static]

Swap an element between vectors (static method).

Parameters:
a Pointer to the start of the first vector's data.
aindex Index of the element in the first vector.
b Pointer to the start of the second vector's data.
bindex Index of the element in the second vector.

a and @ b can be either the same or different.

template<class T , class CONT >
IAuxTypeVector * SG::AuxTypeVector< T, CONT >::toPacked (  )  [inline, virtual]

Try to convert this aux vector to a PackedContainer.

If successful, returns a newly-allocated IAuxTypeVector. In this case, the contents of the vector will have been moved to the new vector (and this object will be empty).

Returns null on failure.

Use the proper instantiation depending on whether or not this type can be packed.

Reimplemented from SG::IAuxTypeVector.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 15 Apr 2017 for RootCore Packages by  doxygen 1.6.1