-
Notifications
You must be signed in to change notification settings - Fork 0
NativeStaticContainer
This abstract class Implements holding a pointer to either a Native C++ class or block of memory that can potentially be freed() either via C/c++'s free() or has a dedicated C level wrapper that destroys the class. A lot of classes in the sheath are subclassed from this, and itself implements IDispoable.
protected string ConstructReceivedNullPointerOnConstructor_message(string ArgumentPrefix, string AlternativeInstance, string ArgumentName);
This is a routine that takes a few strings and returns a canned message pointing the user to use the AlternativeInstance instance of a constructor.
NativeStaticContainer's Dispose calls C/C++'s free() by default if the class was created with FreeOnCleanup set to true. You're going to want to overwrite this behavior if your wrapper for the native class requires a different cleanup routine. For Example, look at how InsightProcess/ PsProcessInformation's dispose() is implemented in the source.
This is required for IDisposable. This calls the protected Dispose() chain.
Equals() has been overwritten to compare if each object has the Same Native IntPtr or not.
GetHashCode() been overwritten to return a hash of the Native IntPtr;
This instances the class to point to the native class as specified by your argument. FreeOnCleanup is set to true.
This instances the class to point to the native class as specified by your argument. If FreeOnCleanup is true, C/C++'s free() will be called on the native side. It is Recommended that one has some knowledge of how the native class is instanced otherwise you may get some memory leaks.
This provides functionally readonly access is disposedValue to test if a NativeStaticClass's dispose() routine has been called.
This provides a functional readonly access to the protected pointer. You will be making a mistake if you prematurely call the deconstructor for the underlying class / data structure in the native side.
This holds the value that IsDiposed returns.
This provides readonly access to the protected FreeOnCleanup container.
This holds the value that FreeOnCleanup returns.
This holds the Pointer to the native class or struct this C# class is containing.
Finalizer. Functionally calls the protected dispose Dispose(false)