MCSB  2.0.0
High-throughput shared memory middleware
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros
Public Member Functions | List of all members
MCSB::SendMessageDescriptor Class Reference

Refers to one or more segments that will be used to send a single message. More...

#include <MCSB/MessageDescriptors.h>

Inheritance diagram for MCSB::SendMessageDescriptor:
MCSB::MessageDescriptor

Public Member Functions

 SendMessageDescriptor (SendMessageDescriptor &desc)
 Construct, taking ownership from another SendMessageDescriptor.
 
SendMessageDescriptoroperator= (SendMessageDescriptor &desc)
 Assign, taking ownership from another SendMessageDescriptor.
 
SendMsgSegment * Release (void)
 
void Reset (SendMsgSegment *s=0, ClientImpl *c=0)
 
void * Buf (void) const
 Return a pointer to the first/current memory segment in the descriptor.
 
void Fill (uint8_t val=0)
 Fill the descriptor with specified value (memset).
 
int SendMessage (uint32_t msgID, uint32_t len)
 Send the contents of this descriptor as a message via the issuing client.
 
 operator SendMessageDescriptorRef ()
 Helper to allow automatic conversions for assignment operator.
 
 SendMessageDescriptor (SendMessageDescriptorRef ref)
 Helper to allow automatic conversions for assignment operator.
 
SendMessageDescriptoroperator= (SendMessageDescriptorRef ref)
 Helper to allow automatic conversions for assignment operator.
 
- Public Member Functions inherited from MCSB::MessageDescriptor
bool Valid (void) const
 Does this descriptor refer to a valid memory region?
 
bool Contiguous (void) const
 Does this descriptor refer to a single, contiguous region? (vs a multi-segment message).
 
unsigned NumSegments (void) const
 To how many segments does this descriptor refer?
 
uint32_t TotalSize (void) const
 Size (in bytes) of the whole descriptor (summing possible multiple segments).
 
int GetIovec (struct iovec iov[], int iovcnt) const
 Get a standard iovec of pointers and length of the segments. More...
 
uint32_t Size (void) const
 Size (in bytes) of the first/current segment in the descriptor.
 
uint32_t BlockID (void) const
 blockID of the first/current segment in the descriptor.
 
MessageSegment * Seg (void) const
 pointer to the first/current (opaque) MessageSegment in the descriptor.
 
ClientImpl * CImpl (void) const
 pointer to this descriptor's issuing (opaque) ClientImpl.
 

Detailed Description

Refers to one or more segments that will be used to send a single message.

It uses semantics like std::auto_ptr, taking ownership upon assignment. The Reset/Release API closely follows auto_ptr. Like auto_ptr, SendMessageDescriptors can't be stored in an STL container. We would prefer unique_ptr<> semantics, but that requires C++11 (which may happen soon).

Member Function Documentation

SendMsgSegment* MCSB::SendMessageDescriptor::Release ( void  )

Release a SendMsgSegment from a SendMessageDescriptor. (A SendMsgSegment can be put in an STL container, but smart/auto_ptr semantics are then lost).

void MCSB::SendMessageDescriptor::Reset ( SendMsgSegment *  s = 0,
ClientImpl *  c = 0 
)

Reset, optionally filling with the underlying (opaque) types. (A SendMsgSegment can be put back into a SendMessageDescriptor).


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