Ice 3.7 C++98 API Reference
|
Interface for output streams used to create a sequence of bytes from Slice types. More...
#include <Ice/Ice.h>
Public Types | |
typedef size_t | size_type |
Public Member Functions | |
void | clear () |
Releases any data retained by encapsulations. More... | |
void | endEncapsulation () |
Ends the current encapsulation. More... | |
void | endException () |
Marks the end of an exception instance. More... | |
void | endSize (size_type position) |
Updates the size value at the given position to contain a size based on the stream's current position. More... | |
void | endSlice () |
Marks the end of a value or exception slice. More... | |
void | endValue () |
Marks the end of a class instance. More... | |
std::pair< const Byte *, const Byte * > | finished () |
Indicates that marshaling is complete. More... | |
void | finished (std::vector< Byte > &v) |
Indicates that marshaling is complete. More... | |
void * | getClosure () const |
Obtains the closure data associated with this stream. More... | |
const EncodingVersion & | getEncoding () const |
Determines the current encoding version. More... | |
void | initialize (const CommunicatorPtr &communicator) |
Initializes the stream to use the communicator's default encoding version, class encoding format and string converters. More... | |
void | initialize (const CommunicatorPtr &communicator, const EncodingVersion &version) |
Initializes the stream to use the given encoding version and the communicator's default class encoding format and string converters. More... | |
OutputStream () | |
Constructs an OutputStream using the latest encoding version, the default format for class encoding, and the process string converters. More... | |
OutputStream (const CommunicatorPtr &communicator) | |
Constructs a stream using the communicator's default encoding version. More... | |
OutputStream (const CommunicatorPtr &communicator, const EncodingVersion &version) | |
Constructs a stream using the given communicator and encoding version. More... | |
OutputStream (const CommunicatorPtr &communicator, const EncodingVersion &version, const std::pair< const Byte *, const Byte * > &bytes) | |
Constructs a stream using the given communicator and encoding version. More... | |
size_type | pos () |
Obtains the current position of the stream. More... | |
void | resize (Container::size_type sz) |
Resizes the stream to a new size. More... | |
void | rewrite (Int v, size_type pos) |
Overwrite a 32-bit integer value at the given position in the stream. More... | |
void | rewriteSize (Int v, Container::iterator dest) |
Replaces a size value at the given destination in the stream. More... | |
void * | setClosure (void *p) |
Associates closure data with this stream. More... | |
void | setFormat (FormatType format) |
Sets the class encoding format. More... | |
void | startEncapsulation () |
Writes the start of an encapsulation using the default encoding version and class encoding format. More... | |
void | startEncapsulation (const EncodingVersion &encoding, FormatType format) |
Writes the start of an encapsulation using the given encoding version and class encoding format. More... | |
void | startException (const SlicedDataPtr &data) |
Marks the start of an exception instance. More... | |
size_type | startSize () |
Writes a placeholder value for the size and returns the starting position of the size value; after writing the data, call endSize to patch the placeholder with the actual size at the given position. More... | |
void | startSlice (const std::string &typeId, int compactId, bool last) |
Writes the start of a value or exception slice. More... | |
void | startValue (const SlicedDataPtr &data) |
Marks the start of a class instance. More... | |
void | swap (OutputStream &other) |
Swaps the contents of one stream with another. More... | |
void | write (bool v) |
Writes a boolean to the stream. More... | |
void | write (Byte v) |
Writes a byte to the stream. More... | |
void | write (const bool *begin, const bool *end) |
Writes a byte sequence to the stream. More... | |
void | write (const Byte *start, const Byte *end) |
Writes a byte sequence to the stream. More... | |
void | write (const char *vdata, bool convert=true) |
Writes a string to the stream. More... | |
void | write (const char *vdata, size_t vsize, bool convert=true) |
Writes a string to the stream. More... | |
void | write (const Double *begin, const Double *end) |
Writes a double sequence to the stream. More... | |
void | write (const Float *begin, const Float *end) |
Writes a float sequence to the stream. More... | |
template<typename T > | |
void | write (const IceInternal::Handle< T > &v) |
Writes a value instance to the stream. More... | |
template<typename T > | |
void | write (const IceInternal::ProxyHandle< T > &v) |
Writes a proxy to the stream. More... | |
void | write (const Int *begin, const Int *end) |
Writes an int sequence to the stream. More... | |
void | write (const Long *begin, const Long *end) |
Writes a long sequence to the stream. More... | |
void | write (const ObjectPrx &v) |
Writes a proxy to the stream. More... | |
void | write (const ObjectPtr &v) |
Writes a value instance to the stream. More... | |
void | write (const Short *begin, const Short *end) |
Writes a short sequence to the stream. More... | |
void | write (const std::string &v, bool convert=true) |
Writes a string to the stream. More... | |
void | write (const std::string *begin, const std::string *end, bool convert=true) |
Writes a string sequence to the stream. More... | |
void | write (const std::vector< bool > &v) |
Writes a byte sequence to the stream. More... | |
template<typename T > | |
void | write (const std::vector< T > &v) |
Writes a sequence of data values to the stream. More... | |
void | write (const std::wstring &v) |
Writes a wide string to the stream. More... | |
void | write (const std::wstring *begin, const std::wstring *end) |
Writes a wide string sequence to the stream. More... | |
template<typename T > | |
void | write (const T &v) |
Writes a data value to the stream. More... | |
template<typename T > | |
void | write (const T *begin, const T *end) |
Writes a sequence of data values to the stream. More... | |
void | write (Double v) |
Writes a double to the stream. More... | |
void | write (Float v) |
Writes a float to the stream. More... | |
template<typename T > | |
void | write (Int tag, const IceUtil::Optional< T > &v) |
Writes an optional data value to the stream. More... | |
void | write (Int v) |
Writes an int to the stream. More... | |
void | write (Int v, Container::iterator dest) |
Overwrites a 32-bit integer value at the given destination in the stream. More... | |
void | write (Long v) |
Writes a long to the stream. More... | |
void | write (Short v) |
Writes a short to the stream. More... | |
void | writeBlob (const Byte *v, Container::size_type sz) |
Copies the specified blob of bytes to the stream without modification. More... | |
void | writeBlob (const std::vector< Byte > &v) |
Copies the specified blob of bytes to the stream without modification. More... | |
void | writeEmptyEncapsulation (const EncodingVersion &encoding) |
Writes an empty encapsulation using the given encoding version. More... | |
void | writeEncapsulation (const Byte *v, Int sz) |
Copies the marshaled form of an encapsulation to the buffer. More... | |
void | writeEnum (Int v, Int maxValue) |
Writes an enumerator to the stream. More... | |
void | writeException (const UserException &v) |
Writes an exception to the stream. More... | |
bool | writeOptional (Int tag, OptionalFormat format) |
Writes the tag and format of an optional value. More... | |
void | writePendingValues () |
Encodes the state of class instances whose insertion was delayed during a previous call to write. More... | |
void | writeSize (Int v) |
Writes a size value. More... | |
~OutputStream () | |
Interface for output streams used to create a sequence of bytes from Slice types.
typedef size_t Ice::OutputStream::size_type |
Ice::OutputStream::OutputStream | ( | ) |
Constructs an OutputStream using the latest encoding version, the default format for class encoding, and the process string converters.
You can supply a communicator later by calling initialize().
Ice::OutputStream::OutputStream | ( | const CommunicatorPtr & | communicator | ) |
Constructs a stream using the communicator's default encoding version.
communicator | The communicator to use for marshaling tasks. |
Ice::OutputStream::OutputStream | ( | const CommunicatorPtr & | communicator, |
const EncodingVersion & | version | ||
) |
Constructs a stream using the given communicator and encoding version.
communicator | The communicator to use for marshaling tasks. |
version | The encoding version used to encode the data. |
Ice::OutputStream::OutputStream | ( | const CommunicatorPtr & | communicator, |
const EncodingVersion & | version, | ||
const std::pair< const Byte *, const Byte * > & | bytes | ||
) |
Constructs a stream using the given communicator and encoding version.
communicator | The communicator to use for marshaling tasks. |
version | The encoding version used to encode the data. |
bytes | Application-supplied memory that the stream uses as its initial marshaling buffer. The stream will reallocate if the size of the marshaled data exceeds the application's buffer. |
|
inline |
void Ice::OutputStream::clear | ( | ) |
Releases any data retained by encapsulations.
|
inline |
Ends the current encapsulation.
|
inline |
Marks the end of an exception instance.
|
inline |
Updates the size value at the given position to contain a size based on the stream's current position.
position | The starting position of the size value as returned by startSize. |
|
inline |
Marks the end of a value or exception slice.
|
inline |
Marks the end of a class instance.
Indicates that marshaling is complete.
This function must only be called once.
void Ice::OutputStream::finished | ( | std::vector< Byte > & | v | ) |
Indicates that marshaling is complete.
This function must only be called once.
v | Filled with a copy of the encoded data. |
void* Ice::OutputStream::getClosure | ( | ) | const |
Obtains the closure data associated with this stream.
|
inline |
Determines the current encoding version.
void Ice::OutputStream::initialize | ( | const CommunicatorPtr & | communicator | ) |
Initializes the stream to use the communicator's default encoding version, class encoding format and string converters.
Use this method if you originally constructed the stream without a communicator.
communicator | The communicator to use for marshaling tasks. |
void Ice::OutputStream::initialize | ( | const CommunicatorPtr & | communicator, |
const EncodingVersion & | version | ||
) |
Initializes the stream to use the given encoding version and the communicator's default class encoding format and string converters.
Use this method if you originally constructed the stream without a communicator.
communicator | The communicator to use for marshaling tasks. |
version | The encoding version used to encode the data. |
|
inline |
Obtains the current position of the stream.
|
inline |
Resizes the stream to a new size.
sz | The new size. |
Overwrite a 32-bit integer value at the given position in the stream.
This function does not change the stream's current position.
v | The value to be written. |
pos | The buffer position for the value. |
|
inline |
Replaces a size value at the given destination in the stream.
This function does not change the stream's current position.
v | A non-negative integer representing the size. |
dest | The buffer destination for the size. |
void* Ice::OutputStream::setClosure | ( | void * | p | ) |
Associates closure data with this stream.
p | The data as a void pointer. |
void Ice::OutputStream::setFormat | ( | FormatType | format | ) |
Sets the class encoding format.
format | The encoding format. |
void Ice::OutputStream::startEncapsulation | ( | ) |
Writes the start of an encapsulation using the default encoding version and class encoding format.
|
inline |
Writes the start of an encapsulation using the given encoding version and class encoding format.
encoding | The encoding version to use for the encapsulation. |
format | The class format to use for the encapsulation. |
|
inline |
Marks the start of an exception instance.
data | Contains the marshaled form of unknown slices from this instance. If not nil, these slices will be marshaled with the instance. |
|
inline |
Writes a placeholder value for the size and returns the starting position of the size value; after writing the data, call endSize to patch the placeholder with the actual size at the given position.
|
inline |
Writes the start of a value or exception slice.
typeId | The Slice type ID for this slice. |
compactId | The compact ID corresponding to the type, or -1 if no compact ID is used. |
last | True if this is the last slice, false otherwise. |
|
inline |
Marks the start of a class instance.
data | Contains the marshaled form of unknown slices from this instance. If not nil, these slices will be marshaled with the instance. |
void Ice::OutputStream::swap | ( | OutputStream & | other | ) |
Swaps the contents of one stream with another.
other | The other stream. |
|
inline |
Writes a boolean to the stream.
v | The boolean to write. |
|
inline |
Writes a byte to the stream.
v | The byte to write. |
void Ice::OutputStream::write | ( | const bool * | begin, |
const bool * | end | ||
) |
Writes a byte sequence to the stream.
begin | The beginning of the sequence. |
end | The end of the sequence. |
Writes a byte sequence to the stream.
start | The beginning of the sequence. |
end | The end of the sequence. |
|
inline |
Writes a string to the stream.
vdata | The null-terminated string to write. |
convert | Determines whether the string is processed by the narrow string converter, if one has been configured. The default behavior is to convert the strings. |
|
inline |
Writes a string to the stream.
vdata | The string to write. |
vsize | The size of the string. |
convert | Determines whether the string is processed by the narrow string converter, if one has been configured. The default behavior is to convert the strings. |
Writes a double sequence to the stream.
begin | The beginning of the sequence. |
end | The end of the sequence. |
Writes a float sequence to the stream.
begin | The beginning of the sequence. |
end | The end of the sequence. |
|
inline |
Writes a value instance to the stream.
v | The value to be written. |
|
inline |
Writes a proxy to the stream.
v | The proxy to be written. |
Writes an int sequence to the stream.
begin | The beginning of the sequence. |
end | The end of the sequence. |
Writes a long sequence to the stream.
begin | The beginning of the sequence. |
end | The end of the sequence. |
void Ice::OutputStream::write | ( | const ObjectPrx & | v | ) |
Writes a proxy to the stream.
v | The proxy to be written. |
|
inline |
Writes a value instance to the stream.
v | The value to be written. |
Writes a short sequence to the stream.
begin | The beginning of the sequence. |
end | The end of the sequence. |
|
inline |
Writes a string to the stream.
v | The string to write. |
convert | Determines whether the string is processed by the narrow string converter, if one has been configured. The default behavior is to convert the strings. |
void Ice::OutputStream::write | ( | const std::string * | begin, |
const std::string * | end, | ||
bool | convert = true |
||
) |
Writes a string sequence to the stream.
begin | The beginning of the sequence. |
end | The end of the sequence. |
convert | Determines whether the string is processed by the narrow string converter, if one has been configured. The default behavior is to convert the strings. |
void Ice::OutputStream::write | ( | const std::vector< bool > & | v | ) |
Writes a byte sequence to the stream.
v | The sequence to be written. |
|
inline |
Writes a sequence of data values to the stream.
v | The sequence to be written. |
void Ice::OutputStream::write | ( | const std::wstring & | v | ) |
Writes a wide string to the stream.
v | The wide string to write. |
void Ice::OutputStream::write | ( | const std::wstring * | begin, |
const std::wstring * | end | ||
) |
Writes a wide string sequence to the stream.
begin | The beginning of the sequence. |
end | The end of the sequence. |
|
inline |
Writes a data value to the stream.
v | The data value to be written. |
|
inline |
Writes a sequence of data values to the stream.
begin | The beginning of the sequence. |
end | The end of the sequence. |
void Ice::OutputStream::write | ( | Double | v | ) |
Writes a double to the stream.
v | The double to write. |
void Ice::OutputStream::write | ( | Float | v | ) |
Writes a float to the stream.
v | The float to write. |
|
inline |
Writes an optional data value to the stream.
tag | The tag ID. |
v | The data value to be written (if any). |
|
inline |
Writes an int to the stream.
v | The int to write. |
|
inline |
Overwrites a 32-bit integer value at the given destination in the stream.
This function does not change the stream's current position.
v | The integer value to be written. |
dest | The buffer destination for the integer value. |
void Ice::OutputStream::write | ( | Long | v | ) |
Writes a long to the stream.
v | The long to write. |
void Ice::OutputStream::write | ( | Short | v | ) |
Writes a short to the stream.
v | The short to write. |
|
inline |
Copies the specified blob of bytes to the stream without modification.
v | The start of the buffer to be copied. |
sz | The number of bytes to be copied. |
void Ice::OutputStream::writeBlob | ( | const std::vector< Byte > & | v | ) |
Copies the specified blob of bytes to the stream without modification.
v | The bytes to be copied. |
|
inline |
Writes an empty encapsulation using the given encoding version.
encoding | The encoding version to use for the encapsulation. |
Copies the marshaled form of an encapsulation to the buffer.
v | The start of the buffer. |
sz | The number of bytes to copy. |
Writes an enumerator to the stream.
v | The enumerator to be written. |
maxValue | The maximum value of all enumerators in this enumeration. |
void Ice::OutputStream::writeException | ( | const UserException & | v | ) |
Writes an exception to the stream.
v | The exception to be written. |
|
inline |
Writes the tag and format of an optional value.
tag | The optional tag ID. |
format | The optional format. |
void Ice::OutputStream::writePendingValues | ( | ) |
Encodes the state of class instances whose insertion was delayed during a previous call to write.
This member function must only be called once. For backward compatibility with encoding version 1.0, this function must only be called when non-optional data members or parameters use class types.
|
inline |
Writes a size value.
v | A non-negative integer. |