Monkey Documentation

Class MegaPacketPool

This is used internally to manage MegaPacket handles. More...


Fields:
Constructors:
  • New ( Network:NetworkEngine, PoolSize:Int )
Properties:
Methods:

Detailed Discussion

This is used internally to manage MegaPacket handles. This includes internally allocated MegaPackets, like when representing remote instances, and user-created MegaPackets / pending MegaPackets (If network-managed storage was used by the user). This (Along with NetworkEngine and Client) handle(s) the details of storage when sending MegaPackets, and similar operations that could be costly storage-wise.

Field Documentation

Field Elements : Stack<MegaPacket>

This is a collection of (Raw) MegaPacket objects, allocated internally for external delegation.


Constructor Documentation

Method New ( Network:NetworkEngine, PoolSize:Int )

This is the primary constructor used to create this pool.

  • Network will be held internally, and used to allocate MegaPacket objects however this class or object sees fit.

  • PoolSize is used to specify how many initial entries this pool will have.


Property Documentation

Method Network : NetworkEngine () Property

This represents the constructor-argument of the same name; parent NetworkEngine used for MegaPacket allocation.

This property has protected assignment rights.


Method Documentation

Method Allocate : MegaPacket ()

This overload allocates a local/general-purpose MegaPacket object.

When finished with this object, please call Release on the output object.

See also: Release, Contains

Method Allocate : MegaPacket ( ID:PacketID, Destination:Client=null )

This overload allocates a remote/client-allocated MegaPacket object.

When finished with this object, please call Release on the output object.

Method BuildPool : Void ( PoolSize:Int )

This is an internal constructor used to generate a segment of the internal pool.

This constructor is protected.

See also: GeneratePacket

Method Contains : Bool ( MP:MegaPacket )

This reports if MP is held internally. (Could describe undefined behavior if True)

Method GeneratePacket : MegaPacket ()

This creates a new MetaPacket object, without calling Construct.

The object produced by this routine should immediately be stored and/or constructed, and should not be delegated until it is ready.

This method is protected

Method RawAllocate : MegaPacket ()

This is used internally to allocate a raw MegaPacket. (Doesn't imply a call to Construct)

Please call Allocate instead of this; this has undefined behavior.

This method is protected

Method Release : Bool ( MP:MegaPacket, Force:Bool=false )

This "deallocates" MP, making it a part of this pool again. Please do not pass objects that weren't allocated via Allocate to this command.

  • The MP argument specifies the target MegaPacket object.
  • The Force argument is used to ensure release of MP. If disabled, this may refuse the object based on its internal flags.

The return-value of this method indicates if 'MP' was accepted; may still be accepted automatically later.

Though this documentation states to use this command, that is only when using this class directly.

Classes like NetworkEngine manage objects of this class directly, and follow different storage practices.

Please follow appropriate APIs that house these calls.

See also: Allocate, Contains

Method Release : Void ( MegaPackets:Stack<MegaPacket>, Force:Bool=true )

This (Usually forcibly) releases every MegaPacket in MegaPackets.

Exact behavior is dictated by Force; for details, view the main overload's documentation.

See also: Allocate, Contains