{"id":19307485,"url":"https://github.com/fair-acc/opencmw-cpp","last_synced_at":"2026-01-27T12:17:37.328Z","repository":{"id":36963054,"uuid":"350359168","full_name":"fair-acc/opencmw-cpp","owner":"fair-acc","description":"Open Common Middle-Ware library for accelerator equipment- and beam-based control systems at FAIR.","archived":false,"fork":false,"pushed_at":"2026-01-23T18:09:43.000Z","size":3474,"stargazers_count":11,"open_issues_count":19,"forks_count":8,"subscribers_count":8,"default_branch":"main","last_synced_at":"2026-01-24T07:49:10.894Z","etag":null,"topics":["cpp20","cross-platform","library","microservice","middleware","opencmw","refl-cpp","rest-api","serialisation","serialization","zeromq"],"latest_commit_sha":null,"homepage":"https://opencmw.io","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fair-acc.png","metadata":{"files":{"readme":"README.developers.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2021-03-22T13:44:33.000Z","updated_at":"2026-01-23T18:09:46.000Z","dependencies_parsed_at":"2023-11-07T12:23:45.888Z","dependency_job_id":"c9e3bc1b-305f-4c20-99f5-d8d832cd38ba","html_url":"https://github.com/fair-acc/opencmw-cpp","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":"cpp-best-practices/gui_starter_template","purl":"pkg:github/fair-acc/opencmw-cpp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fair-acc%2Fopencmw-cpp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fair-acc%2Fopencmw-cpp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fair-acc%2Fopencmw-cpp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fair-acc%2Fopencmw-cpp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fair-acc","download_url":"https://codeload.github.com/fair-acc/opencmw-cpp/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fair-acc%2Fopencmw-cpp/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28813127,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-27T11:52:46.759Z","status":"ssl_error","status_checked_at":"2026-01-27T11:52:35.059Z","response_time":168,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cpp20","cross-platform","library","microservice","middleware","opencmw","refl-cpp","rest-api","serialisation","serialization","zeromq"],"created_at":"2024-11-10T00:11:12.844Z","updated_at":"2026-01-27T12:17:37.295Z","avatar_url":"https://github.com/fair-acc.png","language":"C++","readme":"# Code formatting\n\nUse `clang-format` for all your C++ formatting needs.\nIt is advisable to set up your editor to run `clang-format` on save,\nor to define a Git hook that checks the formatting on commit.\nOtherwise, the code will be rejected by the CI.\n\n# C++ standard version\n\nThis project uses C++20 restricted to the features supported\nby the latest stable versions of GCC and Clang.\n\nNon-0mq-related parts of the project should also be compilable\nto WebAssembly with Emscripten.\n\n# External dependencies\n\nThe 3rd-party libraries are to be avoided, except in the following\ncases:\n\n- they are unavoidable (such as 0mq);\n- they implement features that are planned for inclusion into\n  a future C++ version in some form or another (such as refl-cpp);\n- they are small enough to be incorporated into this project\n  and a fork be developed and maintained inside of this project.\n\n# Tests and examples\n\nAll code should be tested.\n\nApart from the tests, all library code needs to have\nusage examples. Examples are located in the `concepts` directory.\n\nIt is fine to use TDD or example driven development\nto drive the API design, but is not required as API\nif most likely to go through several review revisions\nbefore getting merged.\n\n# Comments\n\nUse comments when they would make the code more understandable.\nDon't write useless comments.\n\n# CamelCase versus snake_case\n\nThe C++ world is split into two camps with regards to the\npreferred naming scheme for classes, variables and functions.\n\nThis project predominantly uses CamelCase. Classes start\nwith an uppercase letter (`DomainFilter`, `MdpMessage`) while\n(member and non-member) variables and functions start\nwith a lowercase letter (`toString`, `tryLock`).\n\nExceptions to the CamelCase rule:\n\n- named constants use all-uppercase snake_case style (`SELECTOR_PREFIX`);\n- macros use all-uppercase snake_case style as well;\n- namespaces are in all-lowercase snake_case style (`opencmw`, `opencmw::json`, `io_serialiser_yaml_test`);\n\n- as the C++ Standard Library uses snake_case for everything,\n  the code in this project that is meant to look like it belongs\n  in the C++ Standard Library uses snake_case.\n\n  This includes custom type traits defined in the project (akin to\n  those in `\u003ctype_traits\u003e`), generic algorithms that don't but could\n  be a part of `\u003calgorithm\u003e`, etc.\n\n  Template parameter names should still be CamelCase.\n\n# Structures and classes\n\nIf no explicit encapsulation is needed,\nprefer using `struct` to defining a \"proper\" class.\n\nPrivate member variables should be prefixed with an underscore\nand start with a lowercase letter (`_dimensions`, `_serviceCount`).\nMember variables in structures and public member variables in classes\nshould not be prefixed with an underscore.\n\n## Class internals order\n\nClass and structure members should be defined in the following order\nif possible:\n\n1. Meta-information about the structure/class (`static_assert`s that\n   check compile-time properties of the type such as checking template\n   parameters are valid in class templates);\n2. Member variables;\n3. Public member functions;\n4. Protected member functions;\n5. Private member functions.\n\n# Header-only code\n\nPrefer writing header-only code (goes well hand-in-hand with the\nguidelines on using `constexpr`).\n\nWhile this slows down the compilation, it results in better code\ngeneration.\n\n# C++ features\n\n## const\n\nUse `const` whenever possible if doesn't hinder performance due to it disabling\nthe move semantics.\n\nThis includes:\n\n- local variables;\n- function arguments that are passed in as pointers or references;\n- member functions that don't modify the object\n  (also add `[[nodiscard]]` to the return type of those member functions);\n- use `const_iterators` and `std::as_const` instead of normal iterators.\n\nExceptions:\n\n- don't declare member variables as `const` as it disables the move\n  constructor and the move assignment operator;\n- don't declare normal variables as `const` if they could otherwise\n  be `std::move`d to the function result or when passing to another function.\n\n## constexpr\n\nUse `constexpr` whenever possible.\n\n## auto\n\nDon't overuse `auto`. It is fine:\n\n- when doing casts to avoid repeating the type name in the variable\n  definition and in the cast specification;\n- in generic code;\n- for lambda parameters;\n- when required (naming lambdas, structured bindings, etc.);\n- when spelling out the type doesn't help understanding the code.\n\n## Raw pointers\n\nRaw pointers are fine if:\n\n- they are required for interfacing with a C library\n  (prefer wrapping them into a RAII-enabled type);\n- they are non-owning;\n- they have a semantic of `optional\u003cT\u0026\u003e` -- that is, they are used to denote\n  a reference to an object that might not exist (if the pointer is used\n  to point to something that can not be null, prefer using references\n  and references to const)l\n- if they are used without pointer arithmetic.\n\nIf you're using raw pointers outside of these parameters,\nmark the code (comment) as unsafe. It is a good idea to encapsulate\ncode like this into a type that will hide the unsafety from its users.\n\n## References vs values\n\nPass integral and floating point types as values. Pass everything else as references to const.\nThis applies also for lightweight types such as `std::string_view`.\n\nExceptions to the rule:\n\n- sink arguments to constructors should be passed by value or in rare\n  cases by forwarding references;\n- code that immediately copes the reference-to-const argument\n  to a local variable can potentially avoid that copy if reference-to-const\n  was passed by value instead.\n\n## Exceptions\n\nExceptions are enabled in this project.\n\n## C++ Standard library algorithms\n\nThe C++ Standard Library exists for a reason.\n\nUse `\u003calgorithm\u003e` whenever possible instead of writing raw loops.\nUsing any kind of loop should be a signal that your code does\nsomething unorthodox and that the reader needs to pay more\nattention when looking at it.\n\n# static_assert and concepts\n\nUse `static_asserts` to verify all compile-time assumptions,\nconcepts and `requires` for restricting function or class definitions\nto specific types.\n\nPrefer concepts to `static_assert` if the compile-time restriction\nis expected to be checkable in other parts of the code (for example,\nchecking whether a function is callable with a specified argument type).\n\n## Other modern C++ features\n\n- Use enum classes instead of enums unless interfacing with a C library;\n- use `override` and `final` (if virtual member functions are not replaceable\n  with a compile-time dispatch alternative);\n- never use `NULL` or `0` for pointers, use `nullptr` instead;\n\n# C++ idioms\n\n## std::variant and overloaded lambdas\n\nWhen using `std::variant`, it is useful to define overloaded\nlambdas for easier visitation:\n\nhttps://www.cppstories.com/2019/02/2lines3featuresoverload.html/\n\n## copy/move-and-swap assignment operators\n\nIn order to write correct assignment operators, use\nthe copy/move-and-swap idiom:\n\nhttps://en.wikibooks.org/wiki/More_C%2B%2B_Idioms/Copy-and-swap\n\n# General coding practices\n\n- Minimize variable scope. Don't define variables until they are used;\n- avoid `using` and `using namespace`. When using `using` and `using namespace`,\n  minimize the scope it affects;\n- don't commit code that trigger compiler warnings;\n- don't shadow variables in a local scope, give them new names;\n- avoid `bool` function arguments in the API.\n\nConsult [C++ Core Guidelines](https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines) when in doubt.\n\n# Hints with using Emscripten\n\n## Chromium\n\ninstall https://goo.gle/wasm-debugging-extension\n\n```shell\necho --auto-open-devtools-for-tabs \u003e\u003e ~/config/chromium-flags.conf\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffair-acc%2Fopencmw-cpp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffair-acc%2Fopencmw-cpp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffair-acc%2Fopencmw-cpp/lists"}