C# 클래스 NetMQ.Msg

A Msg struct is the lowest-level interpretation of a ZeroMQ message, and simply contains byte-array data and MsgType and MsgFlags properties. It supports message buffer pooling.
Many users will not use this class directly. However in high-performance situations it may be useful. When used correctly it's possible to have zero-copy and zero-allocation behaviour.
파일 보기 프로젝트 열기: NetMQ/NetMQ3-x 1 사용 예제들

공개 메소드들

메소드 설명
AddReferences ( int amount ) : void

If this Msg is of MsgType.Pool, then - add the given amount number to the reference-counter and set the shared-data Flags bit. If this is not a Pool Msg, this does nothing.

CloneData ( ) : byte[]

Returns a new array containing the first Size bytes of Data.

Close ( ) : void

Clear the Data and set the MsgType to Invalid. If this is not a shared-data Msg (MsgFlags.Shared is not set), or it is shared but the reference-counter has dropped to zero, then return the data back to the BufferPool.

Copy ( Msg &src ) : void

Close this Msg, and effectively make this Msg a copy of the given source Msg by simply setting it to point to the given source Msg. If this is a Pool Msg, then this also increases the reference-counter and sets the Shared bit.

InitDelimiter ( ) : void

Set this Msg to be of type MsgType.Delimiter with no bits set within MsgFlags.

InitEmpty ( ) : void

Clear this Msg to empty - ie, set MsgFlags to None, MsgType to Empty, and clear the Data.

