C++ API Reference RNBO: RNBO::PlatformInterface Class Reference

RNBO: RNBO::PlatformInterface Class Reference

Inheritance diagram for RNBO::PlatformInterface:
platform_interface RNBO::PlatformInterfaceStdLib

Public Member Functions

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

virtual void* RNBO::PlatformInterface::calloc ( size_t  num,
size_t  size 
)
pure virtual

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

Implemented in RNBO::PlatformInterfaceStdLib.

◆ free()

virtual void RNBO::PlatformInterface::free ( void *  ptr)
pure virtual

Deallocates memory.

Parameters
ptra pointer to memory to deallocate

Implemented in RNBO::PlatformInterfaceStdLib.

◆ malloc()

virtual void* RNBO::PlatformInterface::malloc ( size_t  bytes)
pure virtual

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

Implemented in RNBO::PlatformInterfaceStdLib.

◆ memcpy()

virtual void* RNBO::PlatformInterface::memcpy ( void *  dest,
const void *  src,
size_t  n 
)
pure virtual

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

Implemented in RNBO::PlatformInterfaceStdLib.

◆ memmove()

virtual void* RNBO::PlatformInterface::memmove ( void *  dest,
const void *  src,
size_t  n 
)
pure virtual

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

Implemented in RNBO::PlatformInterfaceStdLib.

◆ memset()

virtual void* RNBO::PlatformInterface::memset ( void *  dest,
int  value,
size_t  n 
)
pure virtual

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

Implemented in RNBO::PlatformInterfaceStdLib.

◆ printErrorMessage()

virtual void RNBO::PlatformInterface::printErrorMessage ( const char *  message)
inlinevirtual

Prints an error message.

Defaults to printMessage.

◆ realloc()

virtual void* RNBO::PlatformInterface::realloc ( void *  ptr,
size_t  bytes 
)
pure virtual

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)

Implemented in RNBO::PlatformInterfaceStdLib.

◆ strcmp()

virtual int RNBO::PlatformInterface::strcmp ( const char *  s1,
const char *  s2 
)
pure virtual

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

Implemented in RNBO::PlatformInterfaceStdLib.

◆ strcpy()

virtual char* RNBO::PlatformInterface::strcpy ( char *  dest,
const char *  src 
)
pure virtual

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

Implemented in RNBO::PlatformInterfaceStdLib.

◆ strlen()

virtual size_t RNBO::PlatformInterface::strlen ( const char *  s)
pure virtual

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

Implemented in RNBO::PlatformInterfaceStdLib.


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