Fabcoin Core  0.16.2
P2P Digital Currency
Public Member Functions | Private Attributes | List of all members
PutBlock< T, B, A > Class Template Reference

Access a block of memory. More...

#include <misc.h>

Public Member Functions

 PutBlock (const void *xorBlock, void *block)
 Construct a PutBlock. More...
 
template<class U >
PutBlock< T, B, A > & operator() (U x)
 Access a block of memory. More...
 

Private Attributes

const bytem_xorBlock
 
bytem_block
 

Detailed Description

template<class T, class B, bool A = false>
class PutBlock< T, B, A >

Access a block of memory.

Template Parameters
Tclass or type
Benumeration indicating endianness
Aflag indicating alignment

PutBlock() provides alternate write access to a block of memory. The enumeration B is BigEndian or LittleEndian. The flag A indicates if the memory block is aligned for class or type T. Repeatedly applying operator() results in advancing in the block of memory.

An example of writing two word32 values from a block of memory is shown below. After the code executes, the byte buffer will be {0,1,2,3,4,5,6,7}.

   word32 w1=0x03020100, w2=0x07060504;
   byte buffer[8];
   PutBlock<word32, LittleEndian> block(NULL, buffer);
   block(w1)(w2);

Definition at line 2195 of file misc.h.

Constructor & Destructor Documentation

template<class T, class B, bool A = false>
PutBlock< T, B, A >::PutBlock ( const void *  xorBlock,
void *  block 
)
inline

Construct a PutBlock.

Parameters
blockthe memory block
xorBlockoptional mask

Definition at line 2201 of file misc.h.

Member Function Documentation

template<class T, class B, bool A = false>
template<class U >
PutBlock<T, B, A>& PutBlock< T, B, A >::operator() ( x)
inline

Access a block of memory.

Template Parameters
Uclass or type
Parameters
xthe value to write
Returns
pointer to the remainder of the block after writing x

Definition at line 2209 of file misc.h.

Here is the call graph for this function:

Member Data Documentation

template<class T, class B, bool A = false>
byte* PutBlock< T, B, A >::m_block
private

Definition at line 2220 of file misc.h.

template<class T, class B, bool A = false>
const byte* PutBlock< T, B, A >::m_xorBlock
private

Definition at line 2219 of file misc.h.


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