{"id":15047842,"url":"https://github.com/mericluc/modelgenerator","last_synced_at":"2026-01-02T00:11:19.352Z","repository":{"id":148350984,"uuid":"322583110","full_name":"MericLuc/ModelGenerator","owner":"MericLuc","description":"A small c++ static library that builds simple finite-state machines from xml files","archived":false,"fork":false,"pushed_at":"2020-12-18T13:34:20.000Z","size":576,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-20T17:17:24.247Z","etag":null,"topics":["cplusplus-11","finite-state-machine","xml-parsing"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MericLuc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"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}},"created_at":"2020-12-18T12:01:58.000Z","updated_at":"2024-01-18T10:19:02.000Z","dependencies_parsed_at":"2023-05-19T20:30:39.175Z","dependency_job_id":null,"html_url":"https://github.com/MericLuc/ModelGenerator","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MericLuc%2FModelGenerator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MericLuc%2FModelGenerator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MericLuc%2FModelGenerator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MericLuc%2FModelGenerator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MericLuc","download_url":"https://codeload.github.com/MericLuc/ModelGenerator/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243489778,"owners_count":20298997,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["cplusplus-11","finite-state-machine","xml-parsing"],"created_at":"2024-09-24T21:05:06.308Z","updated_at":"2026-01-02T00:11:19.307Z","avatar_url":"https://github.com/MericLuc.png","language":"C++","readme":"# ModelGenerator ![Language](https://img.shields.io/badge/language-C++11-orange.svg) [![License](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE.md)\n\nThis repository contains the sources of a small c++11 static library called **ModelGenerator** that allows you to _build finite-state machines from an xml input file_.\n\n# Organisation\n\nThis repository has the following organisation :\n - **_src_** The source code of the Library\n - **_tests_** The unit tests that come with it.\n - **_include_** Which provides a high-level interface to the library.\n - **_data_** A folder with samples of data you should input to the program (see **Logs** and **Configuration** sections).\n - **_install_ModelGenerator_** \\[**OUTPUT**\\] The folder that contains the inclusion header for the static library, the static library itself and the executables built when compiling with the provided _CMakeList_.\n\n Note that these tests are using [**Catch2**](https://github.com/catchorg/Catch2) library, which is a header-only c++ framework for unit testing.\n\n\n# How does it work ?\n\n## Logs\n\nIf you want to see the results of the run in a file, you can provide it with the **-l** argument.\n\nNote : The **-t** argument will control the verbosity of the log messages.\n\nWe will call that file a **Log file**. ( a default empty one is provided [**here**](./data/Logs/default-log) )\n\n\n## Configuration\n\nYou have to provide a specific **Configuration file** (_xml input file_) that **describes the finite-state automaton** you desire.\n\nYou can provide it with the mandatory **-c** argument.\n\nFor example, the sample Conf [**here**](./data/Conf/conf-test.xml) describes the following finite-state automaton :\n\n![Finite state automaton](./imgs/input-graph.png)\n\nBasically, this automaton will do the following :\nTIME (ms) | STATE | FLIP_FLOP (variable)\n--------- | ----- | ---------\n0 | STATE_A | 0 \n10 | STATE_B | 0\n10 | STATE_C | 1\n20 | STATE_B | 1\n20 | STATE_D | 2\n21 | STATE_D | 2\n22 | STATE_D | 2\n23 | STATE_D | 2\n24 | STATE_D | 2\n34 | STATE_B | 2\n34 | STATE_E | 1\n44 | STATE_B | 1\n44 | STATE_D | 1\n...\n\nThe **Configuration file** defines :\n - **Params** : Containing a list of parameters used by the model.\n \nThe states (and your code of course) can apply operations to those variables.\n - **States** : Containing a list of states caracterized by\n   - Their **ID** (name).\n   - The arithmetical **operations** made on _model variables_ when entering this state.\n   - The **transitions** toward other states.\n     - A transition always has a _dest-state_ (specified with its name)\n     - It can be a **condition** on a _model variable_\n     - It can also be a **delay** condition (the delay value is expressed in **us**) - meaning this will be triggered after x us in that state.\n     - A transition can also be a **loop** that transits to the same state a required amount of times.\n\n# Run the sample test\n\nAfter compiling the library - using the provided _CMakeLists_ - you can run the **ModelGeneratorSample.exe** in _install_ModelGenerator/bin_ with the following options :\n - **-c** \u003c Complete path to _install_ModelGenerator/data/Conf/conf_test.xml_ \u003e\n - **-l** \u003c Complete path to _install_ModelGenerator/data/Logs/default-logs_ \u003e\n - **-t 2**\n\nNote that the option **-h** will give you the list of possible options.\n\nAs a result, your _Log file_ will be filled by the program.\n\nThis is the content of _default-logs_ file after I killed the program :\n\n```\n14h:18m:20s:431ms:: Log file set to C:\\Users\\Luc-Henri\\Desktop\\Logs\\default-logs\n14h:18m:20s:431ms:: Configuration file set to C:\\Users\\Luc-Henri\\Desktop\\Conf\\conf_test.xml\n14h:18m:20s:431ms:: Added a new State (STATE_A) to the model.\n14h:18m:20s:431ms:: Added a new State (STATE_B) to the model.\n14h:18m:20s:431ms:: Added a new State (STATE_C) to the model.\n14h:18m:20s:431ms:: Added a new State (STATE_D) to the model.\n14h:18m:20s:431ms:: Added a new State (STATE_E) to the model.\n14h:18m:20s:431ms:: Model Integrity successfully checked.\n14h:18m:20s:431ms:: Configuration file parsed successfully.\n14h:18m:20s:431ms:: \n        ------ VARIABLES ------\n FLIP_FLOP 0\n        ------ MESSAGES ------\n\n        ------ HEADERS ------\n\n        ------ STATES ------\nState STATE_A\n    Operations:\n        FLIP_FLOP =   (Asignement) 0\n    Transitions:\n        DelayCond -\u003e STATE_B (delay 10000 us)\nState STATE_B\n    Transitions:\n        VarCond   -\u003e STATE_D (test FLIP_FLOP == (equal) 1)\n        VarCond   -\u003e STATE_E (test FLIP_FLOP == (equal) 2)\n        VarCond   -\u003e STATE_C (test FLIP_FLOP == (equal) 1)\nState STATE_C\n    Operations:\n        FLIP_FLOP =   (Asignement) 1\n    Transitions:\n        DelayCond -\u003e STATE_B (delay 10000 us)\nState STATE_D\n    Operations:\n        FLIP_FLOP =   (Asignement) 2\n    Transitions:\n        Loop      -\u003e STATE_D 5 times (delay 1000 us)\n        DelayCond -\u003e STATE_B (delay 10000 us)\nState STATE_E\n    Operations:\n        FLIP_FLOP =   (Asignement) 1\n    Transitions:\n        DelayCond -\u003e STATE_B (delay 10000 us)\n\n14h:18m:20s:431ms:: STATE_A\n14h:18m:20s:441ms:: STATE_B\n14h:18m:20s:441ms:: STATE_C\n14h:18m:20s:451ms:: STATE_B\n14h:18m:20s:451ms:: STATE_D\n14h:18m:20s:452ms:: STATE_D\n14h:18m:20s:453ms:: STATE_D\n14h:18m:20s:454ms:: STATE_D\n14h:18m:20s:455ms:: STATE_D\n14h:18m:20s:465ms:: STATE_B\n14h:18m:20s:465ms:: STATE_E\n14h:18m:20s:475ms:: STATE_B\n14h:18m:20s:475ms:: STATE_D\n14h:18m:20s:476ms:: STATE_D\n14h:18m:20s:477ms:: STATE_D\n14h:18m:20s:478ms:: STATE_D\n14h:18m:20s:479ms:: STATE_D\n14h:18m:20s:489ms:: STATE_B\n14h:18m:20s:489ms:: STATE_E\n14h:18m:20s:499ms:: STATE_B\n14h:18m:20s:499ms:: STATE_D\n14h:18m:20s:500ms:: STATE_D\n14h:18m:20s:500ms:: Prgramm ended by the user (signal - 2)\n```\n\nAs you can see, it clearly implements the required finite-state machine behaviour !\n\n# How to use it ?\n\nThis is pretty simple !\n\nAfter the built, you will have the following files into the **_install_ModelGenerator_** folder :\n    - lib/**libModelGenerator.a**\n    - include/**modelGenerator_interface.h**\n\nAll you need to do is to :\n    - include the header file using the _include_directories_ CMake command.\n    - link to the static lib using the _link_directories_ CMake command.\n\nAnd you are good to go ! :)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmericluc%2Fmodelgenerator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmericluc%2Fmodelgenerator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmericluc%2Fmodelgenerator/lists"}