rogue
Loading...
Searching...
No Matches
Public Member Functions | List of all members
rogue::interfaces::memory::VariableWrap Class Reference

Internal Boost.Python wrapper for rogue::interfaces::memory::Variable. Enables Python subclasses to override variable-update behavior and bridge Python value objects to/from the C++ variable storage representation. More...

#include <Variable.h>

Inheritance diagram for rogue::interfaces::memory::VariableWrap:
rogue::interfaces::memory::Variable

Public Member Functions

 VariableWrap (std::string name, std::string mode, boost::python::object minimum, boost::python::object maximum, uint64_t offset, boost::python::object bitOffset, boost::python::object bitSize, bool overlapEn, bool verify, bool bulkOpEn, bool updateNotify, boost::python::object model, boost::python::object listData, uint32_t retryCount)
 Constructs a variable wrapper instance.
 
void updateOffset (boost::python::object &bitOffset)
 Updates bit-offset definition from Python.
 
void set (boost::python::object &value, int32_t index)
 Sets value from RemoteVariable.
 
boost::python::object get (int32_t index)
 Gets value from RemoteVariable.
 
boost::python::object toBytes (boost::python::object &value)
 Converts a Python value object to a byte representation.
 
boost::python::object fromBytes (boost::python::object &value)
 Converts a byte representation to a Python value object.
 
void defQueueUpdate ()
 Calls the base-class queueUpdate() implementation.
 
void queueUpdate ()
 Dispatches queue update callback.
 
boost::python::object bitOffset ()
 Returns bit-offset configuration.
 
boost::python::object bitSize ()
 Returns bit-size configuration.
 
- Public Member Functions inherited from rogue::interfaces::memory::Variable
 Variable (std::string name, std::string mode, double minimum, double maximum, uint64_t offset, std::vector< uint32_t > bitOffset, std::vector< uint32_t > bitSize, bool overlapEn, bool verify, bool bulkOpEn, bool updateNotify, uint32_t modelId, bool byteReverse, bool bitReverse, uint32_t binPoint, uint32_t numValues, uint32_t valueBits, uint32_t valueStride, uint32_t retryCount)
 Constructs a variable descriptor.
 
virtual ~Variable ()
 Destroys the variable instance.
 
void shiftOffsetDown (uint32_t shift, uint32_t minSize)
 Shifts variable offset and packed bit fields downward.
 
void updatePath (std::string path)
 Updates the hierarchical path string for this variable.
 
uint32_t modelId () const
 Returns model ID of the variable.
 
uint32_t bitTotal () const
 Returns total number of bits for this value.
 
uint32_t byteSize () const
 Returns total bytes (rounded up) for this value.
 
const std::string & name () const
 Returns variable name.
 
const std::string & mode () const
 Returns variable mode string.
 
const std::string & path () const
 Returns variable path.
 
double minimum ()
 Returns minimum value.
 
double maximum ()
 Returns maximum value.
 
uint32_t varBytes ()
 Returns variable range in bytes.
 
uint64_t offset ()
 Returns variable byte offset.
 
bool verifyEn ()
 Returns verify-enable flag.
 
bool overlapEn ()
 Returns overlap-enable flag.
 
bool bulkOpEn ()
 Returns bulk-operation enable flag.
 
uint32_t numValues ()
 Returns number of values.
 
uint32_t valueBits ()
 Returns number of bits per value.
 
uint32_t valueBytes ()
 Returns number of bytes per value.
 
uint32_t valueStride ()
 Returns byte stride per value.
 
uint32_t retryCount ()
 Returns retry count.
 
void rateTest ()
 Runs a local throughput benchmark for variable get/set operations.
 
void setLogLevel (uint32_t level)
 Sets logging level for variable's block.
 
std::string getDumpValue (bool read)
 Returns string representation of value using default converters.
 
void read ()
 Performs a read operation for this variable.
 
void setByteArray (uint8_t *value, int32_t index=-1)
 Sets value from a raw byte array.
 
void getByteArray (uint8_t *value, int32_t index=-1)
 Gets value into a raw byte array.
 
void setUInt (uint64_t &value, int32_t index=-1)
 Sets an unsigned integer value.
 
void setValue (uint64_t value, int32_t index=-1)
 Convenience alias for setUInt.
 
uint64_t getUInt (int32_t index=-1)
 Gets unsigned integer value.
 
void getValue (uint64_t &valueRet, int32_t index=-1)
 Gets unsigned integer value into output reference.
 
void setInt (int64_t &value, int32_t index=-1)
 Sets signed integer value.
 
void setValue (int64_t value, int32_t index=-1)
 Convenience alias for setInt.
 
int64_t getInt (int32_t index=-1)
 Gets signed integer value.
 
void getValue (int64_t &valueRet, int32_t index=-1)
 Gets signed integer value into output reference.
 
void setBool (bool &value, int32_t index=-1)
 Sets boolean value.
 
