Skip to content

Commit

Permalink
Som 2023 10 30 (#16)
Browse files Browse the repository at this point in the history
* re-structured directories

* ddi/ddi -> system/IL

* ddi/ddi -> system/IL

* more diagrams

* more diagrams

* Create c-cpp.yml

* workflow approach

* modifications to make

* trying ...

* trying ...

* trying ...

* trying ...

* trying ...

* trying ...

* trying ...

* trying ...

* trying ...

* trying ...

* trying ...

* trying ...

* trying ...

* trying ...

* trying ...

* trying ...

* trying ...

* failing test: does pipeline fail?

* should work now
  • Loading branch information
sorgom authored Nov 1, 2023
1 parent e407c9a commit 6fc258d
Show file tree
Hide file tree
Showing 99 changed files with 13,182 additions and 779 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/c-cpp.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: C/C++ CI

on:
push:
branches: [ "dev" ]
pull_request:
branches: [ "dev" ]

jobs:
buildAndRunTests:

runs-on: ubuntu-latest

steps:
- name: "Checkout repository"
uses: actions/checkout@v3
with:
submodules: 'true'
- name: "build tests"
run: cd make; make -f tests.make
- name: "run tests"
run: make/bin/tests

buildAndRunApp:

runs-on: ubuntu-latest

steps:
- name: "Checkout repository"
uses: actions/checkout@v3
- name: "build dstw app"
run: cd make; make -f dstw.make
- name: "run dstw app"
run: make/bin/dstw
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,5 @@ tmp_*
# vscode
tempCodeRunnerFile.py

# special directories
onhold/**/README.md
# special
**/TestStepper/README.md
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[submodule "testing/testenv/CppUTestStepper"]
path = testing/testenv/CppUTestStepper
url = [email protected]:sorgom/CppUTestStepper.git
[submodule "BuildCppUTest"]
path = BuildCppUTest
url = [email protected]:sorgom/BuildCppUTest.git
1 change: 1 addition & 0 deletions BuildCppUTest
Submodule BuildCppUTest added at bb2dfe
12 changes: 6 additions & 6 deletions CLOC.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
## total lines of code: 4274
## total lines of code: 4243
**application**
```
-------------------------------------------------------------------------------
Language files blank comment code
-------------------------------------------------------------------------------
C/C++ Header 22 205 136 728
C/C++ Header 22 207 136 732
C++ 13 63 21 611
-------------------------------------------------------------------------------
SUM: 35 268 157 1339
SUM: 35 270 157 1343
-------------------------------------------------------------------------------
```
**testenv**
```
-------------------------------------------------------------------------------
Language files blank comment code
-------------------------------------------------------------------------------
C/C++ Header 25 247 239 968
C++ 14 86 31 514
C/C++ Header 24 245 240 942
C++ 12 85 23 505
-------------------------------------------------------------------------------
SUM: 39 333 270 1482
SUM: 36 330 263 1447
-------------------------------------------------------------------------------
```
**moduletests**
Expand Down
19 changes: 18 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,25 @@

## state of implementaion
<div style="background-color:#F8F8F8;">
<img src="specification/diagrams/overview.svg" alt="Component Overview">
<img src="specification/diagrams/overview.svg" alt="component overview">
</div>

## central error logging
There is no error handling in the individual components.
All errors are reported to the central error log.
Further error handling / reactions / statistics will be implemented here.
<div style="background-color:#F8F8F8;">
<img src="specification/diagrams/log.svg" alt="central logging">
</div>


## test setup
Due to the Interface Locator (IL) any application component instance can be replaced by a mock instance.
Sample: test setup for Dispatcher component
<div style="background-color:#F8F8F8;">
<img src="specification/diagrams/test_dispatcher.svg" alt="test of Dispatcher">
</div>

## code coverage
for current current code coverage see [coverage.md](testing/coverage.md)

4 changes: 2 additions & 2 deletions application/main/AppMain.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <ddi/ddi.h>
#include <system/IL.h>

#define GET_DDI(NAME) ddi::get ## NAME();
#define GET_DDI(NAME) IL::get ## NAME();

int main(const INT32 argc, const CONST_C_STRING* const argv)
{
Expand Down
2 changes: 1 addition & 1 deletion application/modules/SIG/SIG_Hub.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class SIG_Hub : public I_SIG_Hub
void fromDsp(UINT32 pos, const FldState& tele) const;
void fromDsp(UINT32 pos, const GuiCmd& tele) const;

DDI_INSTANCE_DEC(SIG_Hub)
IL_INSTANCE_DEC(SIG_Hub)

NOCOPY(SIG_Hub)
};
Expand Down
2 changes: 1 addition & 1 deletion application/modules/SIG/SIG_Provider.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class SIG_Provider : public I_SIG_Provider

void load(const ProjSIG* data, UINT32 num);

DDI_INSTANCE_DEC(SIG_Provider)
IL_INSTANCE_DEC(SIG_Provider)

private:
SimpleStackArray<SIG_X, CAPACITY_SIG> mSIGs;
Expand Down
10 changes: 5 additions & 5 deletions application/modules/SIG/src/SIG_Hub.cpp
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#include <SIG/SIG_Hub.h>

#include <baselib/Mem.h>
#include <ddi/ddi.h>
#include <system/IL.h>

INSTANCE_DEF(SIG_Hub)

void SIG_Hub::fromDsp(const UINT32 pos, const FldState& tele) const
{
I_SIG_Provider& prov = ddi::getSIG_Provider();
I_SIG_Provider& prov = IL::getSIG_Provider();
if (prov.has(pos))
{
prov.at(pos).fromFld(tele.state1, tele.state2);
Expand All @@ -18,7 +18,7 @@ void SIG_Hub::fromDsp(const UINT32 pos, const FldState& tele) const

void SIG_Hub::fromDsp(const UINT32 pos, const GuiCmd& tele) const
{
I_SIG_Provider& prov = ddi::getSIG_Provider();
I_SIG_Provider& prov = IL::getSIG_Provider();
if (prov.has(pos))
{
prov.at(pos).fromGui(tele.cmd1, tele.cmd2);
Expand All @@ -33,7 +33,7 @@ void SIG_Hub::toFld(const UINT32 id, const INT32 state, const INT32 speed) const
Mem::zero(tele);
tele.cmd1 = state;
tele.cmd2 = speed;
ddi::getDispatcher().dispatch(id, tele);
IL::getDispatcher().dispatch(id, tele);
}

void SIG_Hub::toGui(const UINT32 id, const INT32 state, const INT32 speed) const
Expand All @@ -42,7 +42,7 @@ void SIG_Hub::toGui(const UINT32 id, const INT32 state, const INT32 speed) const
Mem::zero(tele);
tele.state1 = state;
tele.state2 = speed;
ddi::getDispatcher().dispatch(id, tele);
IL::getDispatcher().dispatch(id, tele);
}


6 changes: 3 additions & 3 deletions application/modules/SIG/src/SIG_Provider.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#include <SIG/SIG_Provider.h>
#include <ddi/ddi.h>
#include <system/IL.h>

INSTANCE_DEF(SIG_Provider)

void SIG_Provider::load(const ProjSIG* const data, const UINT32 num)
{
I_Dispatcher& disp = ddi::getDispatcher();
I_Dispatcher& disp = IL::getDispatcher();
mSIGs.reset();
bool ok = true;

Expand Down Expand Up @@ -48,6 +48,6 @@ void SIG_Provider::load(const ProjSIG* const data, const UINT32 num)
else
{
mSIGs.reset();
ddi::getLog().log(COMP_SIG_PROVIDER, ERR_STARTUP);
IL::getLog().log(COMP_SIG_PROVIDER, ERR_STARTUP);
}
}
10 changes: 5 additions & 5 deletions application/modules/SIG/src/SIG_X.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <SIG/SIG_X.h>
#include <ddi/ddi.h>
#include <system/IL.h>


void SIG_X::procFromFld(const INT32 state, INT32 speed)
Expand Down Expand Up @@ -27,7 +27,7 @@ void SIG_X::procFromFld(const INT32 state, INT32 speed)
{
mStateToGui = state;
mSpeedToGui = speed;
ddi::getSIG_Hub().toGui(mId, mStateToGui, mSpeedToGui);
IL::getSIG_Hub().toGui(mId, mStateToGui, mSpeedToGui);
}
else
{pass();}
Expand Down Expand Up @@ -58,14 +58,14 @@ void SIG_X::procFromGui(const INT32 state, const INT32 speed)
mStateToFld = state;
mSpeedToFld = speed;
mStateToGui = SIG_STATE_WAIT;
ddi::getSIG_Hub().toFld(mId, mStateToFld, mSpeedToFld);
ddi::getSIG_Hub().toGui(mId, mStateToGui, mSpeedToGui);
IL::getSIG_Hub().toFld(mId, mStateToFld, mSpeedToFld);
IL::getSIG_Hub().toGui(mId, mStateToGui, mSpeedToGui);
}
}

void SIG_X::logMissmatch()
{
ddi::getLog().log(COMP_SIG, ERR_MATCH);
IL::getLog().log(COMP_SIG, ERR_MATCH);
}

void SIG_H::fromFld(const INT32 state, const INT32 speed)
Expand Down
2 changes: 1 addition & 1 deletion application/modules/TSW/TSW_Hub.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class TSW_Hub : public I_TSW_Hub
void fromDsp(UINT32 pos, const FldState& tele) const;
void fromDsp(UINT32 pos, const GuiCmd& tele) const;

DDI_INSTANCE_DEC(TSW_Hub)
IL_INSTANCE_DEC(TSW_Hub)

NOCOPY(TSW_Hub)
};
Expand Down
2 changes: 1 addition & 1 deletion application/modules/TSW/TSW_Provider.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class TSW_Provider : public I_TSW_Provider

