summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcoryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-06-05 18:02:01 +0000
committercoryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-06-05 18:02:01 +0000
commit4b900b2b089d066475a641adf6ea4974741df551 (patch)
tree505a705b5fca487e29bbf4f56788fe4acbf42ade
parent8de1b7083bf71644135ce9a43c12e9b7812d7269 (diff)
downloadATCD-4b900b2b089d066475a641adf6ea4974741df551.tar.gz
ChangeLogTag:Sat Jun 5 13:00:46 1999 Carlos O'Ryan <coryan@cs.wustl.edu>
-rw-r--r--ChangeLog-99b8
-rw-r--r--ace/CDR_Stream.cpp13
-rw-r--r--ace/CDR_Stream.h37
-rw-r--r--ace/CDR_Stream.i6
4 files changed, 47 insertions, 17 deletions
diff --git a/ChangeLog-99b b/ChangeLog-99b
index fd4a60861e4..c88e719b01c 100644
--- a/ChangeLog-99b
+++ b/ChangeLog-99b
@@ -1,3 +1,11 @@
+Sat Jun 5 13:00:46 1999 Carlos O'Ryan <coryan@cs.wustl.edu>
+
+ * ace/CDR_Stream.h:
+ * ace/CDR_Stream.i:
+ * ace/CDR_Stream.cpp:
+ New methods added to the InputCDR class to simplify the process
+ of reading a buffer from a socket or file.
+
Fri Jun 4 23:52:19 1999 Carlos O'Ryan <coryan@cs.wustl.edu>
* ace/CDR_Stream.h:
diff --git a/ace/CDR_Stream.cpp b/ace/CDR_Stream.cpp
index 7a9583df54f..990ccd91323 100644
--- a/ace/CDR_Stream.cpp
+++ b/ace/CDR_Stream.cpp
@@ -992,3 +992,16 @@ ACE_InputCDR::skip_bytes (size_t len)
this->good_bit_ = 0;
return 0;
}
+
+
+
+int
+ACE_InputCDR::grow (size_t newsize)
+{
+ if (ACE_CDR::grow (&this->start_, newsize) == -1)
+ return -1;
+
+ ACE_CDR::mb_align (&this->start_);
+ this->start_.wr_ptr (newsize);
+ return 0;
+}
diff --git a/ace/CDR_Stream.h b/ace/CDR_Stream.h
index 5f9830ee40a..aea71014629 100644
--- a/ace/CDR_Stream.h
+++ b/ace/CDR_Stream.h
@@ -245,11 +245,6 @@ class ACE_Export ACE_OutputCDR
// + Operations return an error status, because exceptions are
// not widely available in C++ (yet).
//
- // A particularly useful static member function for this buffer is
- // an interpretive encoding routine, usable as a typecode
- // interpreter callback. Ditto for decoding. These are used to
- // support all OMG-IDL datatypes, even those not supported
- // directly by put/get primitives.
public:
friend class ACE_Char_Codeset_Translator;
friend class ACE_WChar_Codeset_Translator;
@@ -535,11 +530,6 @@ class ACE_Export ACE_InputCDR
// + Operations return an error status, because exceptions are
// not widely available in C++ (yet).
//
- // A particularly useful static member function for this buffer is
- // an interpretive encoding routine, usable as a typecode
- // interpreter callback. Ditto for decoding. These are used to
- // support all OMG-IDL datatypes, even those not supported
- // directly by put/get primitives.
public:
friend class ACE_Char_Codeset_Translator;
friend class ACE_WChar_Codeset_Translator;
@@ -710,6 +700,19 @@ public:
// NOTE: In the current implementation the chain has length 1, but
// we are planning to change that.
+ // = The following functions are useful to read the contents of the
+ // CDR stream from a socket or file.
+
+ int grow (size_t newsize);
+ // Grow the internal buffer, reset rd_ptr() to the first byte in the
+ // new buffer that is properly aligned, and set wr_ptr() to
+ // rd_ptr() + newsize
+
+ void reset_byte_order (int byte_order);
+ // After reading and partially parsing the contents the user can
+ // detect a change in the byte order, this method will let him
+ // change it.
+
char* rd_ptr (void);
// Returns the current position for the rd_ptr....
@@ -800,8 +803,8 @@ class ACE_Export ACE_Char_Codeset_Translator
// CDR streams.
//
// = DESCRIPTION
- // This class is a base class for defining codeset translation
- // routines to handle the character set translations required by
+ // This class is a base class for defining codeset translation
+ // routines to handle the character set translations required by
// both CDR Input streams and CDR Output streams.
//
public:
@@ -819,7 +822,7 @@ public:
ACE_CDR::Char*,
ACE_CDR::ULong) = 0;
// Read an array of characters from the stream, converting the
- // characters from the stream codeset to the native codeset.
+ // characters from the stream codeset to the native codeset.
virtual ACE_CDR::Boolean write_char (ACE_OutputCDR&,
ACE_CDR::Char) = 0;
@@ -872,7 +875,7 @@ protected:
// many cases to minimize memory allocations during marshaling.
// On success <buf> will contain a contiguous area in the CDR stream
// that can hold <size> bytes aligned to <align>.
- // Results
+ // Results
void good_bit (ACE_OutputCDR& out, int bit);
// Used by derived classes to set errors in the CDR stream.
@@ -887,8 +890,8 @@ class ACE_Export ACE_WChar_Codeset_Translator
// CDR streams.
//
// = DESCRIPTION
- // This class is a base class for defining codeset translation
- // routines to handle the character set translations required by
+ // This class is a base class for defining codeset translation
+ // routines to handle the character set translations required by
// both CDR Input streams and CDR Output streams.
//
public:
@@ -950,7 +953,7 @@ protected:
// many cases to minimize memory allocations during marshaling.
// On success <buf> will contain a contiguous area in the CDR stream
// that can hold <size> bytes aligned to <align>.
- // Results
+ // Results
void good_bit (ACE_OutputCDR& out, int bit);
// Used by derived classes to set errors in the CDR stream.
diff --git a/ace/CDR_Stream.i b/ace/CDR_Stream.i
index 1e59fe038c4..1f5a9b8faaf 100644
--- a/ace/CDR_Stream.i
+++ b/ace/CDR_Stream.i
@@ -1202,6 +1202,12 @@ ACE_OutputCDR::append_wstring (ACE_InputCDR &stream)
return flag;
}
+ACE_INLINE void
+ACE_InputCDR::reset_byte_order (int byte_order)
+{
+ this->do_byte_swap_ = (byte_order != ACE_CDR_BYTE_ORDER);
+}
+
ACE_INLINE int
ACE_InputCDR::do_byte_swap (void) const
{