omni::platforminfo::IOsInfo

Defined in omni/platforminfo/IOsInfo.h

class IOsInfo : public omni::core::Generated<omni::platforminfo::IOsInfo_abi>

Interface to collect and retrieve information about the operating system.

Public Functions

inline omni::platforminfo::Architecture getArchitecture() noexcept

Retrieves the processor architecture for this platform.

Thread Safety

This call is thread safe.

Returns

An architecture name. This will never be omni::platforminfo::Architecture::eUnknown.

inline omni::platforminfo::Os getOs() noexcept

Retrieves an identifier for the current platform.

Thread Safety

This call is thread safe.

Returns

An operating system name. This will never be omni::platforminfo::Os::eUnknown.

inline omni::platforminfo::OsVersion getOsVersion() noexcept

Retrieves the OS version information.

Thread Safety

This call is thread safe.

Returns

The operating system version numbers. These will be retrieved from the system as directly as possible. If possible, these will not be parsed from a string version of the operating system’s name.

inline omni::platforminfo::CompositorInfo getCompositorInfo() noexcept

Retrieves the name and version information for the system compositor.

Thread Safety

This call is thread safe.

Returns

An object describing the active compositor.

inline const char *getPrettyName() noexcept

Retrieves the friendly printable name of the operating system.

Thread Safety

This call is thread safe.

Returns

A string describing the operating system. This is retrieved from the system and does not necessarily follow any specific formatting. This may or may not contain specific version information. This string is intended for display to users.

inline const char *getName() noexcept

Retrieves the name of the operating system.

Thread Safety

This call is thread safe.

Returns

A string describing the operating system. This is retrieved from the system if possible and does not necessarily follow any specific formatting. This may include different information than the ‘pretty’ name (though still identifying the same operating system version). This string is more intended for logging or parsing purposes than display to the user.

inline const char *getDistroName() noexcept

Retrieves the operating system distribution name.

Thread Safety

This call is thread safe.

Returns

The operating system distribution name. For Windows 10 and up, this often contains the build’s version name (ie: v1909). For Linux, this contains the distro name (ie: “Ubuntu”, “Gentoo”, etc).

inline const char *getCodeName() noexcept

Retrieves the operating system’s build code name.

Thread Safety

This call is thread safe.

Returns

The code name of the operating system’s current version. For Windows 10 and up, this is the Microsoft internal code name for each release (ie: “RedStone 5”, “21H2”, etc). If possible it will be retrieved from the system. If not available, a best guess will be made based on the build version number. For Linux, this will be the build name of the current installed version (ie: “Bionic”, “Xenial”, etc).

inline const char *getKernelVersion() noexcept

Retrieves the operating system’s kernel version as a string.

Returns

A string containing the OS’s kernel version information. There is no standard layout for a kernel version across platforms so this isn’t split up into a struct of numeric values. For example, Linux kernel versions often contain major-minor-hotfix-build_number-string components whereas Mac OS is typically just major-minor-hotfix. Windows kernel versions are also often four values. This is strictly for informational purposes. Splitting this up into numerical components is left as an exercise for the caller if needed.

inline void *cast(omni::core::TypeId id) noexcept

Returns a pointer to the interface defined by the given type id if this object implements the type id’s interface.

Objects can support multiple interfaces, even interfaces that are in different inheritance chains.

The returned object will have omni::core::IObject::acquire() called on it before it is returned, meaning it is up to the caller to call omni::core::IObject::release() on the returned pointer.

The returned pointer can be safely reinterpret_cast<> to the type id’s C++ class. For example, “omni.windowing.IWindow” can be cast to omni::windowing::IWindow.

Do not directly use this method, rather use a wrapper function like omni::core::cast() or omni::core::ObjectPtr::as().

Thread Safety

This method is thread safe.

inline void acquire() noexcept

Increments the object’s reference count.

Objects may have multiple reference counts (e.g. one per interface implemented). As such, it is important that you call omni::core::IObject::release() on the same pointer from which you called omni::core::IObject::acquire().

Do not directly use this method, rather use omni::core::ObjectPtr, which will manage calling omni::core::IObject::acquire() and omni::core::IObject::release() for you.

Thread Safety

This method is thread safe.

inline void release() noexcept

Decrements the objects reference count.

Most implementations will destroy the object if the reference count reaches 0 (though this is not a requirement).

Objects may have multiple reference counts (e.g. one per interface implemented). As such, it is important that you call omni::core::IObject::release() on the same pointer from which you called omni::core::IObject::acquire().

Do not directly use this method, rather use omni::core::ObjectPtr, which will manage calling omni::core::IObject::acquire() and omni::core::IObject::release() for you.