void load(const ProjTSW* data, UINT32 num);

DDI_INSTANCE_DEC(TSW_Provider)
IL_INSTANCE_DEC(TSW_Provider)

private:
SimpleStackArray<TSW, CAPACITY_TSW> mTSWs;
Expand Down
10 changes: 5 additions & 5 deletions application/modules/TSW/src/TSW.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <TSW/TSW.h>
#include <ddi/ddi.h>
#include <system/IL.h>

void TSW::fromGui(const INT32 cmd)
{
Expand All @@ -15,7 +15,7 @@ void TSW::fromGui(const INT32 cmd)
swRight();
break;
default:
ddi::getLog().log(COMP_TSW, ERR_MATCH);
IL::getLog().log(COMP_TSW, ERR_MATCH);
break;
};
}
Expand Down Expand Up @@ -76,7 +76,7 @@ void TSW::fromFld(const INT32 state)
chgState(state);
break;
default:
ddi::getLog().log(COMP_TSW, ERR_MATCH);
IL::getLog().log(COMP_TSW, ERR_MATCH);
break;
}
}
Expand All @@ -86,11 +86,11 @@ void TSW::chgState(INT32 state)
if (state != mState)
{
mState = state;
ddi::getTSW_Hub().toGui(mId, mState);
IL::getTSW_Hub().toGui(mId, mState);
}
}

