TRY_Generic_Bank provides a selection of protected methods to simplify data access. Methods treat all fundamental YBOS data types with individual element access, except ASCII characters which are treated as part of a C++ string and double precision floating point which is not yet implemented.
Each type specification with a repeat count, called a ``field'' here, is treated as an array of the appropriate type of elements. The ``offset'' argument is the location in units of integers of the field from the beginning of the user data section. The ``index'' argument is the index of the desired element into the field. While this may seem cumbersome at first, this does neatly describe mixed-type bank data access. For mono-type banks, the offset value is always zero. ASCII characters, unlike other types, are accessed and modified as strings of characters, rather than as individual characters. For them, the ``field_words'' argument is the number of integers containing ASCII characters in the string.
byte get_BY_element(const int4 offset, const int4 index) const ; uint2 get_I2_element(const int4 offset, const int4 index) const ; int4 get_I4_element(const int4 offset, const int4 index) const ; float4 get_R4_element(const int4 offset, const int4 index) const ; bool set_BY_element(const int4 offset, const int4 index, const byte value) ; bool set_I2_element(const int4 offset, const int4 index, const uint2 value) ; bool set_I4_element(const int4 offset, const int4 index, const int4 value) ; bool set_R4_element(const int4 offset, const int4 index, const float4 value) ; string get_AS_string(const int4 offset, const int4 field_words) const ; bool set_AS_string(const int4 offset, const int4 field_words, const string& value) ;
Since the different specific banks will implement different abstractions, however, not very much more can be said about data access in general. All specific banks classes that will be automatically generated will provide at least a raw level of read access to int4 array in which data is stored, regardless of type of data elements. No raw ``set'' methods are provided since this could lead to floating point and other exceptions if inappropriate values are installed in the storage used for non-integer data.
int4 n_raw_data_words(void) ; // number of int4 words used for data int4 raw_data_word(const int4 index) ; // 0 <= index < n_raw_data_words()
For mono-type and simple mixed-type banks, properly typed access to data elements will be provided in automatically generated bank classes via plain-name accessors. Examples of some such methods for different data types follow, each with an appropriate method to indicate the maximum value for the index:
int4 n_elements(void) const ; // number of data items stored in bank // AND ONE OF THE FOLLOWING ACCESSORS byte BY_element(const int4 index) ; uint2 I2_element(const int4 index) ; int4 I4_element(const int4 index) ; float4 R4_element(const int4 index) ; char AS_string( const int4 index) ; // AND ONE OF THE FOLLOWING MODIFIERS bool set_BY_element(const int4 index, const byte value) ; bool set_I2_element(const int4 index, const int2 value) ; bool set_I4_element(const int4 index, const int4 value) ; bool set_R4_element(const int4 index, const float4 value) ; bool set_AS_string(const string& value) ;