void setValue (bool value, int32_t index=-1)
 Convenience alias for setBool.
 
bool getBool (int32_t index=-1)
 Gets boolean value.
 
void getValue (bool &valueRet, int32_t index=-1)
 Gets boolean value into output reference.
 
void setString (const std::string &value, int32_t index=-1)
 Sets string value.
 
void setValue (const std::string &value, int32_t index=-1)
 Convenience alias for setString.
 
std::string getString (int32_t index=-1)
 Gets string value.
 
void getString (std::string &retString, int32_t index=-1)
 Gets string value into output reference.
 
void getValue (std::string &valueRet, int32_t index=-1)
 Gets string value into output reference.
 
void setFloat (float &value, int32_t index=-1)
 Sets float value.
 
void setValue (float value, int32_t index=-1)
 Convenience alias for setFloat.
 
float getFloat (int32_t index=-1)
 Gets float value.
 
void getValue (float &valueRet, int32_t index=-1)
 Gets float value into output reference.
 
void setDouble (double &value, int32_t index=-1)
 Sets double value.
 
void setValue (double value, int32_t index=-1)
 Convenience alias for setDouble.
 
double getDouble (int32_t index=-1)
 Gets double value.
 
void getValue (double &valueRet, int32_t index=-1)
 Gets double value into output reference.
 
void setFixed (double &value, int32_t index=-1)
 Sets fixed-point value.
 
double getFixed (int32_t index=-1)
 Gets fixed-point value.
 

Additional Inherited Members

- Static Public Member Functions inherited from rogue::interfaces::memory::Variable
static rogue::interfaces::memory::VariablePtr create (std::string name, std::string mode, double minimum, double maximum, uint64_t offset, std::vector< uint32_t > bitOffset, std::vector< uint32_t > bitSize, bool overlapEn, bool verify, bool bulkOpEn, bool updateNotify, uint32_t modelId, bool byteReverse, bool bitReverse, uint32_t binPoint, uint32_t numValues, uint32_t valueBits, uint32_t valueStride, uint32_t retryCount)
 Creates a memory variable descriptor.
 
static void setup_python ()
 Registers Python bindings for this class.
 
- Protected Attributes inherited from rogue::interfaces::memory::Variable
rogue::interfaces::memory::Blockblock_
 
std::string name_
 
std::string path_
 
uint32_t modelId_
 
bool byteReverse_
 
bool bitReverse_
 
uint32_t bitTotal_
 
uint32_t * fastByte_
 
uint32_t byteSize_
 
uint32_t varBytes_
 
uint64_t offset_
 
std::vector< uint32_t > bitOffset_
 
std::vector< uint32_t > bitSize_
 
double minValue_
 
double maxValue_
 
bool bulkOpEn_
 
bool updateNotify_
 
std::string mode_
 
bool overlapEn_
 
bool verifyEn_
 
uint32_t * lowTranByte_
 
uint32_t * highTranByte_
 
void * customData_
 
uint32_t binPoint_
 
bool stale_
 
uint32_t staleLowByte_
 
uint32_t staleHighByte_
 
uint32_t numValues_
 
uint32_t valueBits_
 
uint32_t valueBytes_
 
uint32_t valueStride_
 
uint32_t retryCount_
 
void(rogue::interfaces::memory::Block::* setFuncPy_ )(boost::python::object &, rogue::interfaces::memory::Variable *, int32_t index)
 
boost::python::object(rogue::interfaces::memory::Block::* getFuncPy_ )(rogue::interfaces::memory::Variable *, int32_t index)
 
void(rogue::interfaces::memory::Block::* setByteArray_ )(const uint8_t *, rogue::interfaces::memory::Variable *, int32_t index)
 
void(rogue::interfaces::memory::Block::* getByteArray_ )(uint8_t *, rogue::interfaces::memory::Variable *, int32_t index)
 
void(rogue::interfaces::memory::Block::* setUInt_ )(const uint64_t &, rogue::interfaces::memory::Variable *, int32_t index)
 
uint64_t(rogue::interfaces::memory::Block::* getUInt_ )(rogue::interfaces::memory::Variable *, int32_t index)
 
void(rogue::interfaces::memory::Block::* setInt_ )(const int64_t &, rogue::interfaces::memory::Variable *, int32_t index)
 
int64_t(rogue::interfaces::memory::Block::* getInt_ )(rogue::interfaces::memory::Variable *, int32_t index)
 
void(rogue::interfaces::memory::Block::* setBool_ )(const bool &, rogue::interfaces::memory::Variable *, int32_t index)
 
bool(rogue::interfaces::memory::Block::* getBool_ )(rogue::interfaces::memory::Variable *, int32_t index)
 
void(rogue::interfaces::memory::Block::* setString_ )(const std::string &, rogue::interfaces::memory::Variable *, int32_t index)
 
std::string(rogue::interfaces::memory::Block::* getString_ )(rogue::interfaces::memory::Variable *, int32_t index)
 