void TSW::toFld(INT32 state) const
{
ddi::getTSW_Hub().toFld(mId, state);
IL::getTSW_Hub().toFld(mId, state);
}
10 changes: 5 additions & 5 deletions application/modules/TSW/src/TSW_Hub.cpp
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#include <TSW/TSW_Hub.h>

#include <baselib/Mem.h>
#include <ddi/ddi.h>
#include <system/IL.h>

INSTANCE_DEF(TSW_Hub)

void TSW_Hub::fromDsp(const UINT32 pos, const FldState& tele) const
{
I_TSW_Provider& prov = ddi::getTSW_Provider();
I_TSW_Provider& prov = IL::getTSW_Provider();
if (prov.has(pos))
{
prov.at(pos).fromFld(tele.state1);
Expand All @@ -18,7 +18,7 @@ void TSW_Hub::fromDsp(const UINT32 pos, const FldState& tele) const

void TSW_Hub::fromDsp(const UINT32 pos, const GuiCmd& tele) const
{
I_TSW_Provider& prov = ddi::getTSW_Provider();
I_TSW_Provider& prov = IL::getTSW_Provider();
if (prov.has(pos))
{
prov.at(pos).fromGui(tele.cmd1);
Expand All @@ -32,15 +32,15 @@ void TSW_Hub::toFld(const UINT32 id, const INT32 cmd) const
static CmdFld tele;
Mem::zero(tele);
tele.cmd1 = cmd;
ddi::getDispatcher().dispatch(id, tele);
IL::getDispatcher().dispatch(id, tele);
}

void TSW_Hub::toGui(const UINT32 id, const INT32 state) const
{
static StateGui tele;
Mem::zero(tele);
tele.state1 = state;
ddi::getDispatcher().dispatch(id, tele);
IL::getDispatcher().dispatch(id, tele);
}


6 changes: 3 additions & 3 deletions application/modules/TSW/src/TSW_Provider.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#include <TSW/TSW_Provider.h>
#include <ddi/ddi.h>
#include <system/IL.h>

INSTANCE_DEF(TSW_Provider)

void TSW_Provider::load(const ProjTSW* const data, const UINT32 num)
{
I_Dispatcher& disp = ddi::getDispatcher();
I_Dispatcher& disp = IL::getDispatcher();
mTSWs.reset();
bool ok = true;
if (num > mTSWs.capacity())
Expand All @@ -32,6 +32,6 @@ void TSW_Provider::load(const ProjTSW* const data, const UINT32 num)
else
{
mTSWs.reset();
ddi::getLog().log(COMP_TSW_PROVIDER, ERR_STARTUP);
IL::getLog().log(COMP_TSW_PROVIDER, ERR_STARTUP);
}
}
4 changes: 2 additions & 2 deletions application/modules/baselib/InstanceMacros.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
#define INSTANCE_DEC_CONST(cName) \
static const cName& instance();

// use this one to provide instance for ddi
#define DDI_INSTANCE_DEC(cName) INSTANCE_DEC(cName)
// use this one to provide instance for IL
#define IL_INSTANCE_DEC(cName) INSTANCE_DEC(cName)

// CLASS SOURCE FILE MACROS
#define INSTANCE_DEF(cName) \
Expand Down
2 changes: 1 addition & 1 deletion application/modules/baselib/StackArray.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#define STACKARRAY_H

#include <baselib/I_Searchable.h>
#include <baselib/Baselib.h>
#include <baselib/BaseLib.h>
#include <baselib/coding.h>
#include <baselib/Mem.h>

Expand Down
2 changes: 1 addition & 1 deletion application/modules/ddi/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## directory content

**ddi.h**
**IL.h**
```
service locator pattern
- production application version
Expand Down
2 changes: 1 addition & 1 deletion application/modules/system/Com.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class Com : public I_Com
inline void send(const CmdFld& tele) const {}
inline void send(const StateGui& tele) const {}

DDI_INSTANCE_DEC(Com)
IL_INSTANCE_DEC(Com)

NOCOPY(Com)
};
Expand Down
Loading

0 comments on commit 6fc258d

Please sign in to comment.