Overview
The following legacy support is provided.
Data & Utility Interfaces
Standard Library Data & Utility Components previously provided a procedural-style interface that has since been superceded for performance reasons. The new interfaces are detailed in the documentation for the Standard Library. The old interfaces are emulated in the 1065 and 1199 bindings so that 1065 and 1199 Processes will not need modification. Users can upgrade to the new interface to obtain a performance enhancement, if required. Future C++ bindings will not provide these legacy interfaces.
data/numeric
The data object provides the following C++ interface (for details of the C interface, see the associated header file).
C/C++ API (Data)
This structure holds information about the structure of the contained data. The upper part is fundamental, the lower part is derived. When passing the structure, set only the upper part. When receiving, both parts will be set.
- std_2009_data_numeric_0::Structure* std_2009_data_numeric_0::get_structure(
Symbol hCaller, Symbol hData) - Return the structure.
- void std_2009_data_numeric_0::set_structure(
Symbol hCaller, Symbol hData, Structure& structure) - Set the structure.
- void std_2009_data_numeric_0::set_structure(
Symbol hCaller, Symbol hData, TYPE type, const Dimensions & dims) - Set the structure (alternative interface). Fixed-point not supported - use the above form instead.
- void std_2009_data_numeric_0::validate(
Symbol hCaller, Symbol hData, TYPE type) - Validate the numeric type (raise an exception on mismatch).
- void std_2009_data_numeric_0::validate(
Symbol hCaller, Symbol hData, std_2009_data_numeric_0::Structure& structure) - Validate the structure (raise an exception on mismatch).
- void std_2009_data_numeric_0::validate(
Symbol hCaller, Symbol hData, TYPE type, const Dimensions & dims) - Validate the structure (alternative interface, raise an exception on mismatch). Fixed-point not supported - use the above form instead.
- void std_2009_data_numeric_0::set_content(
Symbol hCaller, Symbol hData, void* real, void* imag) - Set the content from separate real and imaginary memory blocks. Each block should be of size
numberOfBytesReal bytes.
- void std_2009_data_numeric_0::set_content(
Symbol hCaller, Symbol hData, void* both) - Set the content from one memory block that holds real and imaginary data consecutively. Block should be of size
numberOfBytesTotal bytes.
- void std_2009_data_numeric_0::get_content(
Symbol hCaller, Symbol hData, void*& real, void*& imag) - Get the content into separate real and imaginary memory blocks. Each block should be of size
numberOfBytesReal bytes.
- void* std_2009_data_numeric_0::get_content(
Symbol hCaller, Symbol hData) - Get the content into one memory block that holds real and imaginary data consecutively. Block should be of size
numberOfBytesTotal bytes.
Example
Validate zeroth input during EVENT_INIT_CONNECT
C++ Source Code (against 1199)
Validate zeroth input during EVENT_INIT_CONNECT (using aliased namespace)
C++ Source Code (against 1199)
namespace numeric = std_2009_data_numeric_0 ;
...
hInput = iif .getPort (0 );
Symbol hData = iif .getData (hInput );
assertClass (hData , "std/2009/data/numeric ");
numeric ::validate (hComponent , hData , TYPE_DOUBLE );
Create output during EVENT_INIT_CONNECT
C++ Source Code (against 1199)
Read input during EVENT_RUN_SERVICE
C++ Source Code (against 1199)
Symbol hData = iif .getData (hInput );
std_2009_data_numeric_0 ::Structure* structure =
std_2009_data_numeric_0 ::get_structure (hComponent , hData );
VBYTE input_real , input_imag ;
input_real .resize (structure ->numberOfBytesReal );
input_imag .resize (structure ->numberOfBytesReal );
...
Symbol hData = iif .getData (hInput );
std_2009_data_numeric_0 ::get_content (hComponent ,
hData , input_real , input_imag );
Write output during EVENT_RUN_SERVICE
C++ Source Code (against 1199)
Symbol hData = iif .getData (hOutput );
ExtendedStructure * structure =
std_2009_data_numeric_0 ::get_structure (hComponent , hData );
VBYTE output_real , output_imag ;
output_real .resize (structure .numberOfBytesReal );
output_imag .resize (structure .numberOfBytesReal );
...
Symbol hData = oif .getData (hOutput );
std_2009_data_numeric_0 ::set_content (hComponent ,
hData , output_real , output_imag );
data/spikes
The data object provides the following C++ interface (for details of the C interface, see the associated header file).
- void std_2009_data_spikes_0::set_dimensions(
Symbol hCaller, Symbol hData, Dimensions * dims) - Set the dimensions of the object. At time of writing, if there is more than one dimension,
E_NOT_IMPLEMENTED is thrown.
Dimensions * std_2009_data_spikes_0::get_dimensions(Symbol hCaller, Symbol hData)- Get the dimensions of the object.
- void std_2009_data_spikes_0::set_capacity(
Symbol hCaller, Symbol hData, UINT32 capacity) - Set the capacity of the object (list length).
UINT32 std_2009_data_spikes_0::get_capacity(Symbol hCaller, Symbol hData)- Get the capacity of the object.
- void std_2009_data_spikes_0::set_content(
Symbol hCaller, Symbol hData, INT32 * state, UINT32 count) - Set the content of the object.
state should be a vector of indices of spikes that are present (boolean true), and count should be the length of that vector.
UINT32 std_2009_data_spikes_0::get_content(Symbol hCaller, Symbol hData, INT32 *& state)- Get the content of the object.
state will be a vector of indices of spikes that are present (boolean true), and the return value will be the length of that vector.
Example
Validate input during EVENT_INIT_CONNECT
C++ Source Code (against 1199)
hInput = iif .getPort (0 );
Symbol hData = iif .getData (hInput );
assertClass (hData , "std/2009/data/spikes ");
if (std_2009_data_spikes_0 ::get_capacity (hComponent , hData ) != N )
{
berr << "expected spikes input of width " << N ;
}
Validate input during EVENT_INIT_CONNECT (using aliased namespace)
C++ Source Code (against 1199)
namespace spikes = std_2009_data_spikes_0 ;
...
hInput = iif .getPort (0 );
Symbol hData = iif .getData (hInput );
assertClass (hData , "std/2009/data/spikes ");
if (spikes ::get_capacity (hComponent , hData ) != N )
{
berr << "expected spikes input of width " << N ;
}
Create output during EVENT_INIT_CONNECT
C++ Source Code (against 1199)
hOutput = oif .addPort ("std/2009/data/spikes ", 0 );
Symbol hData = oif .getData (hOutput );
std_2009_data_spikes_0 ::set_capacity (hComponent , hData , N );
Read input during EVENT_RUN_SERVICE
C++ Source Code (against 1199)
Symbol hData = iif .getData (hInput );
INT32 * state ;
UINT32 count = std_2009_data_spikes_0 ::get_content (hComponent ,
hData , state );
Write output during EVENT_RUN_SERVICE
C++ Source Code (against 1199)
VINT32 spikes ;
spikes .push_back (...);
...
Symbol hData = oif .getData (hOutput );
if (spikes .size ()) std_2009_data_spikes_0 ::set_content (hComponent ,
hData , &spikes [0 ], spikes .size ());
else std_2009_data_spikes_0 ::set_content (hComponent ,
hData , NULL , 0 );
util/rng
The utility provides the following C++ interface (for details of the C interface, see the associated header file).
- void std_2009_util_rng_0::select(
Symbol hCaller, Symbol hUtility, const char* generator) - Select the RNG that will be used internally. The string
generator should have the form <RNG>.<distribution> , where <RNG> must currently be "MT2000", and <distribution> can be one of "normal", "uniform" or "exponential". All of these generators are single-precision internally.
- void std_2009_util_rng_0::seed(
Symbol hCaller, Symbol hUtility, UINT32 * seed, UINT32 count) - Seed the RNG from a vector of integers. Pass a scalar zero to seed non-repeatably using a value based at least partly on the current system clock.
- void std_2009_util_rng_0::fill(
Symbol hCaller, Symbol hUtility, DOUBLE * dst, UINT64 count, DOUBLE gain - 1.0,
DOUBLE offset = 0.0)=Fill the vector dst with count DOUBLE values from the RNG. Optional gain and offset will be applied before delivery.
- void std_2009_util_rng_0::fill(
Symbol hCaller, Symbol hUtility, SINGLE * dst, UINT64 count, SINGLE gain - 1.0,
SINGLE offset = 0.0)=Fill the vector dst with count SINGLE values from the RNG. Optional gain and offset will be applied before delivery.
DOUBLE std_2009_util_rng_0::get(Symbol hCaller, Symbol hUtility)- Get a single
DOUBLE value from the RNG.
Example
Obtain a random number generator
C++ Source Code (against 1199)
Obtain some random values from it
C++ Source Code (against 1199)
namespace rng = std_2009_util_rng_0 ;
Symbol hRNG ;
...
case EVENT_RUN_SERVICE:
{
...
DOUBLE * p = ...
rng ::fill (hComponent , hRng , p , numEls , gain , offset );
...
}
|