Skip to main content

hdds_gen Code Generator

hdds_gen (CLI: idl-gen) is a high-performance IDL 4.2 code generator that produces type support code for multiple languages from a single IDL source.

Features

  • Full IDL 4.2 compliance - 100% support for basic types, templates, constructs
  • 6 target languages - Rust, C++, C, Python, Micro (embedded Rust), C-Micro
  • Zero dependencies - Generated code is self-contained
  • CDR2 serialization - Automatic encode/decode implementation
  • XTypes support - Type evolution and compatibility
  • CI/CD ready - JSON diagnostics, deterministic output

Quick Start

# Install
cargo install hdds-gen

# Generate Rust code
idl-gen gen rust MyTypes.idl -o my_types.rs

# Generate C++ with namespace
idl-gen gen cpp MyTypes.idl --namespace-cpp "MyApp::Types" -o my_types.hpp

# Generate full example project
idl-gen gen rust MyTypes.idl --example --out-dir ./my_project

Subcommands

CommandPurpose
genGenerate code in target language
parseValidate IDL and pretty-print AST
checkValidate with structural checks (CI-friendly)
fmtReformat IDL to canonical style

Target Languages

LanguageOutputUse Case
rustIdiomatic Rust with derivesNative Rust DDS applications
cppModern C++ headers (.hpp)C++ DDS applications
cHeader-only C99Embedded systems, FFI
pythonDataclasses with type hintsScripting, prototyping
microno_std RustEmbedded Rust (ESP32, ARM)
c-microHeader-only MCU CSTM32, AVR, PIC, ESP32

Example

Input: Temperature.idl

module sensors {
@topic
struct Temperature {
@key string sensor_id;
float value;
unsigned long long timestamp;
};
};

Output: Rust

#[derive(Debug, Clone, Serialize, Deserialize, Topic)]
pub struct Temperature {
#[key]
pub sensor_id: String,
pub value: f32,
pub timestamp: u64,
}

Output: C

typedef struct {
char* sensor_id;
float value;
uint64_t timestamp;
} sensors_Temperature;

int32_t sensors_Temperature_encode(const sensors_Temperature* p, uint8_t* buf, uint32_t len);
int32_t sensors_Temperature_decode(sensors_Temperature* p, const uint8_t* buf, uint32_t len);

Next Steps