cpp_delegate Package

cpp_delegate Package

cpp_delegate.__init__.dump_cpp_ast(env)[source]
cpp_delegate.__init__.dump_env(env)[source]
cpp_delegate.__init__.parse_cpp_ast(source, env)[source]
cpp_delegate.__init__.test(v)[source]

address_of Module

cpp_delegate.address_of.get_attributes(members)[source]
cpp_delegate.address_of.render(cpp_ast_json, attributes)[source]

context Module

class cpp_delegate.context.Context(cpp_ast_json, namespace='')[source]

Bases: object

class cpp_delegate.context.RemoteContext(stream, cpp_ast_json, namespace='')[source]

Bases: cpp_delegate.context.Context, cpp_delegate.dir_mixin.DirMixIn

This class provides access to public variables and fields within a remote context (i.e., namespace).

Variables and fields are accessible as Python attributes, allowing, for example, tab completion in IPython.

Parameters:
  • stream (serial.Serial) – A serial connection to the remote device.
  • cpp_ast_json (dict) – A JSON-serializable C++ abstract syntax tree, as parsed by clang_helpers.clang_ast.parse_cpp_ast(…, format=’json’).
  • namespace (str, optional) –

    A namespace specifier (e.g., "foo::bar") indicating the namespace to expose.

    A value of "" corresponds to the top-level namespace.

.<remote variable/field>

An attribute corresponding to each public variable or field within the remote context namespace.

_address_of(label)[source]
Parameters:label (str) – Name/label of variable or field in remote context.
Returns:Address in memory of specified variable or field in remote context.
Return type:int
_mem_read(address, size)[source]
Parameters:
  • address (int) – Memory address in remote context.
  • size (int) – Number of bytes to read.
Returns:

Array of data read from remote context.

Return type:

np.array(dtype=’uint8’)

_mem_write(address, data)[source]

Write data to specified address in remote context.

Parameters:
  • address (int) – Memory address in remote context.
  • data (numpy.array-like) – Array or :module:`numpy` data type.
_read_attribute(attr, *args)[source]
Parameters:
  • attr (str) – Name of attribute in remote context.
  • default (object, optional) – Default return value.
Returns:

Value of specified attribute in remote context.

If type is not supported (i.e., not a plain old data type), default is returned (if specified).

Return type:

type of attr

_read_attributes()[source]
Returns:Value of each attribute in remote context.

For each attribute, if type is not supported (i.e., not a plain old data type), value is set to None.

Return type:dict
_write_attribute(attr, value)[source]
Parameters:
  • attr (str) – Name of attribute in remote context.
  • value (type of attr) – Value to set for specified attribute in remote context.
Raises:

TypeError – If attribute type is not supported (i.e., not a plain old data type).

cpp_delegate.context.get_namespace_path(namespace_str)[source]
cpp_delegate.context.get_np_dtype(type_name, default=False)[source]
cpp_delegate.context.operation_code(v)

dir_mixin Module

class cpp_delegate.dir_mixin.DirMixIn[source]

Bases: object

Mix-in to make implementing __dir__ method in subclasses simpler

member_header Module

cpp_delegate.member_header.get_functions(members)[source]
cpp_delegate.member_header.render(functions)[source]