*Massive cleanup (\n\n -> \n, *\n -> \n, cleanup for(...) to for (...), and some other cleanups by hand)

*Fix a possible crash in Spell::DoAllEffectOnTarget

--HG--
branch : trunk
This commit is contained in:
maximius
2009-10-17 15:35:07 -07:00
parent f21f47005d
commit 26b5e033ff
2257 changed files with 750 additions and 103852 deletions
-191
View File
@@ -1,5 +1,4 @@
// -*- C++ -*-
//=============================================================================
/**
* @file CDR_Stream.h
@@ -36,37 +35,26 @@
* @author Codeset translation by Jim Rogers <[email protected]>
*/
//=============================================================================
#ifndef ACE_CDR_STREAM_H
#define ACE_CDR_STREAM_H
#include /**/ "ace/pre.h"
#include "ace/CDR_Base.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
#include "ace/SStringfwd.h"
#include "ace/Message_Block.h"
#if defined (GEN_OSTREAM_OPS)
#include "ace/streams.h"
#endif /* GEN_OSTREAM_OPS */
#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1)
#include "Monitor_Size.h"
#endif /* ACE_HAS_MONITOR_POINTS==1 */
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
class ACE_Char_Codeset_Translator;
class ACE_WChar_Codeset_Translator;
class ACE_InputCDR;
/**
* @class ACE_OutputCDR
*
@@ -92,7 +80,6 @@ public:
friend class ACE_Char_Codeset_Translator;
friend class ACE_WChar_Codeset_Translator;
friend class ACE_InputCDR;
/**
* Default constructor; allows one to set byte ordering, allocators, and
* tuning information.
@@ -118,7 +105,6 @@ public:
size_t memcpy_tradeoff = ACE_DEFAULT_CDR_MEMCPY_TRADEOFF,
ACE_CDR::Octet major_version = ACE_CDR_GIOP_MAJOR_VERSION,
ACE_CDR::Octet minor_version = ACE_CDR_GIOP_MINOR_VERSION);
/// Build a CDR stream with an initial buffer, it will *not* remove
/// <data>, since it did not allocated it. It's important to be careful
/// with the alignment of <data>.
@@ -139,7 +125,6 @@ public:
size_t memcpy_tradeoff = ACE_DEFAULT_CDR_MEMCPY_TRADEOFF,
ACE_CDR::Octet giop_major_version = ACE_CDR_GIOP_MAJOR_VERSION,
ACE_CDR::Octet giop_minor_version = ACE_CDR_GIOP_MINOR_VERSION);
/// Build a CDR stream with an initial data block, it will *not* remove
/// <data_block>, since it did not allocated it. It's important to be
// careful with the alignment of <data_block>.
@@ -157,7 +142,6 @@ public:
size_t memcpy_tradeoff = ACE_DEFAULT_CDR_MEMCPY_TRADEOFF,
ACE_CDR::Octet giop_major_version = ACE_CDR_GIOP_MAJOR_VERSION,
ACE_CDR::Octet giop_minor_version = ACE_CDR_GIOP_MINOR_VERSION);
/// Build a CDR stream with an initial Message_Block chain, it will
/// *not* remove @a data, since it did not allocate it.
ACE_OutputCDR (ACE_Message_Block *data,
@@ -165,40 +149,33 @@ public:
size_t memcpy_tradeoff = ACE_DEFAULT_CDR_MEMCPY_TRADEOFF,
ACE_CDR::Octet giop_major_version = ACE_CDR_GIOP_MAJOR_VERSION,
ACE_CDR::Octet giop_minor_version = ACE_CDR_GIOP_MINOR_VERSION);
/// destructor
~ACE_OutputCDR (void);
/**
* Disambiguate overload when inserting booleans, octets, chars, and
* bounded strings.
*/
//@{ @name Helper classes
struct ACE_Export from_boolean
{
explicit from_boolean (ACE_CDR::Boolean b);
ACE_CDR::Boolean val_;
};
struct ACE_Export from_octet
{
explicit from_octet (ACE_CDR::Octet o);
ACE_CDR::Octet val_;
};
struct ACE_Export from_char
{
explicit from_char (ACE_CDR::Char c);
ACE_CDR::Char val_;
};
struct ACE_Export from_wchar
{
explicit from_wchar (ACE_CDR::WChar wc);
ACE_CDR::WChar val_;
};
struct ACE_Export from_string
{
from_string (ACE_CDR::Char* s,
@@ -211,7 +188,6 @@ public:
ACE_CDR::ULong bound_;
ACE_CDR::Boolean nocopy_;
};
struct ACE_Export from_wstring
{
from_wstring (ACE_CDR::WChar* ws,
@@ -225,7 +201,6 @@ public:
ACE_CDR::Boolean nocopy_;
};
//@}
/**
* @{ @name Write operations
* Return 0 on failure and 1 on success.
@@ -243,7 +218,6 @@ public:
ACE_CDR::Boolean write_float (ACE_CDR::Float x);
ACE_CDR::Boolean write_double (const ACE_CDR::Double &x);
ACE_CDR::Boolean write_longdouble (const ACE_CDR::LongDouble &x);
/// For string we offer methods that accept a precomputed length.
ACE_CDR::Boolean write_string (const ACE_CDR::Char *x);
ACE_CDR::Boolean write_string (ACE_CDR::ULong len,
@@ -253,7 +227,6 @@ public:
ACE_CDR::Boolean write_wstring (ACE_CDR::ULong length,
const ACE_CDR::WChar *x);
//@}
/// @note the portion written starts at <x> and ends
/// at <x + length>.
/// The length is *NOT* stored into the CDR stream.
@@ -284,12 +257,10 @@ public:
ACE_CDR::ULong length);
ACE_CDR::Boolean write_longdouble_array (const ACE_CDR::LongDouble* x,
ACE_CDR::ULong length);
/// Write an octet array contained inside a MB, this can be optimized
/// to minimize copies.
ACE_CDR::Boolean write_octet_array_mb (const ACE_Message_Block* mb);
//@}
/**
* @{ @name Placeholder/replace operations
* Facilitates writing a placeholder into a CDR stream to be replaced
@@ -305,7 +276,6 @@ public:
strm.replace (real_val, pos); // Replace earlier placeholder
@endcode
*/
/**
* Write a placeholder into the stream. The placeholder's pointer
* is returned so it may later be passed as the @a loc argument to
@@ -318,7 +288,6 @@ public:
*/
char* write_long_placeholder (void);
char* write_short_placeholder (void);
/**
* Writes a new value into a specific location. This is commonly
* used to update a prior "placeholder" location in the stream.
@@ -338,7 +307,6 @@ public:
ACE_CDR::Boolean replace (ACE_CDR::Long x, char* loc);
ACE_CDR::Boolean replace (ACE_CDR::Short x, char* loc);
//@}
/**
* Return 0 on failure and 1 on success.
*/
@@ -356,36 +324,28 @@ public:
ACE_CDR::Boolean append_float (ACE_InputCDR &);
ACE_CDR::Boolean append_double (ACE_InputCDR &);
ACE_CDR::Boolean append_longdouble (ACE_InputCDR &);
ACE_CDR::Boolean append_wstring (ACE_InputCDR &);
ACE_CDR::Boolean append_string (ACE_InputCDR &);
//@}
/// Returns @c false if an error has ocurred.
/**
* @note The only expected error is to run out of memory.
*/
bool good_bit (void) const;
/// Reuse the CDR stream to write on the old buffer.
void reset (void);
/// Add the length of each message block in the chain.
size_t total_length (void) const;
/**
* Return the start of the message block chain for this CDR stream.
* @note The complete CDR stream is represented by a chain of
* message blocks.
*/
const ACE_Message_Block *begin (void) const;
/// Return the last message in the chain that is is use.
const ACE_Message_Block *end (void) const;
/// Return the <current_> message block in chain.
const ACE_Message_Block *current (void) const;
/// Replace the message block chain with a single message block.
/**
* Upon successful completion, there will be a single message block
@@ -394,21 +354,18 @@ public:
* @note The only expected error is to run out of memory.
*/
int consolidate (void);
/**
* Access the underlying buffer (read only). @note This
* method only returns a pointer to the first block in the
* chain.
*/
const char *buffer (void) const;
/**
* Return the size of first message block in the block chain. @note This
* method only returns information about the first block in the
* chain.
*/
size_t length (void) const;
/**
* Utility function to allow the user more flexibility.
* Pads the stream up to the nearest <alignment>-byte boundary.
@@ -416,32 +373,25 @@ public:
* Returns 0 on success and -1 on failure.
*/
int align_write_ptr (size_t alignment);
/// Access the codeset translators. They can be null!
ACE_Char_Codeset_Translator *char_translator (void) const;
ACE_WChar_Codeset_Translator *wchar_translator (void) const;
/// Set the char codeset translator.
void char_translator (ACE_Char_Codeset_Translator *);
/// Set the wchar codeset translator.
void wchar_translator (ACE_WChar_Codeset_Translator *);
/// set the global size of serialized wchars. This may be different
/// than the size of a wchar_t.
static void wchar_maxbytes (size_t max_bytes);
/// access the serialized size of wchars.
static size_t wchar_maxbytes (void);
/**
* Return alignment of the wr_ptr(), with respect to the start of
* the CDR stream. This is not the same as the alignment of
* current->wr_ptr()!
*/
size_t current_alignment (void) const;
void current_alignment (size_t current_alignment);
/**
* Returns (in @a buf) the next position in the buffer aligned to
* @a size, it advances the Message_Block wr_ptr past the data
@@ -450,57 +400,45 @@ public:
*/
int adjust (size_t size,
char *&buf);
/// As above, but now the size and alignment requirements may be
/// different.
int adjust (size_t size,
size_t align,
char *&buf);
/// Returns true if this stream is writing in non-native byte order
/// and false otherwise. For example, it would be true if either
/// ACE_ENABLE_SWAP_ON_WRITE is defined or a specific byte order was
/// specified for this stream.
bool do_byte_swap (void) const;
/// Returns the byte order this stream is marshaling data in. Will be one
/// of the values in ACE_CDR::Byte_Order.
int byte_order (void) const;
/// For use by a gateway, which creates the output stream for the
/// reply to the client in its native byte order, but which must
/// send the reply in the byte order of the target's reply to the
/// gateway.
void reset_byte_order (int byte_order);
/// set GIOP version info
void set_version (ACE_CDR::Octet major, ACE_CDR::Octet minor);
/// Set the underlying GIOP version..
void get_version (ACE_CDR::Octet &major, ACE_CDR::Octet &minor);
#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1)
/// Register and unregister our buffer size monitor.
void register_monitor (const char* id);
void unregister_monitor (void);
#endif /* ACE_HAS_MONITOR_POINTS==1 */
private:
// Find the message block in the chain of message blocks
// that the provide location locates.
ACE_Message_Block* find (char* loc);
/// disallow copying...
ACE_OutputCDR (const ACE_OutputCDR& rhs);
ACE_OutputCDR& operator= (const ACE_OutputCDR& rhs);
ACE_CDR::Boolean write_1 (const ACE_CDR::Octet *x);
ACE_CDR::Boolean write_2 (const ACE_CDR::UShort *x);
ACE_CDR::Boolean write_4 (const ACE_CDR::ULong *x);
ACE_CDR::Boolean write_8 (const ACE_CDR::ULongLong *x);
ACE_CDR::Boolean write_16 (const ACE_CDR::LongDouble *x);
/**
* write an array of @a length elements, each of @a size bytes and the
* start aligned at a multiple of <align>. The elements are assumed
@@ -518,11 +456,9 @@ private:
size_t align,
ACE_CDR::ULong length);
ACE_CDR::Boolean write_wchar_array_i (const ACE_CDR::WChar* x,
ACE_CDR::ULong length);
/**
* Grow the CDR stream. When it returns @a buf contains a pointer to
* memory in the CDR stream, with at least @a size bytes ahead of it
@@ -532,14 +468,11 @@ private:
int grow_and_adjust (size_t size,
size_t align,
char *&buf);
private:
/// The start of the chain of message blocks.
ACE_Message_Block start_;
/// The current block in the chain where we are writing.
ACE_Message_Block *current_;
#if !defined (ACE_LACKS_CDR_ALIGNMENT)
/**
* The current alignment as measured from the start of the buffer.
@@ -551,7 +484,6 @@ private:
*/
size_t current_alignment_;
#endif /* ACE_LACKS_CDR_ALIGNMENT */
/**
* Is the current block writable. When we steal a buffer from the
* user and just chain it into the message block we are not supposed
@@ -559,7 +491,6 @@ private:
* buffer.
*/
bool current_is_writable_;
/**
* If not zero swap bytes at writing so the created CDR stream byte
* order does *not* match the machine byte order. The motivation
@@ -570,26 +501,20 @@ private:
* USE AT YOUR OWN RISK
*/
bool do_byte_swap_;
/// Set to false when an error ocurrs.
bool good_bit_;
/// Break-even point for copying.
size_t const memcpy_tradeoff_;
#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1)
ACE::Monitor_Control::Size_Monitor *monitor_;
#endif /* ACE_HAS_MONITOR_POINTS==1 */
protected:
/// GIOP version information
ACE_CDR::Octet major_version_;
ACE_CDR::Octet minor_version_;
/// If not nil, invoke for translation of character and string data.
ACE_Char_Codeset_Translator *char_translator_;
ACE_WChar_Codeset_Translator *wchar_translator_;
/**
* Some wide char codesets may be defined with a maximum number
* of bytes that is smaller than the size of a wchar_t. This means
@@ -602,9 +527,7 @@ protected:
static size_t wchar_maxbytes_;
};
// ****************************************************************
/**
* @class ACE_InputCDR
*
@@ -627,7 +550,6 @@ public:
// arrays and such.
friend class ACE_Char_Codeset_Translator;
friend class ACE_WChar_Codeset_Translator;
/**
* Create an input stream from an arbitrary buffer. The buffer must
* be properly aligned because this contructor will *not* work if
@@ -640,14 +562,12 @@ public:
int byte_order = ACE_CDR::BYTE_ORDER_NATIVE,
ACE_CDR::Octet major_version = ACE_CDR_GIOP_MAJOR_VERSION,
ACE_CDR::Octet minor_version = ACE_CDR_GIOP_MINOR_VERSION);
/// Create an empty input stream. The caller is responsible for
/// putting the right data and providing the right alignment.
ACE_InputCDR (size_t bufsiz,
int byte_order = ACE_CDR::BYTE_ORDER_NATIVE,
ACE_CDR::Octet major_version = ACE_CDR_GIOP_MAJOR_VERSION,
ACE_CDR::Octet minor_version = ACE_CDR_GIOP_MINOR_VERSION);
/// Create an input stream from an ACE_Message_Block
/**
* The alignment of the @a data block is carried into the new
@@ -661,7 +581,6 @@ public:
ACE_CDR::Octet major_version = ACE_CDR_GIOP_MAJOR_VERSION,
ACE_CDR::Octet minor_version = ACE_CDR_GIOP_MINOR_VERSION,
ACE_Lock* lock = 0);
/// Create an input stream from an ACE_Data_Block. The <flag>
/// indicates whether the <data> can be deleted by the CDR stream
/// or not
@@ -670,7 +589,6 @@ public:
int byte_order = ACE_CDR::BYTE_ORDER_NATIVE,
ACE_CDR::Octet major_version = ACE_CDR_GIOP_MAJOR_VERSION,
ACE_CDR::Octet minor_version = ACE_CDR_GIOP_MINOR_VERSION);
/// Create an input stream from an ACE_Data_Block. It also sets the
/// read and write pointers at the desired positions. This would be
/// helpful if the applications desires to create a new CDR stream
@@ -682,76 +600,62 @@ public:
int byte_order = ACE_CDR::BYTE_ORDER_NATIVE,
ACE_CDR::Octet major_version = ACE_CDR_GIOP_MAJOR_VERSION,
ACE_CDR::Octet minor_version = ACE_CDR_GIOP_MINOR_VERSION);
/**
* These make a copy of the current stream state, but do not copy
* the internal buffer, so the same stream can be read multiple
* times efficiently.
*/
ACE_InputCDR (const ACE_InputCDR& rhs);
ACE_InputCDR& operator= (const ACE_InputCDR& rhs);
/// When interpreting indirected TypeCodes it is useful to make a
/// "copy" of the stream starting in the new position.
ACE_InputCDR (const ACE_InputCDR& rhs,
size_t size,
ACE_CDR::Long offset);
/// This creates an encapsulated stream, the first byte must be (per
/// the spec) the byte order of the encapsulation.
ACE_InputCDR (const ACE_InputCDR& rhs,
size_t size);
/// Create an input CDR from an output CDR.
ACE_InputCDR (const ACE_OutputCDR& rhs,
ACE_Allocator* buffer_allocator = 0,
ACE_Allocator* data_block_allocator = 0,
ACE_Allocator* message_block_allocator = 0);
/// Helper class to transfer the contents from one input CDR to
/// another without requiring any extra memory allocations, data
/// copies or too many temporaries.
struct ACE_Export Transfer_Contents
{
Transfer_Contents (ACE_InputCDR &rhs);
ACE_InputCDR &rhs_;
};
/// Transfer the contents from <rhs> to a new CDR
ACE_InputCDR (Transfer_Contents rhs);
/// Destructor
~ACE_InputCDR (void);
/// Disambiguate overloading when extracting octets, chars,
/// booleans, and bounded strings
//@{ @name Helper classes
struct ACE_Export to_boolean
{
explicit to_boolean (ACE_CDR::Boolean &b);
ACE_CDR::Boolean &ref_;
};
struct ACE_Export to_char
{
explicit to_char (ACE_CDR::Char &c);
ACE_CDR::Char &ref_;
};
struct ACE_Export to_wchar
{
explicit to_wchar (ACE_CDR::WChar &wc);
ACE_CDR::WChar &ref_;
};
struct ACE_Export to_octet
{
explicit to_octet (ACE_CDR::Octet &o);
ACE_CDR::Octet &ref_;
};
struct ACE_Export to_string
{
/**
@@ -766,7 +670,6 @@ public:
const ACE_CDR::Char *&val_;
ACE_CDR::ULong bound_;
};
struct ACE_Export to_wstring
{
/// The constructor taking a non-const wstring is
@@ -780,7 +683,6 @@ public:
ACE_CDR::ULong bound_;
};
//@}
/**
* Return @c false on failure and @c true on success.
*/
@@ -798,12 +700,10 @@ public:
ACE_CDR::Boolean read_float (ACE_CDR::Float &x);
ACE_CDR::Boolean read_double (ACE_CDR::Double &x);
ACE_CDR::Boolean read_longdouble (ACE_CDR::LongDouble &x);
ACE_CDR::Boolean read_string (ACE_CDR::Char *&x);
ACE_CDR::Boolean read_string (ACE_CString &x);
ACE_CDR::Boolean read_wstring (ACE_CDR::WChar*& x);
//@}
/**
* The buffer @a x must be large enough to contain @a length
* elements.
@@ -837,7 +737,6 @@ public:
ACE_CDR::Boolean read_longdouble_array (ACE_CDR::LongDouble* x,
ACE_CDR::ULong length);
//@}
/**
* Return @c false on failure and @c true on success.
*/
@@ -856,7 +755,6 @@ public:
ACE_CDR::Boolean skip_double (void);
ACE_CDR::Boolean skip_longdouble (void);
//@}
/**
* The next field must be a string, this method skips it. It is
* useful in parsing a TypeCode.
@@ -864,16 +762,13 @@ public:
*/
ACE_CDR::Boolean skip_wstring (void);
ACE_CDR::Boolean skip_string (void);
/// Skip @a n bytes in the CDR stream.
/**
* @return @c false on failure and @c true on success.
*/
ACE_CDR::Boolean skip_bytes (size_t n);
/// returns @c false if a problem has been detected.
bool good_bit (void) const;
/**
* @return The start of the message block chain for this CDR
* stream.
@@ -882,43 +777,35 @@ public:
* we are planning to change that.
*/
const ACE_Message_Block* start (void) const;
// = The following functions are useful to read the contents of the
// CDR stream from a socket or file.
/**
* Grow the internal buffer, reset @c rd_ptr to the first byte in
* the new buffer that is properly aligned, and set @c wr_ptr to @c
* rd_ptr @c + @c newsize
*/
int grow (size_t newsize);
/**
* After reading and partially parsing the contents the user can
* detect a change in the byte order, this method will let him/her
* change it.
*/
void reset_byte_order (int byte_order);
/// Re-initialize the CDR stream, copying the contents of the chain
/// of message_blocks starting from @a data.
void reset (const ACE_Message_Block *data,
int byte_order);
/// Steal the contents from the current CDR.
ACE_Message_Block *steal_contents (void);
/// Steal the contents of @a cdr and make a shallow copy into this
/// stream.
void steal_from (ACE_InputCDR &cdr);
/// Exchange data blocks with the caller of this method. The read
/// and write pointers are also exchanged.
/**
* @note We now do only with the start_ message block.
*/
void exchange_data_blocks (ACE_InputCDR &cdr);
/// Copy the data portion from the @c cdr to this cdr and return the
/// data content (ie. the ACE_Data_Block) from this CDR to the
/// caller.
@@ -927,20 +814,15 @@ public:
* returned ACE_Data_Block.
*/
ACE_Data_Block* clone_from (ACE_InputCDR &cdr);
/// Re-initialize the CDR stream, forgetting about the old contents
/// of the stream and allocating a new buffer (from the allocators).
void reset_contents (void);
/// Returns the current position for the @c rd_ptr.
char* rd_ptr (void);
/// Returns the current position for the @c wr_ptr.
char* wr_ptr (void);
/// Return how many bytes are left in the stream.
size_t length (void) const;
/**
* Utility function to allow the user more flexibility.
* Skips up to the nearest @a alignment-byte boundary.
@@ -949,23 +831,18 @@ public:
* @return 0 on success and -1 on failure.
*/
int align_read_ptr (size_t alignment);
/// If @c true then this stream is writing in non-native byte order.
/// This is only meaningful if ACE_ENABLE_SWAP_ON_WRITE is defined.
bool do_byte_swap (void) const;
/// If @c do_byte_swap() returns @c false, this returns
/// ACE_CDR_BYTE_ORDER else it returns !ACE_CDR_BYTE_ORDER.
int byte_order (void) const;
/// Access the codeset translators. They can be nil!
ACE_Char_Codeset_Translator *char_translator (void) const;
ACE_WChar_Codeset_Translator *wchar_translator (void) const;
/// Set the codeset translators.
void char_translator (ACE_Char_Codeset_Translator *);
void wchar_translator (ACE_WChar_Codeset_Translator *);
/**
* Returns (in @a buf) the next position in the buffer aligned to
* @a size. It advances the Message_Block @c rd_ptr past the data
@@ -974,65 +851,50 @@ public:
*/
int adjust (size_t size,
char *&buf);
/// As above, but now the size and alignment requirements may be
/// different.
int adjust (size_t size,
size_t align,
char *&buf);
/// Set the underlying GIOP version..
void set_version (ACE_CDR::Octet major, ACE_CDR::Octet minor);
/// Set the underlying GIOP version..
void get_version (ACE_CDR::Octet &major, ACE_CDR::Octet &minor);
#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1)
/// Register and unregister our buffer size monitor.
void register_monitor (const char* id);
void unregister_monitor (void);
#endif /* ACE_HAS_MONITOR_POINTS==1 */
protected:
/// The start of the chain of message blocks, even though in the
/// current version the chain always has length 1.
ACE_Message_Block start_;
/// The CDR stream byte order does not match the one on the machine,
/// swapping is needed while reading.
bool do_byte_swap_;
/// set to @c false when an error occurs.
bool good_bit_;
/// The GIOP versions for this stream
ACE_CDR::Octet major_version_;
ACE_CDR::Octet minor_version_;
/// If not nil, invoke for translation of character and string data.
ACE_Char_Codeset_Translator *char_translator_;
ACE_WChar_Codeset_Translator *wchar_translator_;
#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1)
ACE::Monitor_Control::Size_Monitor *monitor_;
#endif /* ACE_HAS_MONITOR_POINTS==1 */
private:
ACE_CDR::Boolean read_1 (ACE_CDR::Octet *x);
ACE_CDR::Boolean read_2 (ACE_CDR::UShort *x);
ACE_CDR::Boolean read_4 (ACE_CDR::ULong *x);
ACE_CDR::Boolean read_8 (ACE_CDR::ULongLong *x);
ACE_CDR::Boolean read_16 (ACE_CDR::LongDouble *x);
// Several types can be read using the same routines, since TAO
// tries to use native types with known size for each CORBA type.
// We could use void* or char* to make the interface more
// consistent, but using native types let us exploit the strict
// alignment requirements of CDR streams and implement the
// operations using asignment.
/**
* Read an array of @a length elements, each of @a size bytes and the
* start aligned at a multiple of <align>. The elements are assumed
@@ -1049,7 +911,6 @@ private:
size_t size,
size_t align,
ACE_CDR::ULong length);
/**
* On those occasions when the native codeset for wchar is smaller than
* the size of a wchar_t, such as using UTF-16 with a 4-byte wchar_t, a
@@ -1058,16 +919,12 @@ private:
*/
ACE_CDR::Boolean read_wchar_array_i (ACE_CDR::WChar * x,
ACE_CDR::ULong length);
/// Move the rd_ptr ahead by @a offset bytes.
void rd_ptr (size_t offset);
/// Points to the continuation field of the current message block.
char* end (void);
};
// ****************************************************************
/**
* @class ACE_Char_Codeset_Translator
*
@@ -1086,40 +943,33 @@ class ACE_Export ACE_Char_Codeset_Translator
{
public:
virtual ~ACE_Char_Codeset_Translator ();
/// Read a single character from the stream, converting from the
/// stream codeset to the native codeset
virtual ACE_CDR::Boolean read_char (ACE_InputCDR&,
ACE_CDR::Char&) = 0;
/// Read a string from the stream, including the length, converting
/// the characters from the stream codeset to the native codeset
virtual ACE_CDR::Boolean read_string (ACE_InputCDR&,
ACE_CDR::Char *&) = 0;
/// Read an array of characters from the stream, converting the
/// characters from the stream codeset to the native codeset.
virtual ACE_CDR::Boolean read_char_array (ACE_InputCDR&,
ACE_CDR::Char*,
ACE_CDR::ULong) = 0;
/// Write a single character to the stream, converting from the
/// native codeset to the stream codeset
virtual ACE_CDR::Boolean write_char (ACE_OutputCDR&,
ACE_CDR::Char) = 0;
/// Write a string to the stream, including the length, converting
/// from the native codeset to the stream codeset
virtual ACE_CDR::Boolean write_string (ACE_OutputCDR&,
ACE_CDR::ULong,
const ACE_CDR::Char*) = 0;
/// Write an array of characters to the stream, converting from the
/// native codeset to the stream codeset
virtual ACE_CDR::Boolean write_char_array (ACE_OutputCDR&,
const ACE_CDR::Char*,
ACE_CDR::ULong) = 0;
virtual ACE_CDR::ULong ncs () = 0;
virtual ACE_CDR::ULong tcs () = 0;
protected:
@@ -1129,7 +979,6 @@ protected:
ACE_CDR::Octet *x);
ACE_CDR::Boolean write_1 (ACE_OutputCDR& output,
const ACE_CDR::Octet *x);
/// Efficiently read @a length elements of size @a size each from
/// <input> into <x>; the data must be aligned to <align>.
ACE_CDR::Boolean read_array (ACE_InputCDR& input,
@@ -1137,7 +986,6 @@ protected:
size_t size,
size_t align,
ACE_CDR::ULong length);
/**
* Efficiently write @a length elements of size @a size from <x> into
* <output>. Before inserting the elements enough padding is added
@@ -1149,7 +997,6 @@ protected:
size_t size,
size_t align,
ACE_CDR::ULong length);
/**
* Exposes the stream implementation of <adjust>, this is useful in
* many cases to minimize memory allocations during marshaling.
@@ -1161,19 +1008,15 @@ protected:
size_t size,
size_t align,
char *&buf);
/// Used by derived classes to set errors in the CDR stream.
void good_bit (ACE_OutputCDR& out, bool bit);
/// Obtain the CDR Stream's major & minor version values.
ACE_CDR::Octet major_version (ACE_InputCDR& input);
ACE_CDR::Octet minor_version (ACE_InputCDR& input);
ACE_CDR::Octet major_version (ACE_OutputCDR& output);
ACE_CDR::Octet minor_version (ACE_OutputCDR& output);
};
// ****************************************************************
/**
* @class ACE_WChar_Codeset_Translator
*
@@ -1188,7 +1031,6 @@ class ACE_Export ACE_WChar_Codeset_Translator
{
public:
virtual ~ACE_WChar_Codeset_Translator ();
virtual ACE_CDR::Boolean read_wchar (ACE_InputCDR&,
ACE_CDR::WChar&) = 0;
virtual ACE_CDR::Boolean read_wstring (ACE_InputCDR&,
@@ -1204,7 +1046,6 @@ public:
virtual ACE_CDR::Boolean write_wchar_array (ACE_OutputCDR&,
const ACE_CDR::WChar*,
ACE_CDR::ULong) = 0;
virtual ACE_CDR::ULong ncs () = 0;
virtual ACE_CDR::ULong tcs () = 0;
protected:
@@ -1222,7 +1063,6 @@ protected:
const ACE_CDR::UShort *x);
ACE_CDR::Boolean write_4 (ACE_OutputCDR& output,
const ACE_CDR::ULong *x);
/// Efficiently read @a length elements of size @a size each from
/// <input> into <x>; the data must be aligned to <align>.
ACE_CDR::Boolean read_array (ACE_InputCDR& input,
@@ -1230,7 +1070,6 @@ protected:
size_t size,
size_t align,
ACE_CDR::ULong length);
/**
* Efficiently write @a length elements of size @a size from <x> into
* <output>. Before inserting the elements enough padding is added
@@ -1242,7 +1081,6 @@ protected:
size_t size,
size_t align,
ACE_CDR::ULong length);
/**
* Exposes the stream implementation of <adjust>, this is useful in
* many cases to minimize memory allocations during marshaling.
@@ -1254,40 +1092,30 @@ protected:
size_t size,
size_t align,
char *&buf);
/// Used by derived classes to set errors in the CDR stream.
void good_bit (ACE_OutputCDR& out, bool bit);
/// Obtain the CDR Stream's major & minor version values.
ACE_CDR::Octet major_version (ACE_InputCDR& input);
ACE_CDR::Octet minor_version (ACE_InputCDR& input);
ACE_CDR::Octet major_version (ACE_OutputCDR& output);
ACE_CDR::Octet minor_version (ACE_OutputCDR& output);
};
// @@ These operators should not be inlined since they force SString.h
// to be included in this header.
extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os,
const ACE_CString &x);
extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is,
ACE_CString &x);
ACE_END_VERSIONED_NAMESPACE_DECL
#if defined (__ACE_INLINE__)
# include "ace/CDR_Stream.inl"
#else /* __ACE_INLINE__ */
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
// Not used by CORBA or TAO
extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os,
ACE_CDR::Char x);
// CDR output operators for primitive types
extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os,
ACE_CDR::Short x);
extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os,
@@ -1306,9 +1134,7 @@ extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os,
ACE_CDR::Float x);
extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os,
ACE_CDR::Double x);
// CDR output operator from helper classes
extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os,
ACE_OutputCDR::from_boolean x);
extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os,
@@ -1325,12 +1151,10 @@ extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os,
const ACE_CDR::Char* x);
extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os,
const ACE_CDR::WChar* x);
// Not used by CORBA or TAO
extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is,
ACE_CDR::Char &x);
// CDR input operators for primitive types
extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is,
ACE_CDR::Short &x);
extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is,
@@ -1349,9 +1173,7 @@ extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is,
ACE_CDR::Float &x);
extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is,
ACE_CDR::Double &x);
// CDR input operator from helper classes
extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is,
ACE_InputCDR::to_boolean x);
extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is,
@@ -1368,36 +1190,23 @@ extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is,
ACE_CDR::Char*& x);
extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is,
ACE_CDR::WChar*& x);
ACE_END_VERSIONED_NAMESPACE_DECL
#endif /* __ACE_INLINE__ */
#if defined (GEN_OSTREAM_OPS)
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
// ostream insertion operators for debugging code generated from IDL. All
// but these below are either in generated code itself or are unambiguous
// primitive types.
ACE_Export std::ostream& operator<< (std::ostream &os,
ACE_OutputCDR::from_boolean x);
ACE_Export std::ostream& operator<< (std::ostream &os,
ACE_OutputCDR::from_char x);
ACE_Export std::ostream& operator<< (std::ostream &os,
ACE_OutputCDR::from_wchar x);
ACE_Export std::ostream& operator<< (std::ostream &os,
ACE_OutputCDR::from_octet x);
ACE_END_VERSIONED_NAMESPACE_DECL
#endif /* GEN_OSTREAM_OPS */
#include /**/ "ace/post.h"
#endif /* ACE_CDR_STREAM_H */