Privilege
Description
- Derived from
Instances of this class are used to represent privileges that the Tinman 3D SDK needs for accessing native system resources.
Code-X compliant code is self-contained and thus cannot access any third-party APIs or native system resources. Such accesses may only be performed from within native code regions, see CxStatementCode. For each such native code region in the Tinman 3D SDK, there is a pre-defined Privilege object. Before initialization with TinmanModule.Initialize, privileges may be associated with a IPrivilegePredicate which then decides whether to grant the privilege. Once initialization has finished, privilege predicates cannot be changed anymore.
Per convention, the Privilege objects for a TinmanModule subclass are defined in separate static class within the same namespace, using the name suffix Privileges
instead of Module
, for example:
ExampleApplicationModule ExampleApplicationPrivileges
The documentation of the TinmanModule subclass should contain a reference to the privileges class.
Public / Methods
Restrict
Restricts this privilege by requiring that the given predicate in returns true
before granting it.
This method may only be called while the Tinman 3D SDK is still uninitialized, see TinmanModule.IsInitialized. By default, all privileges have no restrictions.
- See also
ThrowIfNotGranted
Throws an IOException if the given privilege is not granted.
This method delegates to IsGranted in order to determine whether the privilege is held and uses IOException.MissingPrivilege to construct the exception, if necessary.
- IOException
-
If not allowed because the privilege is not granted.