Using NDEVR API

The easy-to-use C++ API created by NDEVR is designed to streamline development and empower developers with a straightforward and powerful toolset. We have made the toolset easy-to-use and integrate.

Including Classes

Prerequisite: Setup API Environment

Any class can be included using the following pattern:

Class Include Pattern
				
					#include <NDEVR/[class_name].h>
				
			

 

In Addition you can include all classes of a specific library using:

Library Include Pattern
				
					#include <NDEVR/+[library_name].h>
				
			

 

Finally, for quick prototyping all NDEVR classes can be included via:

Include All NDEVR Classes
				
					#include <NDEVR/+.h>
				
			

 

All classes use the namespace NDEVR. As such, you can either safely do “using namespace NDEVR;” or use the NDEVR::[class name] aproach.

Core Classes and Conversions

NDEVR uses it’s own powerful internal classes in order to optimize efficiency, and maintain compatibility across C++ versions. As such you will not see much direct use of the standard library classes.

Basic Types

One key reason for using typedef on the native values was to improve programmer convenience by removing the ‘_’ from fixed type names, reducing the strain on weaker fingers during typing. Another reason was to enhance code readability. By standardizing these primitive type names to six characters, the code’s logic can be more clearly and consistently formatted.

Integer Types

For each of these integer types the 0xFFFF version of the value is considered invalid. As such, you should use GetMax<class>() to get the true maximum value, or GetMin<class>() for the negative number.

NameReplaces
sint01
int8_t
sint02
int16_t
sint04
int32_t
sint08
int64_t
NameReplaces
uint01
uint8_t
uint02
uint16_t
uint04
uint32_t
uint08
uint64_t

Floating Point Types

These types exist to make formatting blocks cleaner as well as making it easier to manually count the size of an object.

Name Replaces
fltp04
float
fltp08
double
Containers

A dynamic array that can grow or shrink in size. Ideal for sequential data.

Differences

– Buffer allocates memory more efficiently based on type class or the primitive nature of the object being allocated. For example A Buffer of 8 bools stores takes up only 1 byte of heap. 

– Memory is dynamically allocated more logically, such that repeated adds are significantly faster.

– More built-in class functions to assist with logical searching, adding or sorting

A fixed-size array with better performance compared to dynamic containers.

Differences

-Vector reserves memory more efficiently based on type class or the primitive nature of the object being allocated. For example An NDEVR::Vector of 8 bools stores takes up only 1 byte of stack.

-For numerical type vectors, there are more logical functions. Most operators work as expected, and this class serves as the backbone for vector math.

A hash-based key-value store, useful for quick associative lookups.

Differences

– Uses tsl robin library as backing logic and hashmap. Proven to be significantly faster in almost all metrics over std::unordered_map on modern architecture

– Easy functions for converting to other NDEVR containers

Container that stores unique elements in no particular order, and which allow for fast retrieval or insertion of individual elements based on their value.

Differences

– Uses tsl robin library as backing logic and hashmap. Proven to be significantly faster in almost all metrics over std::unordered_set on modern architecture

– Easy functions for converting to other NDEVR containers

String

A dynamically resizable string class for handling text.

Differences

– Explicitly uses Unicode (UTF8) 

– Easy functions for converting to anything (getAs<class>())

– Inherits faster Buffer class

Replaces
std::stringstream

Converts other classes objects into String objects

Differences

– Easy to overload to make any class castable into a string

– Uses faster NumberWriter to write numbers in a very fast way using hash lookups

– Used by String directly using the String constructor or getAs function

– Supports regax handling

Utilities
Replaces
std::chrono

Handles points in time, and clocks. Combined with NDEVR::TimeSpan provides complete chrono functionality

Differences

– Logic all in one place. 

– Includes time-zone logic to get months, days, years, hours, etc 

– String functions from string functions with logic following standard paterns.

Replaces
std::shared_ptr

Provides shared ownership of a dynamically allocated object.

Differences

– Weaker overall logic (Cannot detect circular references) but faster.

Concurrency
Replaces
std::thread

Represents a thread of execution.

Differences

– Allows for easy thread naming

– Using BasicThread, easy to execute with function ptr

– Cross platform including using virtual threads on systems that don’t support threading

Maintains a pair of associated locks, one for read-only operations and one for writing. The read lock may be held simultaneously by multiple reader threads, so long as there are no writers. The write lock is exclusive.

Differences

– Detects potential deadlock scenarios

– Allows read/write pattern of multiple readers or one writer

– Automatically shares resources to prevent starvation

– Can lock specific objects using WLock(object) or RLock(object)

– Destructor automatically unlocks object

Input/Output
Replaces
std::filesystem

Same functionality with cross platform support, exceptions, and reading and easy writing

Differences

– Quick cross platform support (Path seperator conversion, etc)

– Easy access to parts of file

– convenience functions for searching or relative paths

– Support for environmental variables

Replaces
std::iostream

Easily scan through ascii text from steams of text or files

Differences

– Supports native NDEVR classes

– Can choose to be cached or un-cached

– Custom seperators

Other Core Classes

One of the core color classes, is often used for colorization within the API

Used to create global unique identifiers. 

Used to store angles in a form where integer or floats can be used to maximize the accuracy of the angle itself.

Serves as an interface for processes to report issues and allows any number of LogStreams to subscribe and receive the log information in real-time.

Used to define and convert units of various types

Any text displayed to the user should be defined as a TranslatedString which allows the program to look up a translation, if available.

Logic for compressing or uncompressing data

Logic for storing and solving equations

Used for specifying and working with N-dimensional upper and lower bounds