void(rogue::interfaces::memory::Block::* setFloat_ )(const float &, rogue::interfaces::memory::Variable *, int32_t index)
 
float(rogue::interfaces::memory::Block::* getFloat_ )(rogue::interfaces::memory::Variable *, int32_t index)
 
void(rogue::interfaces::memory::Block::* setDouble_ )(const double &, rogue::interfaces::memory::Variable *, int32_t index)
 
double(rogue::interfaces::memory::Block::* getDouble_ )(rogue::interfaces::memory::Variable *, int32_t index)
 
void(rogue::interfaces::memory::Block::* setFixed_ )(const double &, rogue::interfaces::memory::Variable *, int32_t index)
 
double(rogue::interfaces::memory::Block::* getFixed_ )(rogue::interfaces::memory::Variable *, int32_t index)
 

Detailed Description

Internal Boost.Python wrapper for rogue::interfaces::memory::Variable. Enables Python subclasses to override variable-update behavior and bridge Python value objects to/from the C++ variable storage representation.

This wrapper is an internal binding adapter and not a primary C++ API surface. It is registered by setup_python() under the base class name.

Definition at line 873 of file Variable.h.

Constructor & Destructor Documentation

◆ VariableWrap()

rogue::interfaces::memory::VariableWrap::VariableWrap ( std::string  name,
std::string  mode,
boost::python::object  minimum,
boost::python::object  maximum,
uint64_t  offset,
boost::python::object  bitOffset,
boost::python::object  bitSize,
bool  overlapEn,
bool  verify,
bool  bulkOpEn,
bool  updateNotify,
boost::python::object  model,
boost::python::object  listData,
uint32_t  retryCount 
)

Constructs a variable wrapper instance.

Parameters
nameVariable name.
modeVariable mode string.
minimumMinimum allowed value object.
maximumMaximum allowed value object.
offsetVariable byte offset within the parent block.
bitOffsetPython object containing bit offset definition.
bitSizePython object containing bit size definition.
overlapEnOverlap enable flag.
verifyVerify enable flag.
bulkOpEnBulk operation enable flag.
updateNotifyUpdate notification enable flag.
modelPython model object used for conversion behavior.
listDataPython list metadata for list-style variables.
retryCountNumber of retries for transport operations.

Definition at line 552 of file Variable.cpp.

Member Function Documentation

◆ bitOffset()

boost::python::object rogue::interfaces::memory::VariableWrap::bitOffset ( )

Returns bit-offset configuration.

Returns
Python object containing bit-offset values.

Definition at line 632 of file Variable.cpp.

◆ bitSize()

boost::python::object rogue::interfaces::memory::VariableWrap::bitSize ( )

Returns bit-size configuration.

Returns
Python object containing bit-size values.

Definition at line 636 of file Variable.cpp.

◆ defQueueUpdate()

void rogue::interfaces::memory::VariableWrap::defQueueUpdate ( )

Calls the base-class queueUpdate() implementation.

Used as the fallback when no Python override is present.

Definition at line 614 of file Variable.cpp.

◆ fromBytes()

boost::python::object rogue::interfaces::memory::VariableWrap::fromBytes ( boost::python::object &  value)

Converts a byte representation to a Python value object.

Parameters
valuePython bytes-like object to decode.
Returns
Python object representing the decoded value.

Definition at line 610 of file Variable.cpp.

◆ get()

boost::python::object rogue::interfaces::memory::VariableWrap::get ( int32_t  index)

Gets value from RemoteVariable.

Get value from RemoteVariable.

Copy the shadow memory value into the passed byte array.

Exposed as get() method to Python

Parameters
indexIndex of value, -1 to get full list.
Returns
Python object containing the requested value.

Definition at line 596 of file Variable.cpp.

◆ queueUpdate()

void rogue::interfaces::memory::VariableWrap::queueUpdate ( )
virtual

Dispatches queue update callback.

Invokes the Python override when provided.

Reimplemented from rogue::interfaces::memory::Variable.

Definition at line 619 of file Variable.cpp.

◆ set()

void rogue::interfaces::memory::VariableWrap::set ( boost::python::object &  value,
int32_t  index 
)

Sets value from RemoteVariable.

Set value from RemoteVariable.

Set the internal shadow memory with the requested variable value

Exposed as set() method to Python

Parameters
valueVariable value.
indexIndex of value, -1 to set full list.

Definition at line 590 of file Variable.cpp.

◆ toBytes()

boost::python::object rogue::interfaces::memory::VariableWrap::toBytes ( boost::python::object &  value)

Converts a Python value object to a byte representation.

Parameters
valuePython value to convert.
Returns
Python bytes-like object with serialized data.

Definition at line 605 of file Variable.cpp.

◆ updateOffset()

void rogue::interfaces::memory::VariableWrap::updateOffset ( boost::python::object &  bitOffset)

Updates bit-offset definition from Python.

Parameters
bitOffsetPython object containing new bit offsets.

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