TypedBuffer.BufferPolicy Type

Type to describe relationship between the typed buffer and its wrapper instance of TypedBuffer derived class.

public enum BufferPolicy {

       AttachFixed,

       AttachAlterable,

       Allocate,

};

 

Remarks

This is a embedded type contained in TypedBuffer class. It’s a enumeration and has three different values AttachFixed, AttachAlterable and Allocate which are used to describe how an instance of TypedBuffer derived class “owns” an unmanaged typed buffer: AttachFixed means that the instance attaches an existing typed buffer and the buffer can not be changed (reallocated and freed), AttachAlterable means that the instance attaches an existing typed buffer and the buffer can be changed, and Allocate means that the instance allocate a new typed buffer for itself by calling ATMI C function tpalloc.

Since the typed buffers of Tuxedo system basically has two different sources: (1) allocated by customer by explicitly calling tpalloc and tprealloc, (2) allocated by Tuxedo system and delivered to customer’s programs. In some situations of the second case, the buffer may not be changed by customer, so this type is designed for the instances of TypedBuffer derived class to memorize the status of the typed buffer they owns and prevents themselves from changing the buffer casually.

 

TypedBuffer.TMTYPELEN Field

Maximum length of a valid type string of typed buffer

public const int TMTYPELEN;

 

Remarks

 

TypedBuffer.TMSTYPELEN Field

Maximum length of a valid sub-type string of typed buffer.

public const int TMSTYPELEN;

 

Remarks

 

TypedBuffer.Buffer Property

The location of unmanaged typed buffer allocated by ATMI C functions such as tpalloc.

public IntPtr Buffer {  get;  }

 

Remarks

This is a read-only property used to get the location the unmanaged typed buffer.

      

TypedBuffer.Size Property

The size of unmanaged typed buffer.

public long Size {  get;  }

 

Remarks

This is a read-only property used to get the size of the unmanaged typed buffer.

 

TypedBuffer.Datalen Property

The actual length of data (in bytes) stored in buffer.

public long Datalen {  get;  }

 

Remarks

This is a read-only property used to get the actual length of data stored in buffer in bytes.

 

TypedBuffer.Type Property

The type of typed buffer.

public string Type {  get;  }

 

Remarks

This is a read-only property used to get the type information of the unmanaged typed buffer owned by this instance.

      

TypedBuffer.Subtype Property

The sub-type of typed buffer.

public string Subtype {  get;  }

 

Remarks

This is a read-only property used to get the sub-type information of the unmanaged typed buffer owned by this instance.

 

TypedBuffer.Resize Method

Resize the unmanaged typed buffer owned by the instance.

public virtual void Resize(

long newsize

);

 

Remarks

This method actually calls the ATMI C function tprealloc to resize the typed buffer owned by the instance. This method should be called to resize an typed buffer since no explicit tprealloc method is provided by .NET wrapper for Tuxedo /WS package any more.

 

TypedBuffer.Dispose Method

Free the unmanaged typed buffer owned by the instance.

public void Dispose();

 

Remarks

This method actually calls the ATMI C function tpfree to free the typed buffer owned by the instance. This method should be called to free an typed buffer since no explicit tpfree method is provided by .NET wrapper for Tuxedo /WS package any more.

 

TypedBuffer.DoPreSend Method

Used to explicitly call the PreSend method for the instance.

public void DoPreSend();

 

Remarks

Generally overridden PreSend method of TypedBuffer derived class is called by all wrapper methods for the instances of the derived class, but in some complicated situations, this is not always the case. For example, an instance of TypedView32 derived class is added as a field of FLD_PTR to a TypedFML32 instance, however, it is changed soon after it was added. When the TypedFML32 instance is sent using communication methods such as AppContext.tpcall, the changes of the embedded TypedView32 instance can not be converted and be transferred to the unmanaged typed buffer owned by the TypedView32 instance since AppContext.tpcall totally has no idea that an TypedView32 buffer is embedded in the TypedFML32 buffer being sent so that it can not call the PreSend method of TypedView32 derived class for the TypedView32 buffer. In that case, customers must explicitly call the PreSend method of TypedView32 derived class for the TypedView32 buffer calling this method.

 

TypedBuffer.DoPostReceive Method

Used to explicitly call the PostReceive method for the instance.

public void DoPostReceive();

 

Remarks

This method is very similar to the TypedBuffer.DoPostReceive method. The main difference is that the time when they are called, generally this method is called at the time just after .NET wrapper methods get an unmanaged typed buffer from ATMI C functions. Since unmanaged typed buffer and the associated TypedBuffer instance usually have different representation for the same data and they need to be synchronized at some proper timepoints, the this method is used to serve this purpose.

Customers do not need to call this method since wrapper methods have done this before they returned the instances of TypedBuffer derived class to the callers.

 

TypedBuffer.Dispose Method

Virtual method used to implement a dispose pattern.

protected virtual void Dispose(

bool disposing

);

      

Remarks

This method can be overridden by the derived class of TypedBuffer class to modify the default behavior.

 

TypedBuffer.PreSend Method

Virtual method for derived class to do its own conversion work before an unmanaged typed buffer is delivered to ATMI C functions.

protected virtual void PreSend();

      

Remarks

This method can be overridden by the derived class of TypedBuffer class to do its own conversion work before the unmanaged typed buffer is delivered to the ATMI C functions.

 

TypedBuffer.PostReceive Method

Virtual method for derived class to do its own conversion work after an unmanaged typed buffer is returned from ATMI C functions.

protected virtual void PreSend();

      

Remarks

This method can be overridden by the derived class of TypedBuffer class to do its own conversion work after an unmanaged typed buffer is returned from ATMI C functions

.

TypedBuffer Constructor Method

Initializes a new instance of the TypedBuffer class

protected TypedBuffer(

string type,

string subtype,

long size

);

      

Remarks

TypedBuffer class can not be instantiated directly, that is its objects can not be created using statement “new TypedBuffer(,,)” due to the access modifier protected of this constructor method.