#include <system.h>
Application wide system functions. Do not use any of those functions directly. Implement this interface to link against the kernel library.
Public Types | |
enum class | MEMORYDIAGNOSTICSMODE : Int { ESTIMATEONLY , QUIET , VERBOSE , LEAKGRAPH , PRIVATE_OFF , PRIVATE_ON } |
enum class | MEMORYOBSERVERMODE : Int { LOWMEM_CLEANUP , LOWMEM_FAILURE , WARNMEM_LIMIT } |
enum class | SPECIALBEHAVIOR : Int { NONE , OMIT_HELP , DONTWARN_MISSINGARGUMENTS } |
Static Public Member Functions | |
static MAXON_METHOD void | _ConsoleOutput (const Char *s, const SourceLocation &loc) |
static MAXON_METHOD void | _ConsoleOutput (const Char *s, const SourceLocation &loc, OUTPUT flags) |
static MAXON_METHOD OUTPUT | GetConsoleOutputType () |
static MAXON_METHOD void * | Alloc (Int size, const SourceLocation &location) |
static MAXON_METHOD void * | AllocClear (Int size, const SourceLocation &location) |
static MAXON_METHOD void * | Realloc (void *data, Int size, const SourceLocation &location) |
static MAXON_METHOD void | Free (const void *data) |
template<typename T > | |
static MAXON_FUNCTION void | FreeWithDestructor (T *object, void(*destructor)(T *)) |
static MAXON_METHOD Int | GetAllocSize (void *data) |
static MAXON_METHOD Int | MemoryDiagnostics (MEMORYDIAGNOSTICSMODE mode=MEMORYDIAGNOSTICSMODE::VERBOSE, Int *totalAllocation=nullptr, Int *freePhysicalMemoryEstimate=nullptr) |
static MAXON_METHOD Bool | MemoryAddObserver (MEMORYOBSERVERMODE mode, Delegate< void()> &&observer) |
static MAXON_METHOD void | SetMemoryAllocationThreshold (UInt warnMemoryAllocationThreshold) |
static MAXON_METHOD Float64 | GetCustomTimer () |
static MAXON_METHOD Int | GetConfigurationCount () |
static MAXON_METHOD Bool | GetConfiguration (Int index, ConfigInit &config) |
static MAXON_METHOD Bool | ConfigurationRegister (const ConfigInit &config) |
static MAXON_METHOD Char * | GetCriticalLog (Int index, Int *count) |
static MAXON_METHOD Int | GetDefinitionCount (EntityBase::TYPE type) |
static MAXON_METHOD const InterfaceReference * | GetVirtualInterfaceReference (const Id &idWithoutHash) |
static MAXON_METHOD EntityDefinition * | FindDefinition (EntityBase::TYPE type, const Id &eid) |
static MAXON_METHOD void * | SetDebugErrorObserver (Delegate< void(const ErrorInterface *)> &&observer) |
static MAXON_METHOD void | ResetDebugErrorObserver (void *observer) |
static MAXON_METHOD const Error * | SetCurrentError (const Error &error) |
static MAXON_METHOD const Error * | SetCurrentError (Error &&error) |
static MAXON_METHOD const Error * | GetLastError () |
static MAXON_METHOD void | SetDebugError (const Error *preallocated, const Error &error) |
static MAXON_METHOD const ErrorInterface * | GetDebugError (const Error *preallocated) |
static MAXON_METHOD Result< const Id * > | PrivateGetInternedId (const Id &value) |
static MAXON_METHOD void | PrivateFreeInternedId (const Id *ptr) |
static StrongReferenceCounter & | GetReferenceCounter (const void *object) |
static MAXON_METHOD const Block< const Binary *const > & | GetBinaries () |
static MAXON_METHOD void | PrivateShowSynchronizedHashMapDiagnostics (Int size, Int capacity, const Char *signature) |
static MAXON_METHOD const Char * | GetPreferencesPathSuffix () |
static MAXON_METHOD Id | GetApplicationId () |
static MAXON_METHOD void | SetApplicationType (const Char *dna) |
static MAXON_METHOD Bool | PrivateInitExternalDependency (InitMTable initSystemTable, Binary *externalDependency) |
static MAXON_METHOD Bool | PrivateResetExternalDependency (const Block< Tuple< Id, const char *, void * >> &safeShutdownMethods, Binary *externalDependency) |
Private Member Functions | |
MAXON_INTERFACE_NONVIRTUAL (System, MAXON_REFERENCE_STATIC, "net.maxon.interface.system") | |
Static Private Member Functions | |
static MAXON_METHOD void | FreeWithDestructorI (void *object, DestructorPointer destruct) |
|
strong |
|
strong |
|
strong |
|
private |
enum maxon::System::MEMORYDIAGNOSTICSMODE Int MAXON_ENUM_LIST_CLASS | ( | MEMORYDIAGNOSTICSMODE | ) |
enum maxon::System::MEMORYOBSERVERMODE Int MAXON_ENUM_LIST_CLASS | ( | MEMORYOBSERVERMODE | ) |
enum maxon::System::SPECIALBEHAVIOR Int MAXON_ENUM_FLAGS_CLASS | ( | SPECIALBEHAVIOR | ) |
|
static |
Prints debug information into the console window.
[in] | s | Char* to print out. |
[in] | loc | The source location. |
|
static |
Prints debug information into the console window.
[in] | s | Char* to print out. |
[in] | loc | The source location. |
[in] | flags | Output flags. |
|
static |
Retrieves which types of output shall be supported.
|
static |
Allocates a memory block, does not clear memory (similar to malloc). The memory is not cleared, it may contain a certain byte pattern in debug mode.
[in] | size | Block size in bytes (values < 0 will return nullptr). |
[in] | location | MemoryAllocationStructure (filled out by a define). |
|
static |
Allocates a memory block and clears it (similar to calloc).
[in] | size | Block size in bytes (values < 0 will return nullptr). |
[in] | location | MemoryAllocationStructure (filled out by a define). |
|
static |
Resizes a memory block (similar to realloc). The additional memory is not cleared, it may contain a certain byte pattern in debug mode.
[in] | data | Current memory block (can be nullptr). |
[in] | size | New block size in bytes (values < 0 will return nullptr). |
[in] | location | MemoryAllocationStructure (filled out by a define). |
|
static |
Frees a memory block (free).
[in] | data | Memory block address (can be nullptr). |
|
static |
|
static |
Returns the size of a memory block.
[in] | data | Memory block address (can be nullptr, but otherwise must be valid). |
|
static |
Returns information about memory usage and optionally prints details to the console.
[in] | mode | See MEMORYDIAGNOSTICSMODE. |
[out] | totalAllocation | Used to return the total amount of memory allocated including blocks being cached, used for management and so on. This might be considerably bigger than what was allocated by the application. |
[out] | freePhysicalMemoryEstimate | Used to return a very rough estimate of the free physical memory (if any). |
|
static |
Adds an observer for low memory situations. The observer will be active until shutdown.
[in] | mode | See MEMORYOBSERVERMODE. |
[in] | observer | Observer. |
|
static |
Sets the threshold value when observers of mode MEMORYOBSERVERMODE::WARNMEM_LIMIT will be executed. Calling the function again overwrites the older value.
[in] | warnMemoryAllocationThreshold | The value when the observer will be executed. |
|
static |
Returns the current system time which is being used by the Timer class.
|
static |
Returns the number of configuration values registered with ConfigurationRegister
|
static |
Gets the configuration value by a given index.
[in] | index | Index of the configuration value. 0 <= index < GetConfigurationCount() |
|
static |
Registers a configuration value ConfigValues with the main application.
[in] | config | The configuration value and related data (default, limits etc.). |
|
static |
Reads information from the critical log (which is automatically stored in memory). It contains messages that were generated calling CriticalOutput(). THREADSAFE.
[in] | index | Index to the log, starting at zero. If the return value is nullptr then no more log entries exist. |
[out] | count | Pointer to a value that will receive the number of log entries or nullptr. |
|
static |
Returns the total number of definitions for the given entity type. This is used for statistics about the complexity of the whole application.
[in] | type | Entity type. Use EntityBase::TYPE::COUNT for the total number of methods of all (virtual and non-virtual) interfaces. |
|
static |
Returns the virtual references of a given class.
[in] | idWithoutHash | Class ID without hash. |
|
static |
Returns the definition of the given entity type.
[in] | type | Entity type. Use EntityBase::TYPE::COUNT for the total number of methods of all (virtual and non-virtual) interfaces. |
[in] | eid | Entity id. |
|
static |
Sets a callback which shall be invoked when an error occurs. This should be used only for debugging purposes. For example, if you want to have a DebugStop on any error during a function call, you can write:
You could even make the DebugStop() depend on the type of the error by checking the type of the error parameter.
You should clear the error callback after the code to debug by calling ResetErrorCallback().
[in] | observer | Observer for errors. |
|
static |
Resets a previously set error callback.
[in] | observer | The observer to remove. |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
Returns the reference counter for classes which do not implement custom AddReference/RemoveReference methods.
|
static |
|
static |
|
static |
|
static |
Returns the kind of application. Common definitions can be found in APPLICATIONID.
|
static |
|
static |
|
static |
|
staticprivate |
[in] | object | Object/memory block address (guaranteed not to be nullptr). |
[in] | destruct | Object destructor (guaranteed not to be nullptr). |