Thread Safety

This method is thread safe.

Protected Functions

virtual Architecture getArchitecture_abi() noexcept = 0

Retrieves the processor architecture for this platform.

Thread Safety

This call is thread safe.

Returns

An architecture name. This will never be omni::platforminfo::Architecture::eUnknown.

virtual Os getOs_abi() noexcept = 0

Retrieves an identifier for the current platform.

Thread Safety

This call is thread safe.

Returns

An operating system name. This will never be omni::platforminfo::Os::eUnknown.

virtual OsVersion getOsVersion_abi() noexcept = 0

Retrieves the OS version information.

Thread Safety

This call is thread safe.

Returns

The operating system version numbers. These will be retrieved from the system as directly as possible. If possible, these will not be parsed from a string version of the operating system’s name.

virtual CompositorInfo getCompositorInfo_abi() noexcept = 0

Retrieves the name and version information for the system compositor.

Thread Safety

This call is thread safe.

Returns

An object describing the active compositor.

virtual const char *getPrettyName_abi() noexcept = 0

Retrieves the friendly printable name of the operating system.

Thread Safety

This call is thread safe.

Returns

A string describing the operating system. This is retrieved from the system and does not necessarily follow any specific formatting. This may or may not contain specific version information. This string is intended for display to users.

virtual const char *getName_abi() noexcept = 0

Retrieves the name of the operating system.

Thread Safety

This call is thread safe.

Returns

A string describing the operating system. This is retrieved from the system if possible and does not necessarily follow any specific formatting. This may include different information than the ‘pretty’ name (though still identifying the same operating system version). This string is more intended for logging or parsing purposes than display to the user.

virtual const char *getDistroName_abi() noexcept = 0

Retrieves the operating system distribution name.

Thread Safety

This call is thread safe.

Returns

The operating system distribution name. For Windows 10 and up, this often contains the build’s version name (ie: v1909). For Linux, this contains the distro name (ie: “Ubuntu”, “Gentoo”, etc).

virtual const char *getCodeName_abi() noexcept = 0

Retrieves the operating system’s build code name.

Thread Safety

This call is thread safe.

Returns

The code name of the operating system’s current version. For Windows 10 and up, this is the Microsoft internal code name for each release (ie: “RedStone 5”, “21H2”, etc). If possible it will be retrieved from the system. If not available, a best guess will be made based on the build version number. For Linux, this will be the build name of the current installed version (ie: “Bionic”, “Xenial”, etc).

virtual const char *getKernelVersion_abi() noexcept = 0

Retrieves the operating system’s kernel version as a string.

Returns

A string containing the OS’s kernel version information. There is no standard layout for a kernel version across platforms so this isn’t split up into a struct of numeric values. For example, Linux kernel versions often contain major-minor-hotfix-build_number-string components whereas Mac OS is typically just major-minor-hotfix. Windows kernel versions are also often four values. This is strictly for informational purposes. Splitting this up into numerical components is left as an exercise for the caller if needed.

virtual void *cast_abi(TypeId id) noexcept = 0

Returns a pointer to the interface defined by the given type id if this object implements the type id’s interface.

Objects can support multiple interfaces, even interfaces that are in different inheritance chains.

The returned object will have omni::core::IObject::acquire() called on it before it is returned, meaning it is up to the caller to call omni::core::IObject::release() on the returned pointer.

The returned pointer can be safely reinterpret_cast<> to the type id’s C++ class. For example, “omni.windowing.IWindow” can be cast to omni::windowing::IWindow.

Do not directly use this method, rather use a wrapper function like omni::core::cast() or omni::core::ObjectPtr::as().

Thread Safety

This method is thread safe.

virtual void acquire_abi() noexcept = 0

Increments the object’s reference count.

Objects may have multiple reference counts (e.g. one per interface implemented). As such, it is important that you call omni::core::IObject::release() on the same pointer from which you called omni::core::IObject::acquire().

Do not directly use this method, rather use omni::core::ObjectPtr, which will manage calling omni::core::IObject::acquire() and omni::core::IObject::release() for you.

Thread Safety

This method is thread safe.

virtual void release_abi() noexcept = 0

Decrements the objects reference count.

Most implementations will destroy the object if the reference count reaches 0 (though this is not a requirement).

Objects may have multiple reference counts (e.g. one per interface implemented). As such, it is important that you call omni::core::IObject::release() on the same pointer from which you called omni::core::IObject::acquire().

Do not directly use this method, rather use omni::core::ObjectPtr, which will manage calling omni::core::IObject::acquire() and omni::core::IObject::release() for you.

Thread Safety

This method is thread safe.