#include <CDR_Size.h>
Definition at line 47 of file CDR_Size.h.
|
Default constructor.
Definition at line 10 of file CDR_Size.inl. References ACE_CDR::Octet.
00012 : good_bit_ (true), 00013 size_ (0), 00014 major_version_ (major_version), 00015 minor_version_ (minor_version) 00016 { 00017 } |
|
disallow copying...
|
|
As above, but now the size and alignment requirements may be different. Definition at line 227 of file CDR_Size.cpp. References ACE_align_binary().
00229 { 00230 #if !defined (ACE_LACKS_CDR_ALIGNMENT) 00231 const size_t offset = ACE_align_binary (size_, align) - size_; 00232 size_ += offset; 00233 #endif /* ACE_LACKS_CDR_ALIGNMENT */ 00234 size_ += size; 00235 } |
|
Adjust to size and count octets. Definition at line 221 of file CDR_Size.cpp. Referenced by write_1(), write_16(), write_2(), write_4(), write_8(), write_array(), write_boolean_array(), and write_wchar_array_i().
00222 { 00223 adjust (size, size); 00224 } |
|
Returns
Definition at line 20 of file CDR_Size.inl. References good_bit_. Referenced by operator<<().
00021 { 00022 return this->good_bit_; 00023 } |
|
|
|
Reset current size.
Definition at line 26 of file CDR_Size.inl.
00027 { 00028 this->size_ = 0; 00029 } |
|
Return current size.
Definition at line 32 of file CDR_Size.inl.
00033 { 00034 return this->size_; 00035 } |
|
Definition at line 148 of file CDR_Size.cpp. References adjust(), and ACE_CDR::Octet. Referenced by write_char(), write_octet(), and write_wchar().
00149 { 00150 this->adjust (1); 00151 return true; 00152 } |
|
Definition at line 176 of file CDR_Size.cpp. References adjust(). Referenced by write_longdouble().
00177 { 00178 this->adjust (ACE_CDR::LONGDOUBLE_SIZE, 00179 ACE_CDR::LONGDOUBLE_ALIGN); 00180 return true; 00181 } |
|
Definition at line 155 of file CDR_Size.cpp. References adjust(), and ACE_CDR::UShort. Referenced by write_short(), write_ushort(), and write_wchar().
00156 { 00157 this->adjust (ACE_CDR::SHORT_SIZE); 00158 return true; 00159 } |
|
Definition at line 162 of file CDR_Size.cpp. References adjust(), and ACE_CDR::ULong. Referenced by write_float(), write_long(), write_ulong(), and write_wchar().
00163 { 00164 this->adjust (ACE_CDR::LONG_SIZE); 00165 return true; 00166 } |
|
Definition at line 169 of file CDR_Size.cpp. References adjust(), and ACE_CDR::ULongLong. Referenced by write_double(), write_longlong(), and write_ulonglong().
00170 { 00171 this->adjust (ACE_CDR::LONGLONG_SIZE); 00172 return true; 00173 } |
|
write an array of length elements, each of size bytes and the start aligned at a multiple of . The elements are assumed to be packed with the right alignment restrictions. It is mostly designed for buffers of the basic types. This operation uses ; as explained above it is expected that using assignment is faster that for one element, but for several elements should be more efficient, it could be interesting to find the break even point and optimize for that case, but that would be too platform dependent. Definition at line 200 of file CDR_Size.cpp. References adjust(), and ACE_CDR::ULong. Referenced by write_char_array(), write_double_array(), write_float_array(), write_long_array(), write_longdouble_array(), write_longlong_array(), write_octet_array(), write_short_array(), write_ulong_array(), write_ulonglong_array(), write_ushort_array(), and write_wchar_array().
00204 { 00205 if (length == 0) 00206 return true; 00207 00208 this->adjust (size * length, align); 00209 return true; 00210 } |
|
Definition at line 47 of file CDR_Size.inl. References ACE_CDR::Boolean, ACE_CDR::Octet, and write_octet(). Referenced by operator<<().
00048 { 00049 return (ACE_CDR::Boolean) this->write_octet (x ? (ACE_CDR::Octet) 1 : (ACE_CDR::Octet) 0); 00050 } |
|
Definition at line 213 of file CDR_Size.cpp. References adjust(), ACE_CDR::Boolean, and ACE_CDR::ULong.
00215 { 00216 this->adjust (length, 1); 00217 return true; 00218 } |
|
Definition at line 53 of file CDR_Size.inl. References ACE_CDR::Char, and write_1(). Referenced by operator<<(), and write_string().
00054 { 00055 // Note: translator framework is not supported. 00056 // 00057 return this->write_1 (reinterpret_cast<const ACE_CDR::Octet*> (&x)); 00058 } |
|
Definition at line 143 of file CDR_Size.inl. References ACE_CDR::Char, ACE_CDR::ULong, and write_array(). Referenced by write_string().
00145 { 00146 // Note: translator framework is not supported. 00147 // 00148 return this->write_array (x, 00149 ACE_CDR::OCTET_SIZE, 00150 ACE_CDR::OCTET_ALIGN, 00151 length); 00152 } |
|
Definition at line 105 of file CDR_Size.inl. References write_8(). Referenced by operator<<().
00106 { 00107 const void *temp = &x; 00108 return this->write_8 (reinterpret_cast<const ACE_CDR::ULongLong*> (temp)); 00109 } |
|
Definition at line 257 of file CDR_Size.inl. References ACE_CDR::ULong, and write_array().
00259 { 00260 return this->write_array (x, 00261 ACE_CDR::LONGLONG_SIZE, 00262 ACE_CDR::LONGLONG_ALIGN, 00263 length); 00264 } |
|
Definition at line 98 of file CDR_Size.inl. References write_4(). Referenced by operator<<().
00099 { 00100 const void *temp = &x; 00101 return this->write_4 (reinterpret_cast<const ACE_CDR::ULong *> (temp)); 00102 } |
|
Definition at line 246 of file CDR_Size.inl. References ACE_CDR::ULong, and write_array().
00248 { 00249 return this->write_array (x, 00250 ACE_CDR::LONG_SIZE, 00251 ACE_CDR::LONG_ALIGN, 00252 length); 00253 } |
|
Definition at line 73 of file CDR_Size.inl. References ACE_CDR::Long, and write_4(). Referenced by operator<<().
00074 { 00075 return this->write_4 (reinterpret_cast<const ACE_CDR::ULong*> (&x)); 00076 } |
|
Definition at line 206 of file CDR_Size.inl. References ACE_CDR::Long, ACE_CDR::ULong, and write_array().
00208 { 00209 return this->write_array (x, 00210 ACE_CDR::LONG_SIZE, 00211 ACE_CDR::LONG_ALIGN, 00212 length); 00213 } |
|
Definition at line 112 of file CDR_Size.inl. References write_16(). Referenced by operator<<().
00113 { 00114 const void *temp = &x; 00115 return this->write_16 (reinterpret_cast<const ACE_CDR::LongDouble*> (temp)); 00116 } |
|
Definition at line 267 of file CDR_Size.inl. References ACE_CDR::ULong, and write_array().
00269 { 00270 return this->write_array (x, 00271 ACE_CDR::LONGDOUBLE_SIZE, 00272 ACE_CDR::LONGDOUBLE_ALIGN, 00273 length); 00274 } |
|
Definition at line 85 of file CDR_Size.inl. References ACE_CDR::LongLong, and write_8(). Referenced by operator<<().
00086 { 00087 return this->write_8 (reinterpret_cast<const ACE_CDR::ULongLong*> (&x)); 00088 } |
|
Definition at line 226 of file CDR_Size.inl. References ACE_CDR::LongLong, ACE_CDR::ULong, and write_array().
00228 { 00229 return this->write_array (x, 00230 ACE_CDR::LONGLONG_SIZE, 00231 ACE_CDR::LONGLONG_ALIGN, 00232 length); 00233 } |
|
Definition at line 41 of file CDR_Size.inl. References ACE_CDR::Octet, and write_1(). Referenced by operator<<(), and write_boolean().
00042 { 00043 return this->write_1 (reinterpret_cast<const ACE_CDR::Octet *> (&x)); 00044 } |
|
Definition at line 176 of file CDR_Size.inl. References ACE_CDR::Octet, ACE_CDR::ULong, and write_array(). Referenced by write_wchar().
00178 { 00179 return this->write_array (x, 00180 ACE_CDR::OCTET_SIZE, 00181 ACE_CDR::OCTET_ALIGN, 00182 length); 00183 } |
|
Definition at line 61 of file CDR_Size.inl. References ACE_CDR::Short, and write_2(). Referenced by operator<<().
00062 { 00063 return this->write_2 (reinterpret_cast<const ACE_CDR::UShort*> (&x)); 00064 } |
|
Definition at line 186 of file CDR_Size.inl. References ACE_CDR::Short, ACE_CDR::ULong, and write_array().
00188 { 00189 return this->write_array (x, 00190 ACE_CDR::SHORT_SIZE, 00191 ACE_CDR::SHORT_ALIGN, 00192 length); 00193 } |
|
Definition at line 100 of file CDR_Size.cpp. References ACE_CString, ACE_String_Base< CHAR >::c_str(), ACE_String_Base< CHAR >::length(), and write_string().
00101 { 00102 // @@ Leave this method in here, not the `.i' file so that we don't 00103 // have to unnecessarily pull in the `ace/SString.h' header. 00104 return this->write_string (static_cast<ACE_CDR::ULong> (x.length ()), 00105 x.c_str()); 00106 } |
|
Definition at line 76 of file CDR_Size.cpp. References ACE_CDR::Char, good_bit_, ACE_CDR::ULong, write_char(), write_char_array(), and write_ulong().
00078 { 00079 // Note: translator framework is not supported. 00080 // 00081 if (len != 0) 00082 { 00083 if (this->write_ulong (len + 1)) 00084 return this->write_char_array (x, len + 1); 00085 } 00086 else 00087 { 00088 // Be nice to programmers: treat nulls as empty strings not 00089 // errors. (OMG-IDL supports languages that don't use the C/C++ 00090 // notion of null v. empty strings; nulls aren't part of the OMG-IDL 00091 // string model.) 00092 if (this->write_ulong (1)) 00093 return this->write_char (0); 00094 } 00095 00096 return (this->good_bit_ = false); 00097 } |
|
For string we offer methods that accept a precomputed length.
Definition at line 119 of file CDR_Size.inl. References ACE_CDR::Char, ACE_OS::strlen(), and ACE_CDR::ULong. Referenced by operator<<(), and write_string().
00120 { 00121 if (x != 0) 00122 { 00123 const ACE_CDR::ULong len = 00124 static_cast<ACE_CDR::ULong> (ACE_OS::strlen (x)); 00125 return this->write_string (len, x); 00126 } 00127 return this->write_string (0, 0); 00128 } |
|
Definition at line 79 of file CDR_Size.inl. References ACE_CDR::ULong, and write_4(). Referenced by operator<<(), write_string(), and write_wstring().
00080 { 00081 return this->write_4 (reinterpret_cast<const ACE_CDR::ULong*> (&x)); 00082 } |
|
Definition at line 216 of file CDR_Size.inl. References ACE_CDR::ULong, and write_array().
00218 { 00219 return this->write_array (x, 00220 ACE_CDR::LONG_SIZE, 00221 ACE_CDR::LONG_ALIGN, 00222 length); 00223 } |
|
Definition at line 91 of file CDR_Size.inl. References ACE_CDR::ULongLong, and write_8(). Referenced by operator<<().
00092 { 00093 const void *temp = &x; 00094 return this->write_8 (reinterpret_cast<const ACE_CDR::ULongLong *> (temp)); 00095 } |
|
Definition at line 236 of file CDR_Size.inl. References ACE_CDR::ULong, ACE_CDR::ULongLong, and write_array().
00238 { 00239 return this->write_array (x, 00240 ACE_CDR::LONGLONG_SIZE, 00241 ACE_CDR::LONGLONG_ALIGN, 00242 length); 00243 } |
|
Definition at line 67 of file CDR_Size.inl. References ACE_CDR::UShort, and write_2(). Referenced by operator<<().
00068 { 00069 return this->write_2 (reinterpret_cast<const ACE_CDR::UShort*> (&x)); 00070 } |
|
Definition at line 196 of file CDR_Size.inl. References ACE_CDR::ULong, ACE_CDR::UShort, and write_array().
00198 { 00199 return this->write_array (x, 00200 ACE_CDR::SHORT_SIZE, 00201 ACE_CDR::SHORT_ALIGN, 00202 length); 00203 } |
|
Definition at line 16 of file CDR_Size.cpp. References good_bit_, major_version_, minor_version_, ACE_CDR::Octet, ACE_CDR::Short, ACE_CDR::WChar, ACE_OutputCDR::wchar_maxbytes(), write_1(), write_2(), write_4(), and write_octet_array(). Referenced by operator<<(), and write_wstring().
00017 { 00018 // Note: translator framework is not supported. 00019 // 00020 if (ACE_OutputCDR::wchar_maxbytes () == 0) 00021 { 00022 errno = EACCES; 00023 return (this->good_bit_ = false); 00024 } 00025 if (static_cast<ACE_CDR::Short> (major_version_) == 1 00026 && static_cast<ACE_CDR::Short> (minor_version_) == 2) 00027 { 00028 ACE_CDR::Octet len = 00029 static_cast<ACE_CDR::Octet> (ACE_OutputCDR::wchar_maxbytes ()); 00030 if (this->write_1 (&len)) 00031 { 00032 if (ACE_OutputCDR::wchar_maxbytes () == sizeof(ACE_CDR::WChar)) 00033 return 00034 this->write_octet_array ( 00035 reinterpret_cast<const ACE_CDR::Octet*> (&x), 00036 static_cast<ACE_CDR::ULong> (len)); 00037 else 00038 if (ACE_OutputCDR::wchar_maxbytes () == 2) 00039 { 00040 ACE_CDR::Short sx = static_cast<ACE_CDR::Short> (x); 00041 return 00042 this->write_octet_array ( 00043 reinterpret_cast<const ACE_CDR::Octet*> (&sx), 00044 static_cast<ACE_CDR::ULong> (len)); 00045 } 00046 else 00047 { 00048 ACE_CDR::Octet ox = static_cast<ACE_CDR::Octet> (x); 00049 return 00050 this->write_octet_array ( 00051 reinterpret_cast<const ACE_CDR::Octet*> (&ox), 00052 static_cast<ACE_CDR::ULong> (len)); 00053 } 00054 } 00055 } 00056 else if (static_cast<ACE_CDR::Short> (minor_version_) == 0) 00057 { // wchar is not allowed with GIOP 1.0. 00058 errno = EINVAL; 00059 return (this->good_bit_ = false); 00060 } 00061 if (ACE_OutputCDR::wchar_maxbytes () == sizeof (ACE_CDR::WChar)) 00062 { 00063 const void *temp = &x; 00064 return this->write_4 (reinterpret_cast<const ACE_CDR::ULong *> (temp)); 00065 } 00066 else if (ACE_OutputCDR::wchar_maxbytes () == 2) 00067 { 00068 ACE_CDR::Short sx = static_cast<ACE_CDR::Short> (x); 00069 return this->write_2 (reinterpret_cast<const ACE_CDR::UShort *> (&sx)); 00070 } 00071 ACE_CDR::Octet ox = static_cast<ACE_CDR::Octet> (x); 00072 return this->write_1 (reinterpret_cast<const ACE_CDR::Octet *> (&ox)); 00073 } |
|
Definition at line 155 of file CDR_Size.inl. References ACE_CDR::Boolean, good_bit_, ACE_CDR::ULong, ACE_CDR::WChar, ACE_OutputCDR::wchar_maxbytes(), write_array(), and write_wchar_array_i(). Referenced by write_wstring().
00157 { 00158 // Note: translator framework is not supported. 00159 // 00160 if (ACE_OutputCDR::wchar_maxbytes () == 0) 00161 { 00162 errno = EACCES; 00163 return (ACE_CDR::Boolean) (this->good_bit_ = false); 00164 } 00165 if (ACE_OutputCDR::wchar_maxbytes () == sizeof (ACE_CDR::WChar)) 00166 return this->write_array (x, 00167 sizeof (ACE_CDR::WChar), 00168 sizeof (ACE_CDR::WChar) == 2 00169 ? ACE_CDR::SHORT_ALIGN 00170 : ACE_CDR::LONG_ALIGN, 00171 length); 00172 return this->write_wchar_array_i (x,length); 00173 } |
|
Definition at line 184 of file CDR_Size.cpp. References adjust(), ACE_CDR::ULong, ACE_CDR::WChar, and ACE_OutputCDR::wchar_maxbytes(). Referenced by write_wchar_array().
00186 { 00187 if (length == 0) 00188 return true; 00189 00190 size_t const align = (ACE_OutputCDR::wchar_maxbytes () == 2) ? 00191 ACE_CDR::SHORT_ALIGN : 00192 ACE_CDR::OCTET_ALIGN; 00193 00194 this->adjust (ACE_OutputCDR::wchar_maxbytes () * length, align); 00195 return true; 00196 } |
|
Definition at line 109 of file CDR_Size.cpp. References good_bit_, major_version_, minor_version_, ACE_CDR::ULong, ACE_CDR::WChar, ACE_OutputCDR::wchar_maxbytes(), write_ulong(), write_wchar(), and write_wchar_array().
00111 { 00112 // Note: translator framework is not supported. 00113 // 00114 if (ACE_OutputCDR::wchar_maxbytes () == 0) 00115 { 00116 errno = EACCES; 00117 return (this->good_bit_ = false); 00118 } 00119 00120 if (static_cast<ACE_CDR::Short> (this->major_version_) == 1 00121 && static_cast<ACE_CDR::Short> (this->minor_version_) == 2) 00122 { 00123 if (x != 0) 00124 { 00125 //In GIOP 1.2 the length field contains the number of bytes 00126 //the wstring occupies rather than number of wchars 00127 //Taking sizeof might not be a good way! This is a temporary fix. 00128 if (this->write_ulong (ACE_OutputCDR::wchar_maxbytes () * len)) 00129 return this->write_wchar_array (x, len); 00130 } 00131 else 00132 //In GIOP 1.2 zero length wstrings are legal 00133 return this->write_ulong (0); 00134 } 00135 00136 else 00137 if (x != 0) 00138 { 00139 if (this->write_ulong (len + 1)) 00140 return this->write_wchar_array (x, len + 1); 00141 } 00142 else if (this->write_ulong (1)) 00143 return this->write_wchar (0); 00144 return (this->good_bit_ = false); 00145 } |
|
Definition at line 131 of file CDR_Size.inl. References ACE_OS::strlen(), ACE_CDR::ULong, and ACE_CDR::WChar. Referenced by operator<<().
00132 { 00133 if (x != 0) 00134 { 00135 ACE_CDR::ULong len = 00136 static_cast<ACE_CDR::ULong> (ACE_OS::strlen (x)); 00137 return this->write_wstring (len, x); 00138 } 00139 return this->write_wstring (0, 0); 00140 } |
|
Set to false when an error ocurrs.
Definition at line 166 of file CDR_Size.h. Referenced by good_bit(), write_string(), write_wchar(), write_wchar_array(), and write_wstring(). |
|
GIOP version information.
Definition at line 173 of file CDR_Size.h. Referenced by write_wchar(), and write_wstring(). |
|
Definition at line 174 of file CDR_Size.h. Referenced by write_wchar(), and write_wstring(). |
|
Current size.
Definition at line 169 of file CDR_Size.h. |