-
Notifications
You must be signed in to change notification settings - Fork 1
API Reference
Steppable has an API in C++ and Python.
You may use the API by adding a new component.
To add a new feature, a
:
-
Add a directory called
src/a
in the Steppable directory, with at least three files:-
a.cpp
- The main file. Themain
function should be present, as it is the entry point of the executable. -
aReport.cpp
- The report file to show the results. -
aReport.hpp
- A header that contains optional definition.
-
Note
Only the above-mentioned three files will be added to CMake.
-
Make sure to document the code. Please use Doxygen to document this project.
-
Add an entry to
CMakeLists.txt
at the root of the repository.set(COMPONENTS add ... a # Replace with yours )
You may include the Steppable header files. They are:
-
argParse.hpp
- Argument parsing for executables. -
colors.hpp
- Printing with colors, or with custom formats. -
exceptions.hpp
- Exceptions to throw in case of error. -
fn/basicArithm.hpp
- Basic arithmetics. -
format.hpp
- String formatting. -
fraction.hpp
- Fractions in Steppable. -
logging.hpp
- Log file creation and management. -
number.hpp
- Numbers in Steppable. -
output.hpp
- Console logging utilities. -
platform.hpp
- Platform-specific functions. -
rounding.hpp
- Round off numbers. -
symbols.hpp
- Mathematical symbols. -
testing.hpp
- Unit testing utilities. -
util.hpp
- Useful utilities for string manipulation, numbers, etc.
The symbols are sometimes inside namespaces. They are:
-
namespace steppable::__internals::arithmetic
- Arithmetic functions. -
namespace steppable::__internals::format
- Text formatting. -
namespace steppable::__internals::logging
- Log file creation and management. -
namespace steppable::__internals::numUtils
- Number manipulation utilities. -
namespace steppable::__internals::stringUtils
- String manipulation utilities. -
namespace steppable::__internals::symbols
- Mathematical symbols. -
namespace steppable::__internals::utils
- Utility functions. -
namespace steppable::exceptions
- Exceptions. -
namespace steppable::output
- Console logging utilities. -
namespace steppable::testing
- Unit testing utilities. -
namespace steppable
- Root namespace. Public Methods are here.
In namespace steppable
, there are two classes, and one enum
.
-
class Number
- Steppable number. It can be added, subtracted, multiplied, divided, etc. For more information, see the documentation for this. -
class Fraction
- Steppable fraction. It also supports multiply arithmetic operators. For more information, see the documentation for this. -
enum RoundingMode
- Specifies how the result should be rounded.
In namespace steppable::__internals::arithmetic
, there is one class and several methods.
-
struct QuotientRemainder
- Astruct
representing the result and remainder from a division operation. For more information, see the documentation for this. - For the other methods, refer to the documentation.
The Python library is created using nanobind. You need to create the library on the same platform and using the same version of Python.
You may import the library as follows:
>>> import steppyble
There are three available classes.
-
class Number
- Steppable number. It can be added, subtracted, multiplied, divided, etc. Operators are overloaded, same as in C++. -
class Fraction
- Steppable fraction. It also supports multiply arithmetic operators. Operators are overloaded, same as in C++. -
enum RoundingMode
- Specifies how the result should be rounded.
Copyright (C) Andy Zhang, 2023-2024. Licensed under the MIT License.
- Getting the Source - Cloning the repository to your local machine
- Build the Project (CMake) - Compiling the source code of Steppable using CMake
- Build the Project (build.py) - Compiling the source code of Steppable using build.py
- Workflow - How to contribute to this repository
- Coding Style (Python) - Style guidelines for Python code in this project
- Coding Style (C++) - Style guidelines for CPP code in this project
- Directory Structure - The directory structure used by this project.
- Using the API - How to use the Steppable API
- Supported Platforms
- Performance - Some benchmarks of Steppable for reference
- Status - Status of Steppable, at a glance