Module ddsl.xtypes.utils
DDSL Utilities.
Info:
- Author: Rajive Joshi
Functions
nslookup (name, ns) | Look up the xtypes template referenced by a qualified name. |
to_idl_string_table (instance[, result=nil[, indent_string='']]) | Visit all elements (depth-first) of the datatype definition underlying an instance, and return the OMG IDL string representation of each member as a flattened array of strings. |
to_instance_string_table (instance[, result=nil[, template=nil[, base=nil]]]) | Visit all fields (depth-first) in the given instance and return their string representation as a flattened array of strings. |
Functions
- nslookup (name, ns)
-
Look up the xtypes template referenced by a qualified name.
Searches in several places:
- in the pre-defined xtypes,
- in the enclosing or global scope
Parameters:
- name
string
qualifed name (i.e. optionally scoped with
::
) of the datatype to lookup - ns xtemplate the scope (or namespace) to lookup the name in
Returns:
- xtemplate the template referenced by name, or nil
- optional string the template member, if any, identified by name (e.g. enum value)
- to_idl_string_table (instance[, result=nil[, indent_string='']])
-
Visit all elements (depth-first) of the datatype definition underlying an
instance, and return the OMG IDL string representation of each member as
a flattened array of strings.
Parameters:
- instance xinstance a DDSL instance
- result {string,...} the previous results table, to which the new results from this visit are appended (default nil)
- indent_string string indentation for string representation (default '')
Returns:
-
{string,...}
the cumulative result of visiting all the members of
datatype behindinstance
. The string representation of each member visited is inserted into this table. This returned table can be passed to another call to this method, to build a cumulative table of strings. - to_instance_string_table (instance[, result=nil[, template=nil[, base=nil]]])
-
Visit all fields (depth-first) in the given instance and return their string
representation as a flattened array of strings.
For instance collections, only the 1st element is visited.
Parameters:
- instance xinstance the instance to visit
- result {string,...} the previous results table, to which the new results from this visit are appended (default nil)
- template xtemplate template to use to visit the instance; nil means use the instance's template (default nil)
- base xtemplate the base 'struct' template (if any) to visit the members of the the base 'struct' template (default nil)
Returns:
-
{string,...}
the cumulative result of visiting all the fields. Each
field that is visited is inserted into this table. This returned table can
be passed to another call to this method, to build a cumulative table of
instance strings.