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
sint01int8_t
sint02int16_t
sint04int32_t
sint08int64_t
NameReplaces
uint01uint8_t
uint02uint16_t
uint04uint32_t
uint08uint64_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.

NameReplaces
fltp04float
fltp08
Containers

NDEVR::Buffer

Replaces

std::vector

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

NDEVR::Vector

Replaces

std::array

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.

NDEVR::Dictionary

Replaces

std::unordered_map

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

Differences

NDEVR::Set

Replaces

std::unordered_set

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
String

NDEVR::String

Replaces

std::string & std::wstring

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

NDEVR::StringStream

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

NDEVR::Time

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.

NDEVR::Pointer

Replaces

std::shared_ptr

Provides shared ownership of a dynamically allocated object.

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

NDEVR::Thread

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

NDEVR::RWLock

Replaces

std::mutex

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

NDEVR::File

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

NDEVR::Scanner

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

NDEVR::RGBColor

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

NDEVR::UUID

Used to create global unique identifiers.

NDEVR::Angle

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

NDEVR::Log

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.

NDEVR::Unit

Used to define and convert units of various types

NDEVR::TranslatedString

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

NDEVR::Compressor

Logic for compressing or uncompressing data

NDEVR::Equation

Logic for storing and solving equations

NDEVR::Bounds

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