Synch_Queued_Message.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  *  @file Synch_Queued_Message.h
00006  *
00007  *  Synch_Queued_Message.h,v 1.11 2006/05/05 11:23:57 jwillemsen Exp
00008  *
00009  *  @author Carlos O'Ryan <coryan@uci.edu>
00010  */
00011 //=============================================================================
00012 
00013 #ifndef TAO_SYNCH_QUEUED_MESSAGE_H
00014 #define TAO_SYNCH_QUEUED_MESSAGE_H
00015 
00016 #include /**/ "ace/pre.h"
00017 
00018 #include "tao/Queued_Message.h"
00019 
00020 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00021 # pragma once
00022 #endif /* ACE_LACKS_PRAGMA_ONCE */
00023 
00024 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00025 
00026 /**
00027  * @class TAO_Synch_Queued_Message
00028  *
00029  * @brief Specialize TAO_Queued_Message for synchronous requests,
00030  *        i.e. twoways and oneways sent with reliability better than
00031  *        SYNC_NONE.
00032  *
00033  * Reliable requests block the sending thread until the message is
00034  * sent, likewise, the sending thread must be informed if the
00035  * connection is closed or the message times out.
00036  *
00037  * In contrast oneway (and AMI) requests sent with the SYNC_NONE
00038  * policy are simple discarded if the connection fails or they
00039  * timeout.
00040  *
00041  * Another important difference is the management of the data buffer:
00042  * one SYNC_NONE messages the buffer is immediately copied into a
00043  * newly allocated buffer, and must be deallocated.  Other types of
00044  * requests use the memory allocated by the sending thread.
00045  *
00046  */
00047 class TAO_Export TAO_Synch_Queued_Message : public TAO_Queued_Message
00048 {
00049 public:
00050   /// Constructor
00051   /**
00052    * @param contents The message block chain that must be sent.
00053    *
00054    * @param alloc The allocator that is used to allocate objects of
00055    *        this type.
00056    */
00057   TAO_Synch_Queued_Message (const ACE_Message_Block *contents,
00058                             TAO_ORB_Core *oc,
00059                             ACE_Allocator *alloc = 0,
00060                             bool is_heap_allocated = false);
00061 
00062   /// Destructor
00063   virtual ~TAO_Synch_Queued_Message (void);
00064 
00065   const ACE_Message_Block *current_block (void) const;
00066 
00067   /** @name Implement the Template Methods from TAO_Queued_Message
00068    */
00069   //@{
00070   virtual size_t message_length (void) const;
00071   virtual int all_data_sent (void) const;
00072   virtual void fill_iov (int iovcnt_max, int &iovcnt, iovec iov[]) const;
00073   virtual void bytes_transferred (size_t &byte_count);
00074   virtual TAO_Queued_Message *clone (ACE_Allocator *alloc);
00075   virtual void destroy (void);
00076   //@}
00077 
00078 private:
00079   /// The contents of the message.
00080   /**
00081    * The message is normally generated by a TAO_OutputCDR stream.  The
00082    * application marshals the payload, possibly generating a chain of
00083    * message block connected via the 'cont()' field.
00084    */
00085   ACE_Message_Block *contents_;
00086 
00087   /// The current message block
00088   /**
00089    * The message may be set in multiple writev() operations.  This
00090    * point keeps track of the next message to send out.
00091    */
00092   ACE_Message_Block *current_block_;
00093 };
00094 
00095 TAO_END_VERSIONED_NAMESPACE_DECL
00096 
00097 #include /**/ "ace/post.h"
00098 
00099 #endif  /* TAO_QUEUED_MESSAGE_H */

Generated on Thu Nov 9 11:54:22 2006 for TAO by doxygen 1.3.6