Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
FreeImageAPI.IO.fi_handle Struct Reference

Wrapper for a custom handle. More...

Inheritance diagram for FreeImageAPI.IO.fi_handle:
IEquatable< fi_handle > IComparable< fi_handle > IComparable IEquatable< fi_handle > IComparable< fi_handle > IComparable

Public Member Functions

 fi_handle (object obj)
 Initializes a new instance wrapping a managed object. More...
 
override string ToString ()
 Converts the numeric value of the fi_handle object to its equivalent string representation. More...
 
override int GetHashCode ()
 Returns a hash code for this fi_handle structure. More...
 
override bool Equals (object obj)
 Tests whether the specified object is a fi_handle structure and is equivalent to this fi_handle structure. More...
 
bool Equals (fi_handle other)
 Indicates whether the current object is equal to another object of the same type. More...
 
int CompareTo (object obj)
 Compares this instance with a specified Object. More...
 
int CompareTo (fi_handle other)
 Compares this instance with a specified fi_handle object. More...
 
void Dispose ()
 Releases all resources used by the instance. More...
 
 fi_handle (object obj)
 Initializes a new instance wrapping a managed object. More...
 
override string ToString ()
 Converts the numeric value of the fi_handle object to its equivalent string representation. More...
 
override int GetHashCode ()
 Returns a hash code for this fi_handle structure. More...
 
override bool Equals (object obj)
 Tests whether the specified object is a fi_handle structure and is equivalent to this fi_handle structure. More...
 
bool Equals (fi_handle other)
 Indicates whether the current object is equal to another object of the same type. More...
 
int CompareTo (object obj)
 Compares this instance with a specified Object. More...
 
int CompareTo (fi_handle other)
 Compares this instance with a specified fi_handle object. More...
 
void Dispose ()
 Releases all resources used by the instance. More...
 

Static Public Member Functions

static bool operator== (fi_handle left, fi_handle right)
 Tests whether two specified fi_handle structures are equivalent. More...
 
static bool operator!= (fi_handle left, fi_handle right)
 Tests whether two specified fi_handle structures are different. More...
 
static bool operator== (fi_handle left, fi_handle right)
 Tests whether two specified fi_handle structures are equivalent. More...
 
static bool operator!= (fi_handle left, fi_handle right)
 Tests whether two specified fi_handle structures are different. More...
 

Public Attributes

IntPtr handle
 The handle to wrap. More...
 

Properties

bool IsNull [get]
 Gets whether the pointer is a null pointer. More...
 

Detailed Description

Wrapper for a custom handle.

The fi_handle of FreeImage in C++ is a simple pointer, but in .NET it's not that simple. This wrapper uses fi_handle in two different ways.

We implement a new plugin and FreeImage gives us a handle (pointer) that we can simply pass through to the given functions in a 'FreeImageIO' structure. But when we want to use LoadFromhandle or SaveToHandle we need a fi_handle (that we receive again in our own functions). This handle is for example a stream (see LoadFromStream / SaveToStream) that we want to work with. To know which stream a read/write is meant for we could use a hash value that the wrapper itself handles or we can go the unmanaged way of using a handle. Therefor we use a GCHandle to receive a unique pointer that we can convert back into a .NET object. When the fi_handle instance is no longer needed the instance must be disposed by the creater manually! It is recommended to use the using statement to be sure the instance is always disposed:

using (fi_handle handle = new fi_handle(object))
{
callSomeFunctions(handle);
}

What does that mean? If we get a fi_handle from unmanaged code we get a pointer to unmanaged memory that we do not have to care about, and just pass ist back to FreeImage. If we have to create a handle our own we use the standard constructur that fills the IntPtr with an pointer that represents the given object. With calling GetObject the IntPtr is used to retrieve the original object we passed through the constructor.

This way we can implement a fi_handle that works with managed an unmanaged code.

Definition at line 83 of file fi_handle.cs.

Constructor & Destructor Documentation

FreeImageAPI.IO.fi_handle.fi_handle ( object  obj)

Initializes a new instance wrapping a managed object.

Parameters
objThe object to wrap.
Exceptions
ArgumentNullExceptionobj is null.

Definition at line 96 of file fi_handle.cs.

FreeImageAPI.IO.fi_handle.fi_handle ( object  obj)

Initializes a new instance wrapping a managed object.

Parameters
objThe object to wrap.
Exceptions
ArgumentNullExceptionobj is null.

Definition at line 96 of file fi_handle.cs.

Member Function Documentation

int FreeImageAPI.IO.fi_handle.CompareTo ( object  obj)

Compares this instance with a specified Object.

Parameters
objAn object to compare with this instance.
Returns
A 32-bit signed integer indicating the lexical relationship between the two comparands.
Exceptions
ArgumentExceptionobj is not a fi_handle.

Definition at line 211 of file fi_handle.cs.

int FreeImageAPI.IO.fi_handle.CompareTo ( object  obj)

Compares this instance with a specified Object.

Parameters
objAn object to compare with this instance.
Returns
A 32-bit signed integer indicating the lexical relationship between the two comparands.
Exceptions
ArgumentExceptionobj is not a fi_handle.

Definition at line 211 of file fi_handle.cs.

