Skip to main content

Crate zerodds_idl_cpp

Crate zerodds_idl_cpp 

Source
Expand description

IDL4 → C++17-Header-Codegen (OMG IDL4-CPP-Mapping, formal/2018-07-01).

Crate zerodds-idl-cpp — foundation of the language binding (cluster C5.1-a).

Safety classification: SAFE (std-only). Pure build-time tool — forbid(unsafe_code), no no_std use case.

§Scope (C5.1-a)

  • Block A: header layout (#pragma once, namespace, includes).
  • Block B: primitive mapping (boolean → bool, octet → uint8_t, …).
  • Block C: struct/enum/union/typedef/sequence/array/inheritance.
  • Block D: exception → class X : public std::exception.
  • Block E: Time/Duration → DDS::Time_t / DDS::Duration_t.

§C5.1-b extensions

  • Block F: status mapping (13 status classes, status).
  • Block G: QoS policy + type traits (22 policies, qos).
  • Block H: DCPS entity header stubs (dcps).

§C5.2 extensions

  • DDS-PSM-CXX header skeleton layer (psm_cxx).

§C6.1.D-cpp extensions

  • DDS-RPC C++ PSM codegen (rpc) — service interface, requester, replier, ServiceTraits + RemoteException hierarchy. Spec §10.

§Intentionally not in the crate

  • Bitset/Bitmask, Map, Fixed, Any, Interface, Valuetype.
  • Linker tests (static header generation is sufficient).

§Example

use zerodds_idl::config::ParserConfig;
use zerodds_idl_cpp::{generate_cpp_header, CppGenOptions};

let ast = zerodds_idl::parse(
    "module M { struct S { long x; }; };",
    &ParserConfig::default(),
)
.expect("parse");
let cpp = generate_cpp_header(&ast, &CppGenOptions::default()).expect("gen");
assert!(cpp.contains("namespace M"));
assert!(cpp.contains("class S"));

Re-exports§

pub use c_mode::CGenOptions;
pub use c_mode::generate_c_header;
pub use error::CppGenError;
pub use psm_cxx::emit_condition_skeleton;
pub use psm_cxx::emit_core_basics;
pub use psm_cxx::emit_exception_hierarchy;
pub use psm_cxx::emit_full_psm_cxx_skeleton;
pub use psm_cxx::emit_listener_skeleton;
pub use psm_cxx::emit_psm_cxx_includes;
pub use psm_cxx::emit_reference_value_pattern;

Modules§

c_mode
IDL → C99 codegen mode (vendor spec zerodds-xcdr2-c-1.0).
dcps
Block-H: DCPS entity header stubs (Spec idl4-cpp-1.0 §7.6 + dds-psm-cxx-1.0 §8.1).
emitter
AST walker that emits C++17 headers.
error
Error types for the IDL→C++ codegen.
psm_cxx
C5.2: DDS-PSM-CXX 1.0 header skeleton layer.
qos
Block-G: QoS policy + type traits (Spec idl4-cpp-1.0 §7.5).
rpc
C6.1.D-cpp: DDS-RPC C++ PSM-Codegen.
status
Block-F: DDS status mapping (spec idl4-cpp-1.0 §7.4 + dds-1.4 §2.2.4.1).
type_map
Mapping IDL-Primitive → C++-Type-Strings.

Structs§

CppGenOptions
Configuration of the code generator.

Functions§

generate_cpp_header
Produces a complete C++17 header from an IDL specification.
generate_cpp_header_with_amqp
Convenience variant with the emit_amqp_helpers flag enabled.
generate_cpp_header_with_corba_traits
Convenience variant with the emit_corba_traits flag enabled.