memory/sharedarray.bi

Summary
memory/sharedarray.bi
LicenseCopyright © 2007-2011, FreeBASIC Extended Library Development Group
Macros
FBEXT_SHAREDARRAY
Functions
default constructorConstructs a fbext_SharedPtrArray(T_) with the address of an array of objects.
constructorConstructs a fbext_SharedPtrArray(T_) with the address of an array of objects.
copy constructorConstructs a fbext_SharedPtrArray(T_) by sharing the resource of another.
destructorDestroys a fbext_SharedPtrArray(T_).
letShares a resource with another fbext_SharedPtrArray(T_).
IndexReturns the address of an element in the referenced array.
ResetForces the fbext_SharedPtrArray(T_) to reference another resource.
ResetForces the fbext_SharedPtrArray(T_) to reference another resource.
GetRetrieves the wrapped pointer.
Swap_Swaps the value of this fbext_SharedPtrArray(T_) with another.
Swap_Global ext.Swap_ overload.

License

Copyright © 2007-2011, FreeBASIC Extended Library Development Group

Distributed under the FreeBASIC Extended Library Group license.  See accompanying file LICENSE.txt or copy at http://code.google.com/p/fb-extended-lib/wiki/License

Macros

FBEXT_SHAREDARRAY

Functions

default constructor

Constructs a fbext_SharedPtrArray(T_) with the address of an array of objects.

Parameters

pThe address of the array to reference.

Description

p defaults to //null// if not specified, meaning the fbext_SharedPtrArray(T_) references no resource.  When the last fbext_SharedPtrArray(T_) referencing the resource is destroyed, ..DELETE[] will be called to free the resource.

constructor

declare constructor (byval p as fbext_TypeName(T_) ptr,
byval d as fbext_DestroyProc(T_))

Constructs a fbext_SharedPtrArray(T_) with the address of an array of objects.

Parameters

pThe address of the array to reference.
destroyThe address of a procedure that will be passed the wrapped pointer when no more fbext_SharedPtrArray(T_) objects reference it.

Description

p defaults to //null// if not specified, meaning the fbext_SharedPtrArray(T_) references no resource.  When the last fbext_SharedPtrArray(T_) referencing the resource is destroyed, d will be called to handle freeing the resource.  If d is //null//, ..DELETE[] will be called instead.

copy constructor

Constructs a fbext_SharedPtrArray(T_) by sharing the resource of another.

Parameters

xThe other fbext_SharedPtrArray(T_).

Description

The newly constructed fbext_SharedPtrArray(T_) will share the resource, if any, referenced by x.  Any destruction procedure bound to the resource is also copied.

destructor

declare destructor ( )

Destroys a fbext_SharedPtrArray(T_).

Description

If no other fbext_SharedPtrArray(T_) references this resource, it is destroyed using ..DELETE[], or the user-supplied destruction procedure.

let

declare operator let (byref x as fbext_SharedPtrArray(T_))

Shares a resource with another fbext_SharedPtrArray(T_).

Parameters

xThe other fbext_SharedPtrArray(T_).

Description

If no other fbext_SharedPtrArray(T_) references this resource, it is destroyed using ..DELETE[], or the user-supplied destruction procedure.  The fbext_SharedPtrArray(T_) will then share the resource, if any, of x.

Behaves like this.Swap_(fbext_SharedPtrArray(T_)(x)).

Index

declare function Index (byval i as ext.SizeType) as fbext_TypeName(T_) ptr

Returns the address of an element in the referenced array.

Parameters

iThe 0-based offset of the element in the array.

Returns

The element at offset i.

Reset

declare sub Reset (byval p as fbext_TypeName(T_) ptr =  null)

Forces the fbext_SharedPtrArray(T_) to reference another resource.

Parameters

pThe address of the new resource.

Description

If no other fbext_SharedPtrArray(T_) references this resource, it is destroyed using ..DELETE[], or the user-supplied destruction procedure.  The fbext_SharedPtrArray(T_) will then reference the resource pointed to by p, or no resource if p is //null//.

Behaves like this.Swap_(fbext_SharedPtrArray(T_)(p)).

Reset

declare sub Reset (byval p as fbext_TypeName(T_) ptr,
byval d as fbext_DestroyProc(T_))

Forces the fbext_SharedPtrArray(T_) to reference another resource.

Parameters

pThe address of the new resource.
destroyThe address of a procedure that will be passed the wrapped pointer when no more fbext_SharedPtrArray(T_) objects reference it.

Description

If no other fbext_SharedPtrArray(T_) references this resource, it is destroyed using ..DELETE[], or the user-supplied destruction procedure.  The fbext_SharedPtrArray(T_) will then reference the resource pointed to by p, or no resource if p is //null//.

Behaves like this.Swap_(fbext_SharedPtrArray(T_)(p, d)).

Get

declare function Get () as fbext_TypeName(T_) ptr

Retrieves the wrapped pointer.

Returns

Returns the address of the referenced resource.

Swap_

declare sub Swap_ (byref x as fbext_SharedPtrArray(T_))

Swaps the value of this fbext_SharedPtrArray(T_) with another.

Description

The two fbext_SharedPtrArray(T_) objects will then reference each other’s resources, if any.

Swap_

declare sub Swap_ overload (byref x as fbext_SharedPtrArray(T_),
byref y as fbext_SharedPtrArray(T_))

Global ext.Swap_ overload.

declare constructor (byval p as fbext_TypeName(T_) ptr,
byval d as fbext_DestroyProc(T_))
Constructs a fbext_SharedPtrArray(T_) with the address of an array of objects.
declare destructor ( )
Destroys a fbext_SharedPtrArray(T_).
declare operator let (byref x as fbext_SharedPtrArray(T_))
Shares a resource with another fbext_SharedPtrArray(T_).
declare function Index (byval i as ext.SizeType) as fbext_TypeName(T_) ptr
Returns the address of an element in the referenced array.
declare sub Reset (byval p as fbext_TypeName(T_) ptr =  null)
Forces the fbext_SharedPtrArray(T_) to reference another resource.
declare function Get () as fbext_TypeName(T_) ptr
Retrieves the wrapped pointer.
declare sub Swap_ (byref x as fbext_SharedPtrArray(T_))
Swaps the value of this fbext_SharedPtrArray(T_) with another.