summaryrefslogtreecommitdiff
path: root/ACE/ace/CDR_Stream.cpp
diff options
context:
space:
mode:
authorJohnny Willemsen <jwillemsen@remedy.nl>2008-05-09 12:05:34 +0000
committerJohnny Willemsen <jwillemsen@remedy.nl>2008-05-09 12:05:34 +0000
commit6895fd20790056373d17003a96395932eb7f1249 (patch)
treea5bc4d4b3354f059d997f0718fa3f7774333409f /ACE/ace/CDR_Stream.cpp
parent0c009665908d617d2dcde99c1edcbe98a47af4b9 (diff)
downloadATCD-6895fd20790056373d17003a96395932eb7f1249.tar.gz
Fri May 9 12:04:15 UTC 2008 J.T. Conklin <jtc@acorntoolworks.com>
Diffstat (limited to 'ACE/ace/CDR_Stream.cpp')
-rw-r--r--ACE/ace/CDR_Stream.cpp195
1 files changed, 179 insertions, 16 deletions
diff --git a/ACE/ace/CDR_Stream.cpp b/ACE/ace/CDR_Stream.cpp
index ee2a83f987f..954f58642f5 100644
--- a/ACE/ace/CDR_Stream.cpp
+++ b/ACE/ace/CDR_Stream.cpp
@@ -2,6 +2,10 @@
#include "ace/SString.h"
#include "ace/Auto_Ptr.h"
+#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1)
+#include "Monitor_Size.h"
+#endif /* ACE_HAS_MONITOR_POINTS==1 */
+
#if !defined (__ACE_INLINE__)
# include "ace/CDR_Stream.inl"
#endif /* ! __ACE_INLINE__ */
@@ -50,6 +54,12 @@ ACE_OutputCDR::ACE_OutputCDR (size_t size,
{
ACE_CDR::mb_align (&this->start_);
this->current_ = &this->start_;
+
+#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1)
+ ACE_NEW (this->monitor_,
+ ACE::MonitorControl::Size_Monitor);
+ this->monitor_->receive (this->total_length ());
+#endif /* ACE_HAS_MONITOR_POINTS==1 */
}
ACE_OutputCDR::ACE_OutputCDR (char *data,
@@ -87,6 +97,12 @@ ACE_OutputCDR::ACE_OutputCDR (char *data,
// We cannot trust the buffer to be properly aligned
ACE_CDR::mb_align (&this->start_);
this->current_ = &this->start_;
+
+#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1)
+ ACE_NEW (this->monitor_,
+ ACE::MonitorControl::Size_Monitor);
+ this->monitor_->receive (this->total_length ());
+#endif /* ACE_HAS_MONITOR_POINTS==1 */
}
ACE_OutputCDR::ACE_OutputCDR (ACE_Data_Block *data_block,
@@ -113,6 +129,12 @@ ACE_OutputCDR::ACE_OutputCDR (ACE_Data_Block *data_block,
// We cannot trust the buffer to be properly aligned
ACE_CDR::mb_align (&this->start_);
this->current_ = &this->start_;
+
+#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1)
+ ACE_NEW (this->monitor_,
+ ACE::MonitorControl::Size_Monitor);
+ this->monitor_->receive (this->total_length ());
+#endif /* ACE_HAS_MONITOR_POINTS==1 */
}
ACE_OutputCDR::ACE_OutputCDR (ACE_Message_Block *data,
@@ -136,6 +158,12 @@ ACE_OutputCDR::ACE_OutputCDR (ACE_Message_Block *data,
// We cannot trust the buffer to be properly aligned
ACE_CDR::mb_align (&this->start_);
this->current_ = &this->start_;
+
+#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1)
+ ACE_NEW (this->monitor_,
+ ACE::MonitorControl::Size_Monitor);
+ this->monitor_->receive (this->total_length ());
+#endif /* ACE_HAS_MONITOR_POINTS==1 */
}
/*static*/ void
@@ -669,7 +697,7 @@ ACE_OutputCDR::write_boolean_array (const ACE_CDR::Boolean* x,
return this->good_bit ();
}
-
+
char *
ACE_OutputCDR::write_long_placeholder (void)
{
@@ -800,6 +828,22 @@ ACE_OutputCDR::find (char* loc)
return mb;
}
+#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1)
+
+void
+ACE_OutputCDR::register_monitor (const char *id)
+{
+ this->monitor_->name (id);
+ this->monitor_->add_to_registry ();
+}
+
+void
+ACE_OutputCDR::unregister_monitor (void)
+{
+ this->monitor_->remove_from_registry ();
+}
+
+#endif /* ACE_HAS_MONITOR_POINTS==1 */
// ****************************************************************
@@ -817,6 +861,12 @@ ACE_InputCDR::ACE_InputCDR (const char *buf,
wchar_translator_ (0)
{
this->start_.wr_ptr (bufsiz);
+
+#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1)
+ ACE_NEW (this->monitor_,
+ ACE::MonitorControl::Size_Monitor);
+ this->monitor_->receive (bufsiz);
+#endif /* ACE_HAS_MONITOR_POINTS==1 */
}
ACE_InputCDR::ACE_InputCDR (size_t bufsiz,
@@ -831,6 +881,11 @@ ACE_InputCDR::ACE_InputCDR (size_t bufsiz,
char_translator_ (0),
wchar_translator_ (0)
{
+#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1)
+ ACE_NEW (this->monitor_,
+ ACE::MonitorControl::Size_Monitor);
+ this->monitor_->receive (bufsiz);
+#endif /* ACE_HAS_MONITOR_POINTS==1 */
}
ACE_InputCDR::ACE_InputCDR (const ACE_Message_Block *data,
@@ -838,14 +893,19 @@ ACE_InputCDR::ACE_InputCDR (const ACE_Message_Block *data,
ACE_CDR::Octet major_version,
ACE_CDR::Octet minor_version,
ACE_Lock* lock)
-: start_ (0, ACE_Message_Block::MB_DATA, 0, 0, 0, lock),
+ : start_ (0, ACE_Message_Block::MB_DATA, 0, 0, 0, lock),
good_bit_ (true),
major_version_ (major_version),
minor_version_ (minor_version),
char_translator_ (0),
wchar_translator_ (0)
-
{
+#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1)
+ ACE_NEW (this->monitor_,
+ ACE::MonitorControl::Size_Monitor);
+ this->monitor_->receive (this->start_.total_size ());
+#endif /* ACE_HAS_MONITOR_POINTS==1 */
+
this->reset (data, byte_order);
}
@@ -861,8 +921,12 @@ ACE_InputCDR::ACE_InputCDR (ACE_Data_Block *data,
minor_version_ (minor_version),
char_translator_ (0),
wchar_translator_ (0)
-
{
+#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1)
+ ACE_NEW (this->monitor_,
+ ACE::MonitorControl::Size_Monitor);
+ this->monitor_->receive (data->size ());
+#endif /* ACE_HAS_MONITOR_POINTS==1 */
}
ACE_InputCDR::ACE_InputCDR (ACE_Data_Block *data,
@@ -879,7 +943,6 @@ ACE_InputCDR::ACE_InputCDR (ACE_Data_Block *data,
minor_version_ (minor_version),
char_translator_ (0),
wchar_translator_ (0)
-
{
// Set the read pointer
this->start_.rd_ptr (rd_pos);
@@ -891,8 +954,13 @@ ACE_InputCDR::ACE_InputCDR (ACE_Data_Block *data,
{
this->start_.wr_ptr (wr_pos);
}
-}
+#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1)
+ ACE_NEW (this->monitor_,
+ ACE::MonitorControl::Size_Monitor);
+ this->monitor_->receive (data->size ());
+#endif /* ACE_HAS_MONITOR_POINTS==1 */
+}
ACE_InputCDR::ACE_InputCDR (const ACE_InputCDR& rhs,
size_t size,
@@ -905,7 +973,6 @@ ACE_InputCDR::ACE_InputCDR (const ACE_InputCDR& rhs,
minor_version_ (rhs.minor_version_),
char_translator_ (rhs.char_translator_),
wchar_translator_ (rhs.wchar_translator_)
-
{
#if !defined (ACE_LACKS_CDR_ALIGNMENT)
// Align the base pointer assuming that the incoming stream is also
@@ -926,7 +993,15 @@ ACE_InputCDR::ACE_InputCDR (const ACE_InputCDR& rhs,
this->start_.wr_ptr (newpos + size);
}
else
- this->good_bit_ = false;
+ {
+ this->good_bit_ = false;
+ }
+
+#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1)
+ ACE_NEW (this->monitor_,
+ ACE::MonitorControl::Size_Monitor);
+ this->monitor_->receive (this->start_.total_size ());
+#endif /* ACE_HAS_MONITOR_POINTS==1 */
}
ACE_InputCDR::ACE_InputCDR (const ACE_InputCDR& rhs,
@@ -939,7 +1014,6 @@ ACE_InputCDR::ACE_InputCDR (const ACE_InputCDR& rhs,
minor_version_ (rhs.minor_version_),
char_translator_ (rhs.char_translator_),
wchar_translator_ (rhs.wchar_translator_)
-
{
#if !defined (ACE_LACKS_CDR_ALIGNMENT)
// Align the base pointer assuming that the incoming stream is also
@@ -966,7 +1040,15 @@ ACE_InputCDR::ACE_InputCDR (const ACE_InputCDR& rhs,
this->do_byte_swap_ = (byte_order != ACE_CDR_BYTE_ORDER);
}
else
- this->good_bit_ = false;
+ {
+ this->good_bit_ = false;
+ }
+
+#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1)
+ ACE_NEW (this->monitor_,
+ ACE::MonitorControl::Size_Monitor);
+ this->monitor_->receive (this->start_.total_size ());
+#endif /* ACE_HAS_MONITOR_POINTS==1 */
}
ACE_InputCDR::ACE_InputCDR (const ACE_InputCDR& rhs)
@@ -990,6 +1072,12 @@ ACE_InputCDR::ACE_InputCDR (const ACE_InputCDR& rhs)
size_t wr_offset = rhs.start_.wr_ptr () - buf;
this->start_.rd_ptr (rd_offset);
this->start_.wr_ptr (wr_offset);
+
+#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1)
+ ACE_NEW (this->monitor_,
+ ACE::MonitorControl::Size_Monitor);
+ this->monitor_->receive (this->start_.total_size ());
+#endif /* ACE_HAS_MONITOR_POINTS==1 */
}
ACE_InputCDR::ACE_InputCDR (ACE_InputCDR::Transfer_Contents x)
@@ -1001,12 +1089,17 @@ ACE_InputCDR::ACE_InputCDR (ACE_InputCDR::Transfer_Contents x)
char_translator_ (x.rhs_.char_translator_),
wchar_translator_ (x.rhs_.wchar_translator_)
{
-
this->start_.rd_ptr (x.rhs_.start_.rd_ptr ());
this->start_.wr_ptr (x.rhs_.start_.wr_ptr ());
ACE_Data_Block* db = this->start_.data_block ()->clone_nocopy ();
(void) x.rhs_.start_.replace_data_block (db);
+
+#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1)
+ ACE_NEW (this->monitor_,
+ ACE::MonitorControl::Size_Monitor);
+ this->monitor_->receive (this->start_.total_size ());
+#endif /* ACE_HAS_MONITOR_POINTS==1 */
}
ACE_InputCDR&
@@ -1023,6 +1116,11 @@ ACE_InputCDR::operator= (const ACE_InputCDR& rhs)
this->major_version_ = rhs.major_version_;
this->minor_version_ = rhs.minor_version_;
}
+
+#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1)
+ this->monitor_->receive (this->start_.total_size ());
+#endif /* ACE_HAS_MONITOR_POINTS==1 */
+
return *this;
}
@@ -1052,7 +1150,15 @@ ACE_InputCDR::ACE_InputCDR (const ACE_OutputCDR& rhs,
for (const ACE_Message_Block *i = rhs.begin ();
i != rhs.end ();
i = i->cont ())
- this->start_.copy (i->rd_ptr (), i->length ());
+ {
+ this->start_.copy (i->rd_ptr (), i->length ());
+ }
+
+#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1)
+ ACE_NEW (this->monitor_,
+ ACE::MonitorControl::Size_Monitor);
+ this->monitor_->receive (this->start_.total_size ());
+#endif /* ACE_HAS_MONITOR_POINTS==1 */
}
ACE_CDR::Boolean
@@ -1620,6 +1726,14 @@ ACE_InputCDR::grow (size_t newsize)
ACE_CDR::mb_align (&this->start_);
this->start_.wr_ptr (newsize);
+
+#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1)
+ if (newsize > this->start_.total_size ())
+ {
+ this->monitor_->receive (newsize);
+ }
+#endif /* ACE_HAS_MONITOR_POINTS==1 */
+
return 0;
}
@@ -1629,6 +1743,10 @@ ACE_InputCDR::reset (const ACE_Message_Block* data,
{
this->reset_byte_order (byte_order);
ACE_CDR::consolidate (&this->start_, data);
+
+#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1)
+ this->monitor_->receive (this->start_.total_size ());
+#endif /* ACE_HAS_MONITOR_POINTS==1 */
}
void
@@ -1645,6 +1763,10 @@ ACE_InputCDR::steal_from (ACE_InputCDR &cdr)
this->major_version_ = cdr.major_version_;
this->minor_version_ = cdr.minor_version_;
cdr.reset_contents ();
+
+#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1)
+ this->monitor_->receive (this->start_.total_size ());
+#endif /* ACE_HAS_MONITOR_POINTS==1 */
}
void
@@ -1688,16 +1810,24 @@ ACE_InputCDR::exchange_data_blocks (ACE_InputCDR &cdr)
// Set the read and write pointers.
if (cdr.start_.size () >= srd_pos)
- cdr.start_.rd_ptr (srd_pos);
+ {
+ cdr.start_.rd_ptr (srd_pos);
+ }
if (cdr.start_.size () >= swr_pos)
- cdr.start_.wr_ptr (swr_pos);
+ {
+ cdr.start_.wr_ptr (swr_pos);
+ }
if (this->start_.size () >= drd_pos)
- this->start_.rd_ptr (drd_pos);
+ {
+ this->start_.rd_ptr (drd_pos);
+ }
if (this->start_.size () >= dwr_pos)
- this->start_.wr_ptr (dwr_pos);
+ {
+ this->start_.wr_ptr (dwr_pos);
+ }
ACE_CDR::Octet const dmajor = cdr.major_version_;
ACE_CDR::Octet const dminor = cdr.minor_version_;
@@ -1708,6 +1838,10 @@ ACE_InputCDR::exchange_data_blocks (ACE_InputCDR &cdr)
this->major_version_ = dmajor;
this->minor_version_ = dminor;
+
+#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1)
+ this->monitor_->receive (this->start_.total_size ());
+#endif /* ACE_HAS_MONITOR_POINTS==1 */
}
ACE_Data_Block *
@@ -1802,6 +1936,10 @@ ACE_InputCDR::clone_from (ACE_InputCDR &cdr)
this->char_translator_ = cdr.char_translator_;
this->wchar_translator_ = cdr.wchar_translator_;
+#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1)
+ this->monitor_->receive (this->start_.total_size ());
+#endif /* ACE_HAS_MONITOR_POINTS==1 */
+
return db;
}
@@ -1817,6 +1955,10 @@ ACE_InputCDR::steal_contents (void)
ACE_CDR::mb_align (&this->start_);
+#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1)
+ this->monitor_->receive (this->start_.total_size ());
+#endif /* ACE_HAS_MONITOR_POINTS==1 */
+
return block;
}
@@ -1827,8 +1969,29 @@ ACE_InputCDR::reset_contents (void)
// Reset the flags...
this->start_.clr_self_flags (ACE_Message_Block::DONT_DELETE);
+
+#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1)
+ this->monitor_->receive (this->start_.total_size ());
+#endif /* ACE_HAS_MONITOR_POINTS==1 */
}
+#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1)
+
+void
+ACE_InputCDR::register_monitor (const char *id)
+{
+ this->monitor_->name (id);
+ this->monitor_->add_to_registry ();
+}
+
+void
+ACE_InputCDR::unregister_monitor (void)
+{
+ this->monitor_->remove_from_registry ();
+}
+
+#endif /* ACE_HAS_MONITOR_POINTS==1 */
+
// --------------------------------------------------------------
ACE_Char_Codeset_Translator::~ACE_Char_Codeset_Translator (void)