Support Interfaces

jwatte's picture

A number of interfaces exist as support for other interfaces in SAPS. These are collected below.

class ItfAddressable
{
  public:
    /* Where do I post messages to if I want to send a message to this target? */
    virtual Address     Address() = 0;
};
 
class ItfBlock
{
  public:
    /* Read the block -- a pointer to the beginning of the data. */
    virtual void const *Data() = 0;
    /* The size of the data. */
    virtual size64 Size() = 0;
    /* When the owner is done, he/she calls Dispose() which disposes or recycles the block. */
    virtual void Dispose() = 0;
};
 
class ItfWriteBlock
{
  public:
    /* To create an ItfBlock that you can write to, create it on the ItfHost, and then */
    /* call Write() to receive a pointer into the block of at least a given size. You can */
    /* optionally make that size live somewhere other than the start. The total size of */
    /* the block will be set to size + offset, if the size is currently smaller. */
    /* If the block was pre-allocated with a certain physical size other than 0, attempting to extend */
    /* the block past the physical size will fail, and return NULL. */
    virtual void *Write(size64 size, size64 offset = 0) = 0;
    /* Retrieve the actual block that this writable block represents. That's the only way you can dispose it. */
    virtual ItfBlock *Block() = 0;
};