int FreeImageAPI.IO.fi_handle.CompareTo ( fi_handle  other)

Compares this instance with a specified fi_handle object.

Parameters
otherA fi_handle to compare.
Returns
A signed number indicating the relative values of this instance and other .

Definition at line 230 of file fi_handle.cs.

References FreeImageAPI.IO.fi_handle.handle.

int FreeImageAPI.IO.fi_handle.CompareTo ( fi_handle  other)

Compares this instance with a specified fi_handle object.

Parameters
otherA fi_handle to compare.
Returns
A signed number indicating the relative values of this instance and other .

Definition at line 230 of file fi_handle.cs.

void FreeImageAPI.IO.fi_handle.Dispose ( )

Releases all resources used by the instance.

Definition at line 238 of file fi_handle.cs.

void FreeImageAPI.IO.fi_handle.Dispose ( )

Releases all resources used by the instance.

Definition at line 238 of file fi_handle.cs.

override bool FreeImageAPI.IO.fi_handle.Equals ( object  obj)

Tests whether the specified object is a fi_handle structure and is equivalent to this fi_handle structure.

Parameters
objThe object to test.
Returns
true if obj is a fi_handle structure equivalent to this fi_handle structure; otherwise, false.

Definition at line 190 of file fi_handle.cs.

override bool FreeImageAPI.IO.fi_handle.Equals ( object  obj)

Tests whether the specified object is a fi_handle structure and is equivalent to this fi_handle structure.

Parameters
objThe object to test.
Returns
true if obj is a fi_handle structure equivalent to this fi_handle structure; otherwise, false.

Definition at line 190 of file fi_handle.cs.

bool FreeImageAPI.IO.fi_handle.Equals ( fi_handle  other)

Indicates whether the current object is equal to another object of the same type.

Parameters
otherAn object to compare with this object.
Returns
True if the current object is equal to the other parameter; otherwise, false.

Definition at line 200 of file fi_handle.cs.

bool FreeImageAPI.IO.fi_handle.Equals ( fi_handle  other)

Indicates whether the current object is equal to another object of the same type.

Parameters
otherAn object to compare with this object.
Returns
True if the current object is equal to the other parameter; otherwise, false.

Definition at line 200 of file fi_handle.cs.

override int FreeImageAPI.IO.fi_handle.GetHashCode ( )

Returns a hash code for this fi_handle structure.

Returns
An integer value that specifies the hash code for this fi_handle.

Definition at line 178 of file fi_handle.cs.

override int FreeImageAPI.IO.fi_handle.GetHashCode ( )

Returns a hash code for this fi_handle structure.

Returns
An integer value that specifies the hash code for this fi_handle.

Definition at line 178 of file fi_handle.cs.

static bool FreeImageAPI.IO.fi_handle.operator!= ( fi_handle  left,
fi_handle  right 
)
static

Tests whether two specified fi_handle structures are different.

Parameters
leftThe fi_handle that is to the left of the inequality operator.
rightThe fi_handle that is to the right of the inequality operator.
Returns
true if the two fi_handle structures are different; otherwise, false.

Definition at line 127 of file fi_handle.cs.

static bool FreeImageAPI.IO.fi_handle.operator!= ( fi_handle  left,
fi_handle  right 
)
static

Tests whether two specified fi_handle structures are different.

Parameters
leftThe fi_handle that is to the left of the inequality operator.
rightThe fi_handle that is to the right of the inequality operator.
Returns
true if the two fi_handle structures are different; otherwise, false.

Definition at line 127 of file fi_handle.cs.

References FreeImageAPI.IO.fi_handle.handle.

static bool FreeImageAPI.IO.fi_handle.operator== ( fi_handle  left,
fi_handle  right 
)
static

Tests whether two specified fi_handle structures are equivalent.

Parameters
leftThe fi_handle that is to the left of the equality operator.
rightThe fi_handle that is to the right of the equality operator.
Returns
true if the two fi_handle structures are equal; otherwise, false.

Definition at line 114 of file fi_handle.cs.

References FreeImageAPI.IO.fi_handle.handle.

static bool FreeImageAPI.IO.fi_handle.operator== ( fi_handle  left,
fi_handle  right 
)
static

Tests whether two specified fi_handle structures are equivalent.

Parameters
leftThe fi_handle that is to the left of the equality operator.
rightThe fi_handle that is to the right of the equality operator.
Returns
true if the two fi_handle structures are equal; otherwise, false.

Definition at line 114 of file fi_handle.cs.

override string FreeImageAPI.IO.fi_handle.ToString ( )

Converts the numeric value of the fi_handle object to its equivalent string representation.

Returns
The string representation of the value of this instance.

Definition at line 169 of file fi_handle.cs.

override string FreeImageAPI.IO.fi_handle.ToString ( )

Converts the numeric value of the fi_handle object to its equivalent string representation.

Returns
The string representation of the value of this instance.

Definition at line 169 of file fi_handle.cs.

Member Data Documentation

IntPtr FreeImageAPI.IO.fi_handle.handle

Property Documentation

bool FreeImageAPI.IO.fi_handle.IsNull
get

Gets whether the pointer is a null pointer.

Definition at line 136 of file fi_handle.cs.


The documentation for this struct was generated from the following file: