#pragma once // ───────────────────────────────────────────────────────────────────────────── // full_api — a DEPENDENCY INTERFACE (method + event contract) decoupled from any // concrete module. It names NO module; any module whose API is a superset of // this satisfies it. A consumer binds it to a concrete module name at runtime // via modules().bind_full_api("some_module"). // // Both test_fullapi_cpp and test_fullapi_rust implement exactly this surface, so // the same bound handle drives either provider (and this proxy, which re-exposes // it, satisfies it too). // // Types are std (the consuming module is universal); the generated bound wrapper // inherits that api-style. NO trailing `// comments` on declaration lines — the // header parser only accepts a line ending in `;`. // ───────────────────────────────────────────────────────────────────────────── #include #include #include #include // LogosMap, LogosList, nlohmann::json #include // defines the `logos_events` token #include // StdLogosResult class IFullApi { public: std::string whoAmI(); // Scalar echoes: tstr / bstr / int / uint / float64 / bool / any std::string echoString(const std::string& v); std::vector echoBytes(const std::vector& v); int64_t echoInt(int64_t v); uint64_t echoUint(uint64_t v); double echoDouble(double v); bool echoBool(bool v); nlohmann::json echoAny(const nlohmann::json& v); // Container echoes: [tstr] / [int] / [uint] / [float64] / [bool] / [any] / {tstr:any} std::vector echoStringList(const std::vector& v); std::vector echoIntList(const std::vector& v); std::vector echoUintList(const std::vector& v); std::vector echoDoubleList(const std::vector& v); std::vector echoBoolList(const std::vector& v); LogosList echoList(const LogosList& v); LogosMap echoMap(const LogosMap& v); // Arity: the contract's only multi-parameter surfaces std::string echoTriple(int64_t i, const std::string& s, const std::vector& b); // Return-only: void / result void doVoid(); StdLogosResult makeResult(bool ok); // Event trigger drivers (return bool) bool fireStringEvent(const std::string& v); bool fireBytesEvent(const std::vector& v); bool fireIntEvent(int64_t v); bool fireUintEvent(uint64_t v); bool fireDoubleEvent(double v); bool fireBoolEvent(bool v); bool fireAnyEvent(const nlohmann::json& v); bool fireStringListEvent(const std::vector& v); bool fireIntListEvent(const std::vector& v); bool fireUintListEvent(const std::vector& v); bool fireDoubleListEvent(const std::vector& v); bool fireBoolListEvent(const std::vector& v); bool fireListEvent(const LogosList& v); bool fireMapEvent(const LogosMap& v); bool fireTripleEvent(int64_t i, const std::string& s, const std::vector& b); logos_events: void stringEvent(const std::string& v); void bytesEvent(const std::vector& v); void intEvent(int64_t v); void uintEvent(uint64_t v); void doubleEvent(double v); void boolEvent(bool v); void anyEvent(const nlohmann::json& v); void stringListEvent(const std::vector& v); void intListEvent(const std::vector& v); void uintListEvent(const std::vector& v); void doubleListEvent(const std::vector& v); void boolListEvent(const std::vector& v); void listEvent(const LogosList& v); void mapEvent(const LogosMap& v); void tripleEvent(int64_t i, const std::string& s, const std::vector& b); };