Skip to content

Commit

Permalink
Som 2023 11 01 (#22)
Browse files Browse the repository at this point in the history
* pipeline tests

* pipeline tests

* pipeline tests

* pipeline tests

* diagrams; system -> SYS

* diagrams; system -> SYS

* diagrams; system -> SYS

* diagrams; system -> SYS

* mainly code reduction

* mainly code reduction

* modules -> components

* some re-arrangements

* some re-arrangements

* some re-arrangements

* some re-arrangements

* some re-arrangements

* some re-arrangements
  • Loading branch information
sorgom authored Nov 3, 2023
1 parent f6da716 commit 3a65425
Show file tree
Hide file tree
Showing 76 changed files with 544 additions and 484 deletions.
14 changes: 7 additions & 7 deletions CLOC.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
## total lines of code: 4179
## total lines of code: 4189
**application**
```
-------------------------------------------------------------------------------
Language files blank comment code
-------------------------------------------------------------------------------
C/C++ Header 21 196 138 680
C++ 13 63 21 610
C/C++ Header 21 198 175 686
C++ 13 66 21 621
-------------------------------------------------------------------------------
SUM: 34 259 159 1290
SUM: 34 264 196 1307
-------------------------------------------------------------------------------
```
**testenv**
```
-------------------------------------------------------------------------------
Language files blank comment code
-------------------------------------------------------------------------------
C/C++ Header 24 249 240 943
C++ 12 85 23 505
C/C++ Header 24 246 240 943
C++ 12 84 23 498
-------------------------------------------------------------------------------
SUM: 36 334 263 1448
SUM: 36 330 263 1441
-------------------------------------------------------------------------------
```
**moduletests**
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ works, such as semiconductor masks.
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.

To "modify" a work means to copy from or adapt all or part of the work
To "modify" a work means to copy from or index all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# The DSTW Project
# the #DSTW project

## components
<img src="specification/diagrams/modules.svg" alt="modules" style="width:400px;">
<img src="specification/diagrams/components.svg" alt="modules" style="width:400px;">

## state of implementaion
## state of implementation
implementation according to [release 2023-11 _Maggie_](releases/release_2023-11.md)
<div style="background-color:#F8F8F8;">
<img src="specification/diagrams/overview.svg" alt="component overview">
</div>
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// ============================================================
// defintion of iterface I_Searchable to apply:
// defintion of interface I_Searchable to apply:
// - bubble sort
// - b-tree search
// - uniqueness check / duplicates count
Expand All @@ -8,15 +8,20 @@
#ifndef I_SEARCHABLE_H
#define I_SEARCHABLE_H

#include <baselib/BaseTypes.h>
#include <BAS/BaseTypes.h>
#include <BAS/coding.h>

template <class T>
class I_Searchable
{
public:
// current number of objects
virtual UINT32 size() const = 0;
// object access by position
virtual const T& at(UINT32 pos) const = 0;
// definition object a is greater than object b
virtual bool isGreater(const T& a, const T& b) const = 0;
// swap content of position a and b
virtual void swap(UINT32 posA, UINT32 posB) = 0;
};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// ============================================================
// instance declaration & definion macros
// instance declaration & definiton macros
// ============================================================
// created by Manfred Sorgo

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#ifndef MEM_H
#define MEM_H

#include <baselib/BaseTypes.h>
#include <BAS/BaseTypes.h>
#include <cstring>

class Mem
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
#define NTPARRAY_H

#include <ifs/DataTypes.h>
#include <baselib/StackArray.h>
#include <baselib/Mem.h>
#include <BAS/StackArray.h>
#include <BAS/Mem.h>

struct Ntp
{
Expand Down Expand Up @@ -42,9 +42,9 @@ class NtpIndex : public StackArrayIndex<Ntp, CAP>
StackArrayIndex<Ntp, CAP>(a)
{}

inline bool isGreater(const CRef<Ntp>& a, const CRef<Ntp>& b) const
inline bool isGreater(const Ntp& a, const Ntp& b) const
{
return Mem::cmp(a.ref().name, b.ref().name) > 0;
return Mem::cmp(a.name, b.name) > 0;
}

inline INT32 findNtp(const ElementName& name) const
Expand Down
72 changes: 72 additions & 0 deletions application/components/BAS/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
## directory content

**BaseTypes.h**
```
basic integral types and limits
```

**I_Searchable.h**
```
defintion of interface I_Searchable to apply:
- bubble sort
- b-tree search
- uniqueness check / duplicates count
```

**InstanceMacros.h**
```
instance declaration & definiton macros
```

**Mem.h**
```
type safe memset & memcpy
```

**NtpArray.h**
```
Storage of Name Type Position
```

**StackArray.h**
```
the core of static memory allocation
StackArrays
- act like arrays of pre-defined size
- can be filled with objects at runtime
- do not provide any overflow protection
SimpleStackArray
keeps objects in the same order as they were added.
StackArray
- can be sorted
- can search for elements
Derived classes have to provide
the isGreater method for objects of their type
See interface I_Searchable
class CRef
enables to store references as objects
StackArrayIndex
provides search for unsorted SimpleStackArray.
Derived classes have to provide
the isGreater method for objects of their type
See interface I_Searchable
```

**coding.h**
```
misc coding enhancers
```

**packBegin.h**
```
begin of packed alignment for data structs
```

**packEnd.h**
```
end of packed alignment for data structs
```
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
// ============================================================
// the core of static memory allocation
// StackArrays
// - act like arrays of pre-defined size
// - can be filled with objects at runtime
// - do not provide any overflow protection
// ============================================================
// created by Manfred Sorgo

#pragma once
#ifndef STACKARRAY_H
#define STACKARRAY_H

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

#include <BAS/I_Searchable.h>
#include <BAS/coding.h>
#include <BAS/Mem.h>

// base class for StackArray classes
template <class T, UINT32 CAP>
class BaseStackArray : public I_Searchable<T>
{
Expand Down Expand Up @@ -65,7 +74,7 @@ class BaseStackArray : public I_Searchable<T>
protected:
inline PTR getPtr(UINT32 pos)
{
return mBytes + sizeof(T) * pos;
return mData + pos;
}

private:
Expand All @@ -76,12 +85,42 @@ class BaseStackArray : public I_Searchable<T>
NOCOPY(BaseStackArray)
};

// ============================================================
// SimpleStackArray
// keeps objects in the same order as they were added.
// ============================================================
template <class T, UINT32 CAP>
class SimpleStackArray : public BaseStackArray<T, CAP>
{
public:
inline SimpleStackArray()
{}

inline bool isGreater(const T& a, const T& b) const
{
return false;
}

inline void swap(UINT32 posA, UINT32 posB) {}

NOCOPY(SimpleStackArray)
};

// provides static byte swapping for template based classes
class SwapBytes
{
protected:
static void swapBytes(PTR pA, PTR pB, PTR pS, UINT32 size);
};

// ============================================================
// StackArray
// - can be sorted
// - can search for elements
// Derived classes have to provide
// the isGreater method for objects of their type
// See interface I_Searchable
// ============================================================
template <class T, UINT32 CAP>
class StackArray :
public BaseStackArray<T, CAP>,
Expand All @@ -96,14 +135,14 @@ class StackArray :
bSort(*this);
}

inline UINT32 dupCnt() const
inline INT32 find(const T& obj) const
{
return dupCnt(*this);
return bSearch(*this, obj);
}

inline INT32 find(const T& obj) const
inline UINT32 dupCnt() const
{
return bSearch(*this, obj);
return dupCnt(*this);
}

inline void swap(UINT32 posA, UINT32 posB)
Expand All @@ -117,23 +156,10 @@ class StackArray :
NOCOPY(StackArray)
};

template <class T, UINT32 CAP>
class SimpleStackArray : public BaseStackArray<T, CAP>
{
public:
inline SimpleStackArray()
{}

inline bool isGreater(const T& a, const T& b) const
{
return false;
}

inline void swap(UINT32 posA, UINT32 posB) {}

NOCOPY(SimpleStackArray)
};

// ============================================================
// class CRef
// enables to store references as objects
// ============================================================
template <class T>
class CRef
{
Expand All @@ -152,6 +178,13 @@ class CRef
CRef();
};

// ============================================================
// StackArrayIndex
// provides search for unsorted SimpleStackArray.
// Derived classes have to provide
// the isGreater method for objects of their type
// See interface I_Searchable
// ============================================================
template <class T, UINT32 CAP>
class StackArrayIndex : public StackArray<CRef<T>, CAP>
{
Expand All @@ -160,7 +193,7 @@ class StackArrayIndex : public StackArray<CRef<T>, CAP>
mArray(a)
{}

void adapt()
void index()
{
this->reset();
for (UINT32 p = 0; p < mArray.size(); ++p)
Expand All @@ -169,6 +202,13 @@ class StackArrayIndex : public StackArray<CRef<T>, CAP>
}
this->sort();
}

virtual bool isGreater(const T& a, const T& b) const = 0;

inline bool isGreater(const CRef<T>& a, const CRef<T>& b) const
{
return isGreater(a.ref(), b.ref());
}

inline INT32 findRef(const T& obj) const
{
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <baselib/NtpArray.h>
#include <BAS/NtpArray.h>

const Ntp& genNtp(
const ElementName& name,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <baselib/StackArray.h>
#include <BAS/StackArray.h>

#include <cstring>

Expand Down
4 changes: 2 additions & 2 deletions application/components/SIG/SIG_Hub.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
#ifndef SIG_HUB_H
#define SIG_HUB_H

#include <baselib/coding.h>
#include <baselib/InstanceMacros.h>
#include <BAS/coding.h>
#include <BAS/InstanceMacros.h>
#include <ifs/I_SIG_Hub.h>

class SIG_Hub : public I_SIG_Hub
Expand Down
4 changes: 2 additions & 2 deletions application/components/SIG/SIG_Provider.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
#ifndef SIG_PROVIDER_H
#define SIG_PROVIDER_H

#include <baselib/InstanceMacros.h>
#include <baselib/StackArray.h>
#include <BAS/InstanceMacros.h>
#include <BAS/StackArray.h>
#include <ifs/I_SIG_Provider.h>
#include <setup/capacities.h>
#include <SIG/SIG_X.h>
Expand Down
Loading

0 comments on commit 3a65425

Please sign in to comment.