Skip to content

Commit ad92aac

Browse files
author
Vyacheslav
committed
2 parents 025867c + 9aa155a commit ad92aac

25 files changed

+253
-154
lines changed

Documentation/Stack/Capacity.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,8 @@
1+
# Capacity Property
12

3+
## Definition
4+
Gets the capacity of the collection
5+
6+
```C#
7+
public nuint Capacity { get; private set; }
8+
```

Documentation/Stack/Clear.md

Lines changed: 3 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,8 @@
1-
# FreeMemory(nuint) Method
1+
# Clear() Method
22

33
## Definition
4-
Free memory.
4+
Remove all items from a collection
55

66
```C#
7-
public void FreeMemory(nuint reducingBytes)
7+
public void Clear()
88
```
9-
10-
## Parameters
11-
reducingBytes nuint
12-
13-
Freed memory size in bytes
14-
15-
## Returns
16-
void
17-
18-
## Exceptions
19-
20-
```C#
21-
ObjectDisposedException
22-
```
23-
-or-
24-
25-
```C#
26-
Exception
27-
```
28-
If all memory is already free
29-
30-
## Remark
31-
Shifts the Current pointer by -reducingBytes
Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
1-
# StackMemory(nuint) Constructor
1+
# StackOf{ItemType}() Constructor
22

33
## Definition
4-
Creates an instance and allocates memory
4+
Creates an instance with a capacity of 4 and on its own memory.
55

66
```C#
7-
public StackMemory(nuint byteCount)
7+
public StackOf{ItemType}()
88
```
9-
## Parametrs
10-
byteCount nuint
11-
12-
Size of allocated memory in bytes
139

1410
## Remarks
15-
The default constructor of a struct will throw an Exception
11+
The collection works like a regular collection with auto resizing.
Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,21 @@
1-
# StackMemory(nuint) Constructor
1+
# StackOf{ItemType}(nuint, Struct.StackMemory*) Constructor
22

33
## Definition
4-
Creates an instance and allocates memory
4+
Creates an instance with Capacity equal `count` and allocate collection memory from StackMemory.
55

66
```C#
7-
public StackMemory(nuint byteCount)
7+
public StackOf{ItemType}(nuint count, Struct.StackMemory* stackMemory)
88
```
99
## Parametrs
10-
byteCount nuint
10+
`count nuint`
1111

12-
Size of allocated memory in bytes
12+
Capacity of Collection
1313

14-
## Remarks
15-
The default constructor of a struct will throw an Exception
14+
15+
`Struct.StackMemory* stackMemory`
16+
17+
The memory on which the collection runs
18+
19+
## Exceptions
20+
`ArgumentNullException`
21+
if stackMemory is null
Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,21 @@
1-
# StackMemory(nuint) Constructor
1+
# StackOf{ItemType}(nuint, Class.StackMemory) Constructor
22

33
## Definition
4-
Creates an instance and allocates memory
4+
Creates an instance with Capacity equal `count` and allocate collection memory from StackMemory.
55

66
```C#
7-
public StackMemory(nuint byteCount)
7+
public StackOf{ItemType}(nuint count, Class.StackMemory stackMemory)
88
```
99
## Parametrs
10-
byteCount nuint
10+
`count nuint`
1111

12-
Size of allocated memory in bytes
12+
Capacity of Collection
1313

14-
## Remarks
15-
The default constructor of a struct will throw an Exception
14+
15+
`Class.StackMemory stackMemory`
16+
17+
The memory on which the collection runs
18+
19+
## Exceptions
20+
`ArgumentNullException`
21+
if stackMemory is null
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,26 @@
1+
# StackOf{ItemType}(nuint, void*) Constructor
12

3+
## Definition
4+
Creates an instance with a capacity of `count`, with memory for the collection starting at memoryStart.
5+
6+
```C#
7+
public StackOf{ItemType}(nuint count, void* memoryStart)
8+
```
9+
## Parametrs
10+
`count nuint`
11+
12+
Capacity of Collection
13+
14+
15+
`void* memoryStart`
16+
17+
The memory on which the collection runs
18+
19+
## Exceptions
20+
`ArgumentNullException`
21+
if memoryStart is null
22+
23+
## Remarks
24+
25+
The correctness of the memory remains under the control of the developer. The collection has no way to check the correctness of the passed pointer.
26+
For collections on primitive types memoryStart is `{ItemType}*` pointer

Documentation/Stack/Copy.md

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,13 @@
1-
# FreeMemory(nuint) Method
1+
# Copy(in void*) Method
22

33
## Definition
4-
Free memory.
4+
Copies the elements of the collection into memory.
55

66
```C#
7-
public void FreeMemory(nuint reducingBytes)
7+
public void Copy(in void* ptrDest)
88
```
99

1010
## Parameters
11-
reducingBytes nuint
11+
`in void* ptrDest`
1212

13-
Freed memory size in bytes
14-
15-
## Returns
16-
void
17-
18-
## Exceptions
19-
20-
```C#
21-
ObjectDisposedException
22-
```
23-
-or-
24-
25-
```C#
26-
Exception
27-
```
28-
If all memory is already free
29-
30-
## Remark
31-
Shifts the Current pointer by -reducingBytes
13+
Pointer to the memory where the elements will be copied

Documentation/Stack/ExpandCapacity.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ public void ExpandCapacity(in nuint expandCount)
88
```
99

1010
## Parameters
11-
expandCount nuint
11+
`expandCount nuint`
1212

1313
Allocate memory size in count of items
1414

@@ -21,3 +21,4 @@ If The Stack collection is created using StackMemory and the StackMemory has mov
2121

2222
## Remark
2323
Increases Capacity by quantity 'expandCount'
24+
If the instance was created using a [constructor on a pointer](https://github.com/SoftStoneDevelop/StackMemoryCollections/blob/main/Documentation/Stack/Constructor4.md) then: Copies elements to new memory (`Capacity + expandCount`), freeing the current memory.

Documentation/Stack/IsEmpty.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,8 @@
1+
# IsEmpty Property
12

3+
## Definition
4+
Gets a sign of absence in the collection of elements
5+
6+
```C#
7+
public bool IsEmpty => Size == 0;
8+
```

Documentation/Stack/Pop.md

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,16 @@
1-
# FreeMemory(nuint) Method
1+
# Pop() Method
22

33
## Definition
4-
Free memory.
4+
Removes an element from the top of the stack
55

66
```C#
7-
public void FreeMemory(nuint reducingBytes)
7+
public void Pop()
88
```
99

10-
## Parameters
11-
reducingBytes nuint
12-
13-
Freed memory size in bytes
14-
15-
## Returns
16-
void
17-
1810
## Exceptions
1911

20-
```C#
21-
ObjectDisposedException
22-
```
23-
-or-
24-
2512
```C#
2613
Exception
2714
```
28-
If all memory is already free
2915

30-
## Remark
31-
Shifts the Current pointer by -reducingBytes
16+
If there are no elements on the stack

0 commit comments

Comments
 (0)