Skip to content

Commit d991b3d

Browse files
committed
initial commit
0 parents  commit d991b3d

29 files changed

+1418
-0
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* -text

.gitignore

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
# Add any directories, files, or patterns you don't want to be tracked by version control #
2+
3+
## Ignore Twincat non-source files ##
4+
Confidential/
5+
6+
### User-specific files (from 4018 tmc should be ignored) ###
7+
*.~u
8+
*.tpy
9+
*.tmc
10+
*.tmcRefac
11+
*.suo
12+
*.user
13+
*.orig
14+
*.tclrs
15+
16+
### Build results ###
17+
.engineering_servers/
18+
*.compileinfo
19+
*.compiled-library
20+
*.bootinfo
21+
*.bootinfo_guids
22+
*.library
23+
*.project.~u
24+
*.tsproj.bak
25+
*.xti.bak
26+
LineIDs.dbg
27+
LineIDs.dbg.bak
28+
_Boot/
29+
_CompileInfo/
30+
_Libraries/
31+
_ModuleInstall/
32+
33+
## Ignore TwinCAT HMI temporary files, build results, and
34+
## files generated by popular TwinCAT HMI add-ons.
35+
liveview_*
36+
*.cache
37+
*.db-shm
38+
*.db-wal
39+
*.pid
40+
.hmiframework/
41+
.hmipkgs/*-*-*-*/
42+
tchmipublish.journal.json
43+
44+
# NuGet Packages
45+
*.nupkg
46+
# The packages folder can be ignored because of Package Restore
47+
**/packages/*
48+
# except build/, which is used as an MSBuild target.
49+
!**/packages/build/
50+
# Uncomment if necessary however generally it will be regenerated when needed
51+
#!**/packages/repositories.config
52+
# NuGet v3's project.json files produces more ignoreable files
53+
*.nuget.props
54+
*.nuget.targets
55+
56+
### Visual studio files ###
57+
*.obj
58+
*.exe
59+
*.pdb
60+
*.user
61+
*.aps
62+
*.pch
63+
*.vspscc
64+
*_i.c
65+
*_p.c
66+
*.ncb
67+
*.suo
68+
*.tlb
69+
*.tlh
70+
*.bak
71+
*.cache
72+
*.ilk
73+
*.log
74+
*.dll
75+
*.lib
76+
*.sbr
77+
*.crc
78+
*.cid
79+
*.autostart
80+
*.app
81+
*.compileinfo
82+
*.occ
83+
*.tizip
84+
*.plcproj.orig
85+
86+
### VS Code files ###
87+
*.vscode
88+
89+
### Windows files ###
90+
Thumbs.db
91+
*.htm

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2023 benhar-dev
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<p align="center">
2+
<img width="460" src="./docs/images/logo.svg">
3+
</p>
4+
5+
## The mobject-disposable Library
6+
7+
This is one of the many libraries of mobject. This library focuses on the handling of disposing dynamic objects.
8+
9+
## What is mobject?
10+
11+
Pronounced mob-ject.
12+
13+
A sprinkling of OOP is usually enough to simplify and unclutter procedural code. However, the more you apply OOP, the more you find the need to expand it's scope to accommodate functionality which is missing from the language. Hence, mobject was conceived. It's a framework, library and mindset of how problems such as this can be resolved using both pre-written code and examples.
14+
15+
mobject's goal is to be a lightweight solution to typical oop problems.
16+
17+
## Documentation
18+
19+
The documentation for this project can be found [here](https://benhar-dev.github.io/mobject-disposable/#/).
20+
21+
## Versions
22+
23+
- TcXaeShell 3.1.4024.35

docs/.nojekyll

Whitespace-only changes.

docs/README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<p align="center">
2+
<img width="460" src="./images/logo.svg">
3+
</p>
4+
5+
> A framework and guide for writing object oriented programs in structured text.
6+
7+
## The mobject-disposable Library
8+
9+
This is one of the many libraries of mobject. This library focuses on the handling of disposing dynamic objects.
10+
11+
## What is mobject?
12+
13+
Pronounced mob-ject.
14+
15+
A sprinkling of OOP is usually enough to simplify and unclutter procedural code. However, the more you apply OOP, the more you find the need to expand it's scope to accommodate functionality which is missing from the language. Hence, mobject was conceived. It's a framework, library and mindset of how problems such as this can be resolved using both pre-written code and examples.
16+
17+
mobject's goal is to be a lightweight solution to typical oop problems.
18+
19+
## Why use mobject-disposable?
20+
21+
The mobject-disposable library provides a consistent way to handle the lifecycle of objects in an industrial control system. It includes an abstract class Disposable and an interface I_Disposable that can be implemented by classes that need to handle the deletion of objects.
22+
23+
Using this library ensures that objects are properly disposed of, which helps to prevent memory leaks and resource allocation issues. The Disposable class provides a consistent implementation of the OnDispose() method, which can be used by derived classes to handle the release of any resources or objects they own. The I_Disposable interface provides a common interface for objects that have a responsibility to delete others. This makes it easy to manage the lifecycle of objects in a complex system.
24+
25+
Overall, the mobject-disposable library helps to improve the reliability and maintainability of industrial control systems by providing a consistent way to handle the deletion of objects.

docs/_sidebar.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
- Home
2+
3+
- [Welcome](/)
4+
5+
- mobject-disposable
6+
7+
- [Disposable](disposable.md)
8+
- [I_Disposable](i-disposable.md)
9+
10+
- Guides
11+
12+
- [Coding Guide](https://benhar-dev.github.io/coding-convention/#/)

docs/disposable.md

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
# Dispose Abstract Class
2+
3+
## Definition
4+
5+
| | |
6+
| ----------- | ------------------------------- |
7+
| Namespace | mobject-disposable |
8+
| Library | mobject-disposable |
9+
| Inheritance | None |
10+
| Implements | [I_Disposable](i-disposable.md) |
11+
12+
## Remarks
13+
14+
The Disposable Abstract Class is a utility class that allows objects to handle being destroyed in a consistent manor.
15+
16+
## Example
17+
18+
```declaration
19+
FUNCTION_BLOCK MyObject EXTENDS Disposable
20+
VAR
21+
END_VAR
22+
```
23+
24+
```body
25+
//... no code should go here.
26+
```
27+
28+
```declaration
29+
METHOD OnDispose : BOOL
30+
VAR_INPUT
31+
CalledExplicitly : BOOL; // true if disposal was triggered from Dispose()
32+
END_VAR
33+
```
34+
35+
```body
36+
37+
// Here you should dispose of any objects your object owns or manages.
38+
// ...
39+
40+
```
41+
42+
## Methods
43+
44+
### Dispose()
45+
46+
Will trigger the object for deletion.
47+
48+
#### Parameters
49+
50+
N/A
51+
52+
#### Return
53+
54+
N/A
55+
56+
#### Usage
57+
58+
```example
59+
myObject.Dispose()
60+
```
61+
62+
### Abstract OnDispose() : BOOL;
63+
64+
This method must be implemented by the concrete class.
65+
66+
OnDispose will be called explicitly by the Dispose() method, or from someone calling \_\_DELETE on the object, or by TwinCAT when it destroys the object.
67+
68+
#### Parameters
69+
70+
| Parameters | Datatype | Description |
71+
| ---------------- | -------- | ---------------------------------------------------------------------- |
72+
| CalledExplicitly | BOOL | This boolean will return True if disposal was triggered from Dispose() |
73+
74+
#### Return
75+
76+
| Datatype | Description |
77+
| -------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
78+
| BOOL | Returning true will cancel the disposal. If you cancel it, then you must call Dispose or \_\_DELETE when you are ready for the final disposal. |
79+
80+
#### Usage
81+
82+
```declaration
83+
METHOD OnDispose : BOOL
84+
VAR_INPUT
85+
CalledExplicitly : BOOL; // true if disposal was triggered from Dispose()
86+
END_VAR
87+
```
88+
89+
```body
90+
// your code goes here...
91+
// you should dispose any dynamic objects your object is managing
92+
// in most cases you can simply return from this method.
93+
RETURN;
94+
95+
// however...
96+
// if the releasing of objects is not possible in a single cycle then you must return TRUE
97+
OnDispose := true;
98+
// This will suppress the final deletion and a second call of Dispose() will be required.
99+
// The second call of Dispose() will not re-trigger this method.
100+
```

docs/docsify/custom.css

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
2+
.markdown-section output:after, .markdown-section pre:after {
3+
content: '';
4+
}
5+
6+
pre {
7+
margin : 0px;
8+
}
9+
10+
.markdown-section pre {
11+
padding: 0;
12+
}
13+
14+
.markdown-section pre>code {
15+
padding: 2.2em 2.2em;
16+
}
17+
18+
.markdown-section code {
19+
background-color: #f8f8f8;
20+
padding : 1.3em;
21+
}
22+
23+
.markdown-section pre {
24+
margin: 0em 0;
25+
position: relative;
26+
background-color:white;
27+
}
28+
29+
.markdown-section blockquote {
30+
border-left: 4px solid #929292;
31+
background-color: #f4f4f4;
32+
}
33+
34+
.sidebar ul li.active>a {
35+
color: #29292b;;
36+
}
37+
38+
.github-corner svg {
39+
fill: #383d41;
40+
}

docs/docsify/language-st.css

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
.token.class-name {
2+
color:blue;
3+
}
4+
5+
.token.keyword {
6+
color:blue;
7+
}
8+
9+
.token.variable {
10+
color:blue;
11+
}
12+
13+
.token.comment {
14+
color:green;
15+
}
16+
17+
18+
[data-lang="declaration"] {
19+
margin-bottom: 0px !important;
20+
}
21+
22+
[data-lang="body"] {
23+
border-top: 1px solid lightgrey;
24+
margin-top: 0px !important;
25+
}
26+
27+
28+
[data-lang="body"] + [data-lang="declaration"] {
29+
border-top: 1px solid lightgrey;
30+
margin-top: 0px !important;
31+
}

0 commit comments

Comments
 (0)