μHAL (v2.7.9)
Part of the IPbus software repository
Public Types | Public Member Functions | Private Attributes | Friends | List of all members
uhal::ValVector< T > Class Template Reference

A class which wraps a block of data and marks whether or not it is valid. More...

#include <uhal/ValMem.hpp>

Inheritance diagram for uhal::ValVector< T >:
[legend]
Collaboration diagram for uhal::ValVector< T >:
[legend]

Public Types

typedef std::vector< T >::iterator iterator
 typedef iterator to be that of the underlying storage type More...
 
typedef std::vector< T >::const_iterator const_iterator
 typedef iterator to be that of the underlying storage type More...
 
typedef std::vector< T >::reverse_iterator reverse_iterator
 typedef iterator to be that of the underlying storage type More...
 
typedef std::vector< T >::const_reverse_iterator const_reverse_iterator
 typedef iterator to be that of the underlying storage type More...
 

Public Member Functions

 ValVector (const std::vector< T > &aValues)
 Constructor. More...
 
 ValVector (const ValVector &aValues)
 Copy Constructor. More...
 
 ValVector (const uint32_t &aSize)
 Constructor. More...
 
 ValVector ()
 Default constructor. More...
 
bool valid ()
 Return whether the Validated memory is marked as valid. More...
 
void valid (bool aValid)
 Change the validatity state of the Validated memory. More...
 
template<class InputIterator >
void assign (InputIterator aBegin, InputIterator aEnd)
 Assignment operator - including check on whether the data has previously been marked as valid. More...
 
void push_back (const T &aValue)
 If the memory has not previously been marked as valid, add an entry to the end of it. More...
 
const T & operator[] (std::size_t aIndex) const
 If the memory has previously been marked as valid, give random access into memory. More...
 
const T & at (std::size_t aIndex) const
 If the memory has previously been marked as valid, give random access into memory. More...
 
std::size_t size () const
 Return the size of the underlying memory. More...
 
void clear ()
 Clear the underlying memory and set Validity to false. More...
 
const_iterator begin () const
 If the memory has previously been marked as valid, return a const iterator to the beginning of the underlying memory. More...
 
const_iterator end () const
 If the memory has previously been marked as valid, return a const iterator to the end (one past last entry) of the underlying memory. More...
 
const_reverse_iterator rbegin () const
 If the memory has previously been marked as valid, return a const reverse iterator to the reverse beginning (the last entry) of the underlying memory. More...
 
const_reverse_iterator rend () const
 If the memory has previously been marked as valid, return a const reverse iterator to the reverse end (one before the zero'th entry) of the underlying memory. More...
 
std::vector< T > value () const
 Return the value of the validated memory with check on validity. More...
 
void value (const std::vector< T > &aValue)
 If the memory has not previously been marked as valid, set the value. More...
 

Private Attributes

boost::shared_ptr< _ValVector_< T > > mMembers
 A shared pointer to a ValVector struct, so that every copy of this ValVector points to the same underlying memory. More...
 

Friends

class ClientInterface
 Make ClientInterface a friend so that it can access the members to get the info associated with the raw data space. More...
 
class ValHeader
 Make the ValHeader class a friend so we can downcast the members. More...
 

Detailed Description

template<typename T>
class uhal::ValVector< T >

A class which wraps a block of data and marks whether or not it is valid.

Definition at line 75 of file ValMem.hpp.

Member Typedef Documentation

◆ const_iterator

template<typename T >
typedef std::vector< T >::const_iterator uhal::ValVector< T >::const_iterator

typedef iterator to be that of the underlying storage type

Definition at line 285 of file ValMem.hpp.

◆ const_reverse_iterator

template<typename T >
typedef std::vector< T >::const_reverse_iterator uhal::ValVector< T >::const_reverse_iterator

typedef iterator to be that of the underlying storage type

Definition at line 289 of file ValMem.hpp.

◆ iterator

template<typename T >
typedef std::vector< T >::iterator uhal::ValVector< T >::iterator

typedef iterator to be that of the underlying storage type

Definition at line 283 of file ValMem.hpp.

◆ reverse_iterator

template<typename T >
typedef std::vector< T >::reverse_iterator uhal::ValVector< T >::reverse_iterator

typedef iterator to be that of the underlying storage type

Definition at line 287 of file ValMem.hpp.

Constructor & Destructor Documentation

◆ ValVector() [1/4]

template<typename T >
uhal::ValVector< T >::ValVector ( const std::vector< T > &  aValues)

Constructor.

Parameters
aValuesa vector of values to which the validated memory will be initialized

Definition at line 189 of file ValMem.cpp.

◆ ValVector() [2/4]

template<typename T >
uhal::ValVector< T >::ValVector ( const ValVector< T > &  aValues)

Copy Constructor.

Parameters
aValuesa ValVector to copy

Definition at line 196 of file ValMem.cpp.

◆ ValVector() [3/4]

template<typename T >
uhal::ValVector< T >::ValVector ( const uint32_t &  aSize)

Constructor.

Parameters
aSizethe initial size of the validated memory

Definition at line 203 of file ValMem.cpp.

◆ ValVector() [4/4]

template<typename T >
uhal::ValVector< T >::ValVector

Default constructor.

Definition at line 210 of file ValMem.cpp.

Member Function Documentation

◆ assign()

template<typename T >
template<class InputIterator >
void uhal::ValVector< T >::assign ( InputIterator  aBegin,
InputIterator  aEnd 
)

Assignment operator - including check on whether the data has previously been marked as valid.

Parameters
aBeginIterator to the beginning of a block of data to be copied to the Validated Memory
aEndIterator to the end (one past last entry) of a block of data to be copied to the Validated Memory

Definition at line 56 of file ValMem.hxx.

◆ at()

template<typename T >
const T & uhal::ValVector< T >::at ( std::size_t  aIndex) const

If the memory has previously been marked as valid, give random access into memory.

Parameters
aIndexindex of the data to be retrieved
Returns
a const reference to the data at the specified index

Definition at line 264 of file ValMem.cpp.

References uhal::log(), and uhal::ValVector< T >::value().

Referenced by uhal::tests::for(), and uhal::tests::UHAL_TESTS_DEFINE_CLIENT_TEST_CASES().

◆ begin()

template<typename T >
ValVector< T >::const_iterator uhal::ValVector< T >::begin

If the memory has previously been marked as valid, return a const iterator to the beginning of the underlying memory.

Returns
a const iterator to the beginning of the underlying memory

Definition at line 295 of file ValMem.cpp.

Referenced by uhal::tests::PerfTester::buffersEqual(), uhal::tests::PerfTester::runValidationTest(), uhal::tests::UHAL_TESTS_DEFINE_CLIENT_TEST_CASES(), and uhal::tests::PerfTester::validation_test_block_write_read().

◆ clear()

template<typename T >
void uhal::ValVector< T >::clear

Clear the underlying memory and set Validity to false.

Definition at line 287 of file ValMem.cpp.

References uhal::ValVector< T >::valid().

◆ end()

template<typename T >
ValVector< T >::const_iterator uhal::ValVector< T >::end

If the memory has previously been marked as valid, return a const iterator to the end (one past last entry) of the underlying memory.

Returns
a const iterator to the end (one past last entry) of the underlying memory

Definition at line 311 of file ValMem.cpp.

Referenced by uhal::tests::PerfTester::buffersEqual(), uhal::tests::UHAL_TESTS_DEFINE_CLIENT_TEST_CASES(), and uhal::tests::PerfTester::validation_test_block_write_read().

◆ operator[]()

template<typename T >
const T & uhal::ValVector< T >::operator[] ( std::size_t  aIndex) const

If the memory has previously been marked as valid, give random access into memory.

Parameters
aIndexindex of the data to be retrieved
Returns
a const reference to the data at the specified index

Definition at line 248 of file ValMem.cpp.

◆ push_back()

template<typename T >
void uhal::ValVector< T >::push_back ( const T &  aValue)

If the memory has not previously been marked as valid, add an entry to the end of it.

Parameters
aValueaValue to append to the block

Definition at line 232 of file ValMem.cpp.

References uhal::ValVector< T >::value().

Referenced by uhal::tests::PerfTester::runValidationTest().

◆ rbegin()

template<typename T >
ValVector< T >::const_reverse_iterator uhal::ValVector< T >::rbegin

If the memory has previously been marked as valid, return a const reverse iterator to the reverse beginning (the last entry) of the underlying memory.

Returns
a const reverse iterator to the reverse beginning (the last entry) of the underlying memory

Definition at line 327 of file ValMem.cpp.

References uhal::ValVector< T >::value().

◆ rend()

template<typename T >
ValVector< T >::const_reverse_iterator uhal::ValVector< T >::rend

If the memory has previously been marked as valid, return a const reverse iterator to the reverse end (one before the zero'th entry) of the underlying memory.

Returns
a const reverse iterator to the reverse end (one before the zero'th entry) of the underlying memory

Definition at line 343 of file ValMem.cpp.

References uhal::ValVector< T >::value().

◆ size()

template<typename T >
std::size_t uhal::ValVector< T >::size

Return the size of the underlying memory.

Returns
the size of the underlying memory

Definition at line 280 of file ValMem.cpp.

References uhal::ValVector< T >::value().

Referenced by uhal::tests::for(), uhal::tests::job_multiple(), and uhal::tests::UHAL_TESTS_DEFINE_CLIENT_TEST_CASES().

◆ valid() [1/2]

template<typename T >
bool uhal::ValVector< T >::valid

Return whether the Validated memory is marked as valid.

Returns
whether the Validated memory is marked as valid

Definition at line 217 of file ValMem.cpp.

Referenced by uhal::ValVector< T >::clear(), uhal::tests::for(), uhal::tests::job_multiple(), uhal::tests::UHAL_TESTS_DEFINE_CLIENT_TEST_CASES(), and uhal::ValWord< uint32_t >::valid().

◆ valid() [2/2]

template<typename T >
void uhal::ValVector< T >::valid ( bool  aValid)

Change the validatity state of the Validated memory.

Parameters
aValidthe new validity state of the Validated memory

Definition at line 224 of file ValMem.cpp.

◆ value() [1/2]

template<typename T >
std::vector< T > uhal::ValVector< T >::value

◆ value() [2/2]

template<typename T >
void uhal::ValVector< T >::value ( const std::vector< T > &  aValue)

If the memory has not previously been marked as valid, set the value.

Parameters
aValuethe value of the validated memory

Definition at line 374 of file ValMem.cpp.

Friends And Related Function Documentation

◆ ClientInterface

template<typename T >
friend class ClientInterface
friend

Make ClientInterface a friend so that it can access the members to get the info associated with the raw data space.

Definition at line 276 of file ValMem.hpp.

◆ ValHeader

template<typename T >
friend class ValHeader
friend

Make the ValHeader class a friend so we can downcast the members.

Definition at line 279 of file ValMem.hpp.

Member Data Documentation

◆ mMembers

template<typename T >
boost::shared_ptr< _ValVector_<T> > uhal::ValVector< T >::mMembers
private

A shared pointer to a ValVector struct, so that every copy of this ValVector points to the same underlying memory.

Definition at line 399 of file ValMem.hpp.

Referenced by uhal::ClientInterface::CreateValVector().


The documentation for this class was generated from the following files: