PVData C++  8.0.6
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Classes | Public Types | Public Member Functions | List of all members
epics::pvData::PVRequestMapper Class Reference

#include <copy/pv/createRequest.h>

Public Types

enum  mode_t { Mask, Slice }
 

Public Member Functions

 PVRequestMapper (const PVStructure &base, const PVStructure &pvRequest, mode_t mode=Mask)
 
void reset ()
 return to state of default ctor
 
const StructureConstPtrbase () const
 
const StructureConstPtrrequested () const
 
const BitSetrequestedMask () const
 
PVStructurePtr buildRequested () const
 
PVStructurePtr buildBase () const
 
void compute (const PVStructure &base, const PVStructure &pvRequest, mode_t mode=Mask)
 
const std::stringwarnings () const
 After compute(), check if !warnings().empty()
 
void copyBaseToRequested (const PVStructure &base, const BitSet &baseMask, PVStructure &request, BitSet &requestMask) const
 
void copyBaseFromRequested (PVStructure &base, BitSet &baseMask, const PVStructure &request, const BitSet &requestMask) const
 
void maskBaseToRequested (const BitSet &baseMask, BitSet &requestMask) const
 
void maskBaseFromRequested (BitSet &baseMask, const BitSet &requestMask) const
 
void swap (PVRequestMapper &other)
 Exchange contents of two mappers. O(0) and never throws.
 

Detailed Description

Helper for implementations of epics::pvAccess::ChannelProvider in interpreting the 'field' substructure of a pvRequest. Copies between an internal (base) Structure, and a client/user visible (requested) Structure.

Note
PVRequestMapper is not re-entrant. It is copyable and swap()able.

Definition at line 74 of file createRequest.h.

Member Enumeration Documentation

Enumerator
Mask 

Masking mode.

   Requested Structure is identical to Base.
   The 'field' substructure of the provided pvRequest is used to construct a BitSet
   where the bits corresponding to the "selected" fields are set.  This mask can be
   access via. requestedMask().  The copy* and mask* methods operate only
   on "selected" fields.
Slice 

Slice mode

   The Requested Structure is a strict sub-set of the Base Structure containing
   those fields "selected" by the 'field' substructure of the provided pvRequest.

Definition at line 76 of file createRequest.h.

Constructor & Destructor Documentation

epics::pvData::PVRequestMapper::PVRequestMapper ( const PVStructure base,
const PVStructure pvRequest,
mode_t  mode = Mask 
)
See Also
compute()

Member Function Documentation

const StructureConstPtr& epics::pvData::PVRequestMapper::base ( ) const
inline
Returns
the Structure of the PVStructure previously passed to compute(). NULL if never computed()'d

Definition at line 104 of file createRequest.h.

PVStructurePtr epics::pvData::PVRequestMapper::buildBase ( ) const
Returns
A new instance of the base() Structure
PVStructurePtr epics::pvData::PVRequestMapper::buildRequested ( ) const
Returns
A new instance of the requested() Structure
void epics::pvData::PVRequestMapper::compute ( const PVStructure base,
const PVStructure pvRequest,
mode_t  mode = Mask 
)

(re)compute the selected subset of provided base structure.

Parameters
baseA full base structure. Must be "top level" (field offset zero).
pvRequestThe user/client provided request modifier
modeControl how the mapping is constructed.
See Also
mode_t for a description of mapping modes.
Postcondition
Updates warnings()
Exceptions
std::runtime_errorFor errors involving invalid pvRequest
std::logic_errorif the provided base is not a "top level" PVStructure.
void epics::pvData::PVRequestMapper::copyBaseFromRequested ( PVStructure base,
BitSet baseMask,
const PVStructure request,
const BitSet requestMask 
) const

Copy field values into Base structure from Requested structure

Parameters
baseAn instance of the base Structure. Field values are copied into it. Need not be the same instance passed to compute().
baseMaskA bit mask indicating which base fields were copied. BitSet::clear() is not called.
requestAn instance of the requested() Structure. Field values are copied from it.
requestMaskA bit mask selecting those requested fields to copy.
void epics::pvData::PVRequestMapper::copyBaseToRequested ( const PVStructure base,
const BitSet baseMask,
PVStructure request,
BitSet requestMask 
) const

Copy field values from Base structure into Requested structure

Parameters
baseAn instance of the base Structure. Field values are copied from it. Need not be the same instance passed to compute().
baseMaskA bit mask selecting those base fields to copy.
requestAn instance of the requested() Structure. Field values are copied to it.
requestMaskA bit mask indicating which requested fields were copied. BitSet::clear() is not called.
void epics::pvData::PVRequestMapper::maskBaseFromRequested ( BitSet baseMask,
const BitSet requestMask 
) const
inline

Translate requested bit mask into base bit mask. BitSet::clear() is not called.

Definition at line 187 of file createRequest.h.

void epics::pvData::PVRequestMapper::maskBaseToRequested ( const BitSet baseMask,
BitSet requestMask 
) const
inline

Translate Base bit mask into requested bit mask. BitSet::clear() is not called.

Definition at line 179 of file createRequest.h.

const StructureConstPtr& epics::pvData::PVRequestMapper::requested ( ) const
inline
Returns
the Structure which is the selected sub-set of the base Structure. NULL if never computed()'d

Definition at line 106 of file createRequest.h.

const BitSet& epics::pvData::PVRequestMapper::requestedMask ( ) const
inline

A mask of all fields in the base structure which are also in the requested structure, and any parent/structure "compress" bits. eg. bit 0 is always set.

PVRequestMapper mapper(...);
...
BitSet changed = ...; // a base changed mask
bool wouldcopy = changed.logical_and(mapper.requestedMask());
// wouldcopy==false means that copyBaseToRequested(..., changed, ...) would be a no-op

eg. allows early detection of empty monitor updates.

Definition at line 121 of file createRequest.h.


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