C# Class Wombat.MamaWrapper

Base class for all wrapped native objects. Provides common facilities to the base classes.
Inheritance: IDisposable
Afficher le fichier Open project: OpenMAMA/OpenMAMA Class Usage Examples

Protected Properties

Свойство Type Description
nativeHandle System.IntPtr

Méthodes publiques

Méthode Description
Dispose ( ) : void

Destroys the underlying peer object and unbinds the wrapper from it.

setNativeHandle ( IntPtr nHandle ) : void

Sets the native handle of the native peer object. Should only be used by subclasses and in the same assembly.

Méthodes protégées

Méthode Description
CheckResultCode ( int code ) : void

Helper method for the sub classes

CheckResultCodeIgnoreNotFound ( int code ) : MamaStatus.mamaStatus

Helper method for the sub classes which will not throw exception for not found

DestroyNativePeer ( ) : MamaStatus.mamaStatus

Subclasses must do whatever is necessary with the native handle in the overridden method in order to destroy the native peer object. If the destruction went successfully, the overridden method must return MamaStatus.mamaStatus.MAMA_STATUS_OK, or a suitable error code otherwise

Dispose ( bool disposing, bool destroyNativeHandle = true ) : void

The actual implementation of Dispose - called by both the Dispose method and the finalizer.

EnsurePeerCreated ( ) : void

Throws an exception if the native object has not been created.

MamaWrapper ( ) : System

Constructs a new wrapper object but doesn't create it. If the object is not explicitly disposed it will remain registered for finalization and will attempt the destroy the native peer object when finalized.

MamaWrapper ( IntPtr nativeHandle ) : System

Constructs a managed wrapper from an existing native peer. The peer object will not be automatically finalized

OnDispose ( ) : void

SelfManageLifeTime ( bool value ) : void

In some situations, wrappers are created elsewhere, but need to automatically destroy themselves, otherwise would be leaked; as a general rule, all .NET wrapper objects that were created from a native handle are not supposed to manage its own life time and will not be destroyed - this is an exception that needs to be handled (example - MamaMsg uses this method)

Method Details

CheckResultCode() protected static méthode

Helper method for the sub classes
protected static CheckResultCode ( int code ) : void
code int the MamaStatus.mamaStatus returned from the native call (as integer)
Résultat void

CheckResultCodeIgnoreNotFound() protected static méthode

Helper method for the sub classes which will not throw exception for not found
protected static CheckResultCodeIgnoreNotFound ( int code ) : MamaStatus.mamaStatus
code int the MamaStatus.mamaStatus returned from the native call (as integer)
Résultat MamaStatus.mamaStatus

DestroyNativePeer() protected abstract méthode

Subclasses must do whatever is necessary with the native handle in the overridden method in order to destroy the native peer object. If the destruction went successfully, the overridden method must return MamaStatus.mamaStatus.MAMA_STATUS_OK, or a suitable error code otherwise
protected abstract DestroyNativePeer ( ) : MamaStatus.mamaStatus
Résultat MamaStatus.mamaStatus

Dispose() public méthode

Destroys the underlying peer object and unbinds the wrapper from it.
public Dispose ( ) : void
Résultat void

Dispose() protected méthode

The actual implementation of Dispose - called by both the Dispose method and the finalizer.
protected Dispose ( bool disposing, bool destroyNativeHandle = true ) : void
disposing bool true if the object is being disposed (false if being finalized)
destroyNativeHandle bool
Résultat void

EnsurePeerCreated() protected méthode

Throws an exception if the native object has not been created.
/// Thrown if the native object has not been created. ///
protected EnsurePeerCreated ( ) : void
Résultat void

MamaWrapper() protected méthode

Constructs a new wrapper object but doesn't create it. If the object is not explicitly disposed it will remain registered for finalization and will attempt the destroy the native peer object when finalized.
protected MamaWrapper ( ) : System
Résultat System

MamaWrapper() protected méthode

Constructs a managed wrapper from an existing native peer. The peer object will not be automatically finalized
protected MamaWrapper ( IntPtr nativeHandle ) : System
nativeHandle System.IntPtr The opaque native handle to the peer object
Résultat System

OnDispose() protected méthode

protected OnDispose ( ) : void
Résultat void

SelfManageLifeTime() protected méthode

In some situations, wrappers are created elsewhere, but need to automatically destroy themselves, otherwise would be leaked; as a general rule, all .NET wrapper objects that were created from a native handle are not supposed to manage its own life time and will not be destroyed - this is an exception that needs to be handled (example - MamaMsg uses this method)
protected SelfManageLifeTime ( bool value ) : void
value bool
Résultat void

setNativeHandle() public méthode

Sets the native handle of the native peer object. Should only be used by subclasses and in the same assembly.
public setNativeHandle ( IntPtr nHandle ) : void
nHandle System.IntPtr
Résultat void

Property Details

nativeHandle protected_oe property

the handle to the native peer object
protected IntPtr,System nativeHandle
Résultat System.IntPtr