00001 // -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file UIPMC_Message_Block_Data_Iterator.h 00006 * 00007 * $Id: UIPMC_Message_Block_Data_Iterator.h 69353 2005-11-14 22:03:50Z ossama $ 00008 * 00009 * @author Frank Hunleth <frank@hunleth.com> 00010 */ 00011 //============================================================================= 00012 00013 #ifndef TAO_UIPMC_MESSAGE_BLOCK_DATA_ITERATOR_H 00014 #define TAO_UIPMC_MESSAGE_BLOCK_DATA_ITERATOR_H 00015 #include /**/ "ace/pre.h" 00016 00017 #include "ace/os_include/sys/os_uio.h" 00018 #include "ace/os_include/os_stddef.h" 00019 00020 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00021 # pragma once 00022 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00023 00024 #include "tao/Versioned_Namespace.h" 00025 00026 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00027 00028 /** 00029 * @class UIPMC_Message_Block_Data_Iterator 00030 * 00031 * @brief This is a help class for iterating through ACE_Message_Blocks and to 00032 * segment them into MIOP packets. 00033 */ 00034 class UIPMC_Message_Block_Data_Iterator 00035 { 00036 public: 00037 /// Constructor 00038 UIPMC_Message_Block_Data_Iterator (iovec *iov, int iovcnt); 00039 00040 /// Get the next data block that has a size less than or equal 00041 /// to max_length. Return the length of the block returned. 00042 size_t next_block (size_t max_length, 00043 iovec &block); 00044 00045 private: 00046 enum State 00047 { 00048 INTER_BLOCK, 00049 INTRA_BLOCK 00050 }; 00051 00052 iovec *iov_; 00053 int iovcnt_; 00054 00055 // Point internal to a message block, if we have to split one up. 00056 char *iov_ptr_; 00057 int iov_index_; 00058 00059 // Length used in a split message block. 00060 size_t iov_len_left_; 00061 00062 // Current message iterator state. 00063 State state_; 00064 00065 }; 00066 00067 TAO_END_VERSIONED_NAMESPACE_DECL 00068 00069 #include /**/ "ace/post.h" 00070 #endif /* TAO_UIPMC_MESSAGE_BLOCK_DATA_ITERATOR_H */