|
1 | | -## The Utilities library for HexaEngine. |
2 | | -### Featuring: |
3 | | -- std like strings (StdWString UTF-16, StdString UTF-8) |
4 | | -- std like containers (Array, List, Map, Set, Queue, Stack) |
5 | | -- Custom Allocation callbacks |
6 | | -- Pointer wrapper types to use with generics |
7 | | -- Thread safe object and list pools |
8 | | -- Utility functions for allocating freeing copying and moving memory |
9 | | -- Utility functions for working with strings |
10 | | -- Utility functions for sorting (QSort) |
11 | | -- Utility functions for setting memory (Memset) |
| 1 | +# HexaEngine Utilities Library |
| 2 | + |
| 3 | +The Utilities library for HexaEngine provides a set of essential tools and utilities that enhance the functionality and performance of your applications. It includes robust data structures, memory management utilities, thread-safe components, and more. |
| 4 | +The library is tailored to HexaEngine, but can be still used in other projects, that require low GC Pressure. |
| 5 | + |
| 6 | +## Features |
| 7 | + |
| 8 | +### Data Structures |
| 9 | +- **Standard-like Strings**: |
| 10 | + - `StdWString` (UTF-16) |
| 11 | + - `StdString` (UTF-8) |
| 12 | +- **Standard-like Containers**: |
| 13 | + - `Array` (comming soon) |
| 14 | + - `List` (UnsafeList) |
| 15 | + - `Map` (UnsafeDictionary) |
| 16 | + - `Set` (comming soon) |
| 17 | + - `Queue` (UnsafeQueue) |
| 18 | + - `Stack` (UnsafeStack) |
| 19 | + |
| 20 | +### Memory Management |
| 21 | +- **Custom Allocation Callbacks**: Define your own memory allocation strategies. |
| 22 | +- **Pointer Wrapper Types**: Utilize with generics for safer and more efficient pointer operations. |
| 23 | +- **Utility Functions**: |
| 24 | + - Memory allocation, freeing, copying, and moving |
| 25 | + - String operations |
| 26 | + - Memory setting (e.g., `Memset`) |
| 27 | + - Sorting (e.g., `QSort`) |
| 28 | + |
| 29 | +### Thread Safety |
| 30 | +- **Thread-Safe Pools**: |
| 31 | + - Object pools |
| 32 | + - List pools |
| 33 | + |
| 34 | +## Getting Started |
| 35 | + |
| 36 | +To get started with the HexaEngine Utilities library, follow these steps: |
| 37 | + |
| 38 | +1. **Install the NuGet package**: |
| 39 | + ```bash |
| 40 | + dotnet add package Hexa.NET.Utilities |
| 41 | + ``` |
| 42 | + |
| 43 | +2. **Include the library in your project**: |
| 44 | + ```csharp |
| 45 | + using Hexa.NET.Utilities; |
| 46 | + ``` |
| 47 | + |
| 48 | +3. **Initialize and utilize data structures**: |
| 49 | + ```csharp |
| 50 | + var myString = new StdString("Hello, HexaEngine!"); |
| 51 | + var myList = new UnsafeList<int> { 1, 2 }; |
| 52 | + ``` |
| 53 | +
|
| 54 | +4. **Leverage memory management utilities**: |
| 55 | + ```csharp |
| 56 | + int* memory = Utils.AllocT<int>(1); |
| 57 | + Utils.Free(memory); |
| 58 | + ``` |
| 59 | + or |
| 60 | + ```csharp |
| 61 | + global using static Hexa.NET.Utilities.Utils; |
| 62 | + |
| 63 | + int* memory = AllocT<int>(1); |
| 64 | + Free(memory); |
| 65 | + ``` |
| 66 | +
|
| 67 | +6. **Use thread-safe components for concurrent operations**: |
| 68 | + ```csharp |
| 69 | + var pool = new ObjectPool<MyObject>(); |
| 70 | + var obj = pool.Rent(); |
| 71 | + pool.Return(obj); |
| 72 | + ``` |
| 73 | +
|
| 74 | +## Contributions |
| 75 | +
|
| 76 | +Contributions are welcome! If you have ideas for new features or improvements, feel free to submit a pull request or open an issue. |
| 77 | +
|
| 78 | +## License |
| 79 | +
|
| 80 | +This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for more details. |
0 commit comments