InitGC ( [ data, int size ) : void

Initialise this Msg to be of MsgType.GC with the given data-buffer value.

InitGC ( [ data, int offset, int size ) : void

Initialise this Msg to be of MsgType.GC with the given data-buffer value.

InitPool ( int size ) : void

Initialise this Msg to be of MsgType.Pool, with a data-buffer of the given number of bytes.

Move ( Msg &src ) : void

Close this Msg and make it reference the given source Msg, and then clear the Msg to empty.

Put ( [ src, int i, int len ) : void

Copy the given byte-array data to this Msg's Data buffer.

Put ( [ src, int srcOffset, int i, int len ) : void

Copy the given byte-array data to this Msg's Data buffer.

Put ( byte b ) : void

Copy the given single byte to this Msg's Data buffer.

Put ( byte b, int i ) : void

Copy the given single byte to this Msg's Data buffer at the given array-index.

RemoveReferences ( int amount ) : void

If this Msg is of MsgType.Pool and is marked as Shared, then - subtract the given amount number from the reference-counter and, if that reaches zero - return the data to the shared-data pool. If this is not both a Pool Msg and also marked as Shared, this simply Closes this Msg.

ResetFlags ( MsgFlags flags ) : void

Clear the indicated Flags bits.

SetFlags ( MsgFlags flags ) : void

Set the indicated Flags bits.

ToString ( ) : string

Override the Object ToString method to show the object-type, and values of the MsgType, Size, and Flags properties.

TrimPrefix ( int count ) : void

Increase Offset and decrease Size by the given count.

this ( int index ) : byte

Get and set the byte value in the Data buffer at a specific index.

비공개 메소드들

메소드 설명
Check ( ) : bool

메소드 상세

AddReferences() 공개 메소드

If this Msg is of MsgType.Pool, then - add the given amount number to the reference-counter and set the shared-data Flags bit. If this is not a Pool Msg, this does nothing.
public AddReferences ( int amount ) : void
amount int the number to add to the internal reference-counter
리턴 void

CloneData() 공개 메소드

Returns a new array containing the first Size bytes of Data.
public CloneData ( ) : byte[]
리턴 byte[]

Close() 공개 메소드

Clear the Data and set the MsgType to Invalid. If this is not a shared-data Msg (MsgFlags.Shared is not set), or it is shared but the reference-counter has dropped to zero, then return the data back to the BufferPool.
The object is not initialised.
public Close ( ) : void
리턴 void

Copy() 공개 메소드

Close this Msg, and effectively make this Msg a copy of the given source Msg by simply setting it to point to the given source Msg. If this is a Pool Msg, then this also increases the reference-counter and sets the Shared bit.
The object is not initialised.
public Copy ( Msg &src ) : void
src Msg the source Msg to copy from
리턴 void

InitDelimiter() 공개 메소드

Set this Msg to be of type MsgType.Delimiter with no bits set within MsgFlags.
public InitDelimiter ( ) : void
리턴 void

InitEmpty() 공개 메소드

Clear this Msg to empty - ie, set MsgFlags to None, MsgType to Empty, and clear the Data.
public InitEmpty ( ) : void
리턴 void

InitGC() 공개 메소드

Initialise this Msg to be of MsgType.GC with the given data-buffer value.
public InitGC ( [ data, int size ) : void
data [ the byte-array of data to assign to the Msg's Data property
size int the number of bytes that are in the data byte-array
리턴 void

InitGC() 공개 메소드

Initialise this Msg to be of MsgType.GC with the given data-buffer value.
public InitGC ( [ data, int offset, int size ) : void
data [ the byte-array of data to assign to the Msg's Data property
offset int first byte in the data array
size int the number of bytes that are in the data byte-array
리턴 void

InitPool() 공개 메소드

Initialise this Msg to be of MsgType.Pool, with a data-buffer of the given number of bytes.
public InitPool ( int size ) : void
size int the number of bytes to allocate in the data-buffer
리턴 void

Move() 공개 메소드

Close this Msg and make it reference the given source Msg, and then clear the Msg to empty.
The object is not initialised.
public Move ( Msg &src ) : void
src Msg the source-Msg to become
리턴 void

Put() 공개 메소드

Copy the given byte-array data to this Msg's Data buffer.
public Put ( [ src, int i, int len ) : void
src [ the source byte-array to copy from
i int index within the internal Data array to copy that byte to
len int the number of bytes to copy
리턴 void

Put() 공개 메소드

Copy the given byte-array data to this Msg's Data buffer.
public Put ( [ src, int srcOffset, int i, int len ) : void
src [ the source byte-array to copy from
srcOffset int first byte in the source byte-array
i int index within the internal Data array to copy that byte to
len int the number of bytes to copy
리턴 void

Put() 공개 메소드

Copy the given single byte to this Msg's Data buffer.
public Put ( byte b ) : void
b byte the source byte to copy from
리턴 void

Put() 공개 메소드

Copy the given single byte to this Msg's Data buffer at the given array-index.
public Put ( byte b, int i ) : void
b byte the source byte to copy from
i int index within the internal Data array to copy that byte to
리턴 void

RemoveReferences() 공개 메소드

If this Msg is of MsgType.Pool and is marked as Shared, then - subtract the given amount number from the reference-counter and, if that reaches zero - return the data to the shared-data pool. If this is not both a Pool Msg and also marked as Shared, this simply Closes this Msg.
public RemoveReferences ( int amount ) : void
amount int the number to subtract from the internal reference-counter
리턴 void

ResetFlags() 공개 메소드

Clear the indicated Flags bits.
public ResetFlags ( MsgFlags flags ) : void
flags MsgFlags which Flags bits to clear (More, Identity, or Shared)
리턴 void

SetFlags() 공개 메소드

Set the indicated Flags bits.
public SetFlags ( MsgFlags flags ) : void
flags MsgFlags which Flags bits to set (More, Identity, or Shared)
리턴 void

ToString() 공개 메소드

Override the Object ToString method to show the object-type, and values of the MsgType, Size, and Flags properties.
public ToString ( ) : string
리턴 string

TrimPrefix() 공개 메소드

Increase Offset and decrease Size by the given count.
public TrimPrefix ( int count ) : void
count int Number of bytes to remove from a message
리턴 void

this() 공개 메소드

Get and set the byte value in the Data buffer at a specific index.
public this ( int index ) : byte
index int The index to access
리턴 byte