C++ API Reference RNBO: RNBO::PlatformInterfaceStdLib Class Reference

RNBO: RNBO::PlatformInterfaceStdLib Class Reference

Inheritance diagram for RNBO::PlatformInterfaceStdLib:
platform_interface_std_lib RNBO::PlatformInterface

Public Member Functions

void printMessage (const char *message) override
 Print a message to stdout or some kind of log.
 
void * malloc (size_t bytes) override
 Allocates uninitialized storage. More...
 
void * calloc (size_t num, size_t size) override
 Allocates memory for an array of objects and initializes all bytes to zero. More...
 
void * realloc (void *ptr, size_t bytes) override
 Reallocates previously-allocated memory. More...
 
void free (void *ptr) override
 Deallocates memory. More...
 
void * memcpy (void *dest, const void *src, size_t n) override
 Copy contents of memory from one location to another. More...
 
void * memmove (void *dest, const void *src, size_t n) override
 Copies memory from one memory location to another. More...
 
void * memset (void *dest, int value, size_t n) override
 Fill a region of memory with a value. More...
 
size_t strlen (const char *s) override
 Get the length of a null-terminated string. More...
 
int strcmp (const char *s1, const char *s2) override
 Compare two null-terminated strings lexicographically. More...
 
char * strcpy (char *dest, const char *src) override
 Copy a null-terminated string to a character array. More...
 
void toString (char *str, size_t maxlen, number val) override
 
void toString (char *str, size_t maxlen, int val) override
 
void toString (char *str, size_t maxlen, unsigned int val) override
 
void toString (char *str, size_t maxlen, long val) override
 
void toString (char *str, size_t maxlen, long long val) override
 
void toString (char *str, size_t maxlen, unsigned long val) override
 
void toString (char *str, size_t maxlen, unsigned long long val) override
 
void toString (char *str, size_t maxlen, void *val) override
 
void abort () override
 
void error (RuntimeError e, const char *msg) override
 Fatal error which should not return.
 
void assertTrue (bool v, const char *msg) override
 Fatal error if v is false.
 
- Public Member Functions inherited from RNBO::PlatformInterface
void resetWarnings ()
 
virtual void printErrorMessage (const char *message)
 Prints an error message. More...
 
template<typename T >
errorOrDefault (RuntimeError e, const char *str, T def)
 
template<typename T >
assertTrueOrDefault (bool v, const char *str, T def)
 

Member Function Documentation

◆ calloc()

void* RNBO::PlatformInterfaceStdLib::calloc ( size_t  num,
size_t  size 
)
inlineoverridevirtual

Allocates memory for an array of objects and initializes all bytes to zero.

Parameters
num
size
Returns
a pointer to the first byte in the allocated memory block if allocation succeeds

Implements RNBO::PlatformInterface.

◆ free()

void RNBO::PlatformInterfaceStdLib::free ( void *  ptr)
inlineoverridevirtual

Deallocates memory.

Parameters
ptra pointer to memory to deallocate

Implements RNBO::PlatformInterface.

◆ malloc()

void* RNBO::PlatformInterfaceStdLib::malloc ( size_t  bytes)
inlineoverridevirtual

Allocates uninitialized storage.

Parameters
bytesthe number of bytes of memory to allocate
Returns
a pointer to the first byte in the allocated memory block if allocation succeeds

Implements RNBO::PlatformInterface.

◆ memcpy()

void* RNBO::PlatformInterfaceStdLib::memcpy ( void *  dest,
const void *  src,
size_t  n 
)
inlineoverridevirtual

Copy contents of memory from one location to another.

Both memory objects are interpreted as arrays of unsigned char.

Parameters
desta pointer to the object to copy to
srca pointer to the object to copy from
nnumber of bytes to copy
Returns
dest

Implements RNBO::PlatformInterface.

◆ memmove()

void* RNBO::PlatformInterfaceStdLib::memmove ( void *  dest,
const void *  src,
size_t  n 
)
inlineoverridevirtual

Copies memory from one memory location to another.

Both memory objects are interpreted as arrays of unsigned char. As opposed to memcpy, memmove can have overlapping memory regions.

Parameters
desta pointer to the object to copy to
srca pointer to the object to copy from
nnumber of bytes to copy
Returns
copy of dest

Implements RNBO::PlatformInterface.

◆ memset()

void* RNBO::PlatformInterfaceStdLib::memset ( void *  dest,
int  value,
size_t  n 
)
inlineoverridevirtual

Fill a region of memory with a value.

Parameters
desta pointer to the object to fill
valuethe fill value
nnumber of bytes to fill
Returns
copy of dest

Implements RNBO::PlatformInterface.

◆ realloc()

void* RNBO::PlatformInterfaceStdLib::realloc ( void *  ptr,
size_t  bytes 
)
inlineoverridevirtual

Reallocates previously-allocated memory.

Parameters
ptra pointer to previously-allocated memory
bytesthe new allocation size
Returns
on success, a pointer to the beginning of the newly allocated memory (and the original pointer is invalidated); on failure, a null pointer is returned (and the original pointer remains valid)

Implements RNBO::PlatformInterface.

◆ strcmp()

int RNBO::PlatformInterfaceStdLib::strcmp ( const char *  s1,
const char *  s2 
)
inlineoverridevirtual

Compare two null-terminated strings lexicographically.

Parameters
s1a pointer to a null-terminated string
s2a pointer to a null-terminated string to compare with s1
Returns
negative value if s1 is before s2 in lexicographic order, zero if s1 and s2 are equal, and positive value if s1 is after s2 in lexicographic order

Implements RNBO::PlatformInterface.

◆ strcpy()

char* RNBO::PlatformInterfaceStdLib::strcpy ( char *  dest,
const char *  src 
)
inlineoverridevirtual

Copy a null-terminated string to a character array.

Parameters
desta pointer to the character array to write to
srca pointer to the null-terminated byte string to copy from
Returns
copy of dest

Implements RNBO::PlatformInterface.

◆ strlen()

size_t RNBO::PlatformInterfaceStdLib::strlen ( const char *  s)
inlineoverridevirtual

Get the length of a null-terminated string.

Parameters
sa pointer to the null-terminated string to examine
Returns
length of the null-terminated string

Implements RNBO::PlatformInterface.


The documentation for this class was generated from the following file: