FrontPanel API 5.3.5
Loading...
Searching...
No Matches
OpalKelly::ScriptValue Class Reference

Represents a value passed to a scripting function or returned from it. More...

Public Member Functions

 ScriptValue ()
 Default constructor creates an uninitialized value.
 
 ScriptValue (int n)
 Create an integer-valued object.
 
 ScriptValue (bool b)
 Create a boolean-valued object.
 
 ScriptValue (const std::string &s)
 Create a string-valued object.
 
 ScriptValue (Buffer buf)
 Create a buffer-valued object.
 
 ScriptValue (const ScriptValue &value)
 Create a copy of another value.
 
ScriptValueoperator= (const ScriptValue &value)
 Assign another value to this one.
 
bool GetAsInt (int *pn) const
 Try to get the value as an integer.
 
bool GetAsBool (bool *pb) const
 Try to get the value as a boolean.
 
bool GetAsString (std::string *ps) const
 Try to get the value as a string.
 
bool GetAsBuffer (Buffer *pbuf) const
 Try to get the value as a buffer.
 

Detailed Description

Objects of this class are used with ScriptEngine to pass values to the script functions or retrieve their return values.

To pass a value, it's usually enough to just create a ScriptValue from a string or an integer implicitly, using one of the constructors.

When retrieving a value from a script, it is necessary to call one of the GetAsXXX() methods to determine the type of the contained value and get it.

This class has value-like semantics, i.e. objects of this type can be copied and assigned as any primitive value.

Member Function Documentation

◆ GetAsBool()

bool OpalKelly::ScriptValue::GetAsBool ( bool * pb) const

If the function returns true, pb is filled with the value. Otherwise false is returned and pb is not modified.

◆ GetAsBuffer()

bool OpalKelly::ScriptValue::GetAsBuffer ( Buffer * pbuf) const

If the function returns true, pbuf is filled with the buffer data. Otherwise false is returned and pbuf is not modified.

◆ GetAsInt()

bool OpalKelly::ScriptValue::GetAsInt ( int * pn) const

If the function returns true, pn is filled with the value. Otherwise false is returned and pn is not modified.

◆ GetAsString()

bool OpalKelly::ScriptValue::GetAsString ( std::string * ps) const

If the function returns true, ps is filled with the value. Otherwise false is returned and ps is not modified.


Copyright (c) 2005-2024 Opal Kelly Incorporated