36 #include "uhal/log/log.hpp" 49 template<
typename T >
60 template<
typename T >
117 template<
typename T >
125 template<
typename T >
128 mMembers ( aVal.mMembers )
132 template<
typename T >
135 mMembers ( new
_ValWord_<T> ( T() , false , 0xFFFFFFFF ) )
139 template<
typename T >
142 return mMembers->
valid;
145 template<
typename T >
148 mMembers->
valid = aValid;
151 template<
typename T >
154 mMembers->
value = aValue ;
178 template<
typename T >
184 template<
typename T >
187 if ( mMembers->valid )
193 exception::NonValidatedMemory lExc;
194 log ( lExc ,
"Access attempted on non-validated memory" );
199 template<
typename T >
202 if ( !mMembers->valid )
204 mMembers->
value = aValue;
208 exception::ValMemImutabilityViolation lExc;
209 log ( lExc ,
"Attempted to modify validated memory" );
214 template<
typename T >
217 return mMembers->
mask;
220 template<
typename T >
223 mMembers->
mask = aMask ;
257 template<
typename T >
260 mMembers ( new
_ValVector_<T> ( aValues , false ) )
265 template<
typename T >
268 mMembers ( aValues.mMembers )
273 template<
typename T >
276 mMembers ( new
_ValVector_<T> (
std::vector<T> ( aSize , T() ) , false ) )
281 template<
typename T >
289 template<
typename T >
292 return mMembers->
valid;
295 template<
typename T >
298 mMembers->
valid = aValid;
303 template<
typename T >
306 if ( !mMembers->valid )
308 mMembers->value.push_back ( aValue );
312 exception::ValMemImutabilityViolation lExc;
313 log ( lExc ,
"Attempted to modify validated memory" );
318 template<
typename T >
321 if ( mMembers->valid )
323 return ( mMembers->value ) [aIndex];
327 exception::NonValidatedMemory lExc;
328 log ( lExc ,
"Access attempted on non-validated memory" );
333 template<
typename T >
336 if ( mMembers->valid )
338 return mMembers->
value.at ( aIndex );
342 exception::NonValidatedMemory lExc;
343 log ( lExc ,
"Access attempted on non-validated memory" );
348 template<
typename T >
351 return mMembers->
value.size();
366 template<
typename T >
369 mMembers->
valid =
false;
370 mMembers->value.clear();
373 template<
typename T >
376 if ( mMembers->valid )
378 return mMembers->
value.begin();
382 exception::NonValidatedMemory lExc;
383 log ( lExc ,
"Access attempted on non-validated memory" );
388 template<
typename T >
391 if ( mMembers->valid )
393 return mMembers->
value.end();
397 exception::NonValidatedMemory lExc;
398 log ( lExc ,
"Access attempted on non-validated memory" );
403 template<
typename T >
406 if ( mMembers->valid )
408 return mMembers->
value.rbegin();
412 exception::NonValidatedMemory lExc;
413 log ( lExc ,
"Access attempted on non-validated memory" );
418 template<
typename T >
421 if ( mMembers->valid )
423 return mMembers->
value.rend();
427 exception::NonValidatedMemory lExc;
428 log ( lExc ,
"Access attempted on non-validated memory" );
434 template<
typename T >
437 if ( mMembers->valid )
439 return mMembers->
value;
443 exception::NonValidatedMemory lExc;
444 log ( lExc ,
"Access attempted on non-validated memory" );
449 template<
typename T >
452 if ( !mMembers->valid )
454 mMembers->
value = aValue;
458 exception::ValMemImutabilityViolation lExc;
459 log ( lExc ,
"Attempted to modify validated memory" );
A class which wraps a single word of data and marks whether or not it is valid.
std::vector< T >::const_iterator const_iterator
typedef iterator to be that of the underlying storage type
std::vector< T >::const_reverse_iterator const_reverse_iterator
typedef iterator to be that of the underlying storage type
T value() const
Return the value of the validated memory with check on validity.
A class which wraps a block of data and marks whether or not it is valid.
A Template helper struct wrapping an IPbus header, a register for storing a single word of data...
const uint32_t & mask() const
Return the mask used by this validated memory.
bool valid()
Return whether the Validated memory is marked as valid.
T value
A register for storing data.
bool valid()
Return whether the Validated memory is marked as valid.
std::vector< T > value() const
Return the value of the validated memory with check on validity.
_ValWord_(const T &aValue, const bool &aValid, const uint32_t aMask)
Constructor Private, since this struct should only be used by the ValWord.
lDepths push_back(N_200MB)
_ValVector_(const std::vector< T > &aValue, const bool &aValid)
Constructor Private, since this struct should only be used by the ValVector.
unsigned int TrailingRightBits(uint32_t aValue)
Helper function to calculate the number of zero-bits at the righthand end of a 32-bit number...
ValWord()
Default constructor.
A Template helper struct wrapping a block of IPbus header, a register for storing a block of data and...