/usr/include/omniORB4/seqTemplatedefns.h is in libomniorb4-dev 4.1.6-2ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 | // -*- Mode: C++; -*-
// Package : omniORB2
// seqTemplatedefns.h Created on: 14/5/96
// Author : Sai Lai Lo (sll)
//
// Copyright (C) 2003-2007 Apasphere Ltd
// Copyright (C) 1996-1999 AT&T Laboratories Cambridge
//
// This file is part of the omniORB library.
//
// The omniORB library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
// License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Library General Public License for more details.
//
// You should have received a copy of the GNU Library General Public
// License along with this library; if not, write to the Free
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA
//
//
// Description:
// *** PROPRIETORY INTERFACE ***
/*
$Log$
Revision 1.1.4.4 2007/04/12 19:50:32 dgrisby
A few cases of sizeof(bool) > 1 were not handled correctly.
Revision 1.1.4.3 2006/04/28 18:40:46 dgrisby
Merge from omni4_0_develop.
Revision 1.1.4.2 2005/01/06 17:31:06 dgrisby
Changes (mainly from omni4_0_develop) to compile on gcc 3.4.
Revision 1.1.2.11 2003/05/22 13:41:39 dgrisby
HPUX patches.
Revision 1.1.4.1 2003/03/23 21:04:02 dgrisby
Start of omniORB 4.1.x development branch.
Revision 1.1.2.10 2002/10/15 23:25:45 dgrisby
DOH!
Revision 1.1.2.9 2002/10/15 23:23:29 dgrisby
Forgot case of compilers with no bool.
Revision 1.1.2.8 2002/10/14 15:10:09 dgrisby
Cope with platforms where sizeof(bool) != 1.
Revision 1.1.2.7 2001/08/03 17:41:16 sll
System exception minor code overhaul. When a system exeception is raised,
a meaning minor code is provided.
Revision 1.1.2.6 2001/05/04 11:24:46 sll
Wrong bound check in all sequence array templates.
Revision 1.1.2.5 2000/11/20 18:56:39 sll
Sequence templates were broken by the previous checkin. They are now fixed.
Revision 1.1.2.4 2000/11/20 14:41:44 sll
Simplified sequence template hierachy and added templates for sequence of
wchar and sequence of array of wchar.
Revision 1.1.2.3 2000/11/07 18:19:54 sll
Revert to use explicit castings in the marshalling operators of sequence of
arrays.
Revision 1.1.2.2 2000/11/03 19:02:46 sll
Separate out the marshalling of byte, octet and char into 3 set of distinct
marshalling functions. Sequence of and sequence of array of these types
updated correspondingly.
Revision 1.1.2.1 2000/09/27 16:54:09 sll
*** empty log message ***
*/
#ifndef __SEQTEMPLATEDEFNS_H__
#define __SEQTEMPLATEDEFNS_H__
#ifndef Swap16
#define Swap16(s) ((((s) & 0xff) << 8) | (((s) >> 8) & 0xff))
#else
#error "Swap16 has already been defined"
#endif
#ifndef Swap32
#define Swap32(l) ((((l) & 0xff000000) >> 24) | \
(((l) & 0x00ff0000) >> 8) | \
(((l) & 0x0000ff00) << 8) | \
(((l) & 0x000000ff) << 24))
#else
#error "Swap32 has already been defined"
#endif
//////////////////////////////////////////////////////////////////////
template <class T>
inline void
_CORBA_Unbounded_Sequence<T>::operator>>= (cdrStream& s) const
{
::operator>>=(_CORBA_ULong(this->pd_len), s);
for( int i = 0; i < (int)this->pd_len; i++ )
this->pd_buf[i] >>= s;
}
//////////////////////////////////////////////////////////////////////
template <class T>
inline void
_CORBA_Unbounded_Sequence<T>::operator<<= (cdrStream& s)
{
_CORBA_ULong l;
l <<= s;
if (!s.checkInputOverrun(1,l)) {
_CORBA_marshal_sequence_range_check_error(s);
// never reach here
}
this->length(l);
for( _CORBA_ULong i = 0; i < l; i++ )
this->pd_buf[i] <<= s;
}
//////////////////////////////////////////////////////////////////////
template <class T,int max>
inline void
_CORBA_Bounded_Sequence<T,max>::operator>>= (cdrStream& s) const
{
::operator>>=(_CORBA_ULong(this->pd_len), s);
for( int i = 0; i < (int)this->pd_len; i++ )
this->pd_buf[i] >>= s;
}
//////////////////////////////////////////////////////////////////////
template <class T,int max>
inline void
_CORBA_Bounded_Sequence<T,max>::operator<<= (cdrStream& s)
{
_CORBA_ULong l;
l <<= s;
if (!s.checkInputOverrun(1,l) || (l > max)) {
_CORBA_marshal_sequence_range_check_error(s);
// never reach here
}
this->length(l);
for( _CORBA_ULong i = 0; i < l; i++ )
this->pd_buf[i] <<= s;
}
//////////////////////////////////////////////////////////////////////
template <class T,int elmSize,int elmAlignment>
inline
void
_CORBA_Unbounded_Sequence_w_FixSizeElement<T,elmSize,elmAlignment>::operator>>= (cdrStream& s) const
{
if (s.marshal_byte_swap()) {
Base_T_seq::operator>>=(s);
return;
}
_CORBA_ULong l = Base_T_seq::length();
l >>= s;
if (l==0) return;
s.put_octet_array((_CORBA_Octet*)Base_T_seq::NP_data(),
(int)l*elmSize,
(omni::alignment_t)elmAlignment);
}
//////////////////////////////////////////////////////////////////////
template <class T,int elmSize,int elmAlignment>
inline
void
_CORBA_Unbounded_Sequence_w_FixSizeElement<T,elmSize,elmAlignment>::operator<<= (cdrStream& s)
{
_CORBA_ULong l;
l <<= s;
if (!s.checkInputOverrun(elmSize,l)) {
_CORBA_marshal_sequence_range_check_error(s);
// never reach here
}
Base_T_seq::length(l);
if (l==0) return;
s.get_octet_array((_CORBA_Octet*)Base_T_seq::NP_data(),
(int)l*elmSize,
(omni::alignment_t)elmAlignment);
if (s.unmarshal_byte_swap() && elmAlignment != 1) {
if (elmSize == 2) {
for (_CORBA_ULong i=0; i<l; i++) {
_CORBA_UShort t = ((_CORBA_UShort*)Base_T_seq::NP_data())[i];
((_CORBA_UShort*)Base_T_seq::NP_data())[i] = Swap16(t);
}
}
else if (elmSize == 4) {
for (_CORBA_ULong i=0; i<l; i++) {
_CORBA_ULong t = ((_CORBA_ULong*)Base_T_seq::NP_data())[i];
((_CORBA_ULong*)Base_T_seq::NP_data())[i] = Swap32(t);
}
}
else if (elmSize == 8) {
l *= 2;
for (_CORBA_ULong i=0; i<l; i+=2) {
_CORBA_ULong tl1 = ((_CORBA_ULong*)Base_T_seq::NP_data())[i+1];
_CORBA_ULong tl2 = Swap32(tl1);
tl1 = ((_CORBA_ULong*)Base_T_seq::NP_data())[i];
((_CORBA_ULong*)Base_T_seq::NP_data())[i] = tl2;
((_CORBA_ULong*)Base_T_seq::NP_data())[i+1] = Swap32(tl1);
}
}
}
}
//////////////////////////////////////////////////////////////////////
template <class T,int max,int elmSize,int elmAlignment>
inline
void
_CORBA_Bounded_Sequence_w_FixSizeElement<T,max,elmSize,elmAlignment>::operator>>= (cdrStream& s) const
{
if (s.marshal_byte_swap()) {
Base_T_seq::operator>>=(s);
return;
}
_CORBA_ULong l = Base_T_seq::length();
l >>= s;
if (l==0) return;
s.put_octet_array((_CORBA_Octet*)Base_T_seq::NP_data(),
(int)l*elmSize,
(omni::alignment_t)elmAlignment);
}
//////////////////////////////////////////////////////////////////////
template <class T,int max,int elmSize,int elmAlignment>
inline
void
_CORBA_Bounded_Sequence_w_FixSizeElement<T,max,elmSize,elmAlignment>::operator<<= (cdrStream& s)
{
_CORBA_ULong l;
l <<= s;
if (!s.checkInputOverrun(elmSize,l)) {
_CORBA_marshal_sequence_range_check_error(s);
// never reach here
}
Base_T_seq::length(l);
if (l==0) return;
s.get_octet_array((_CORBA_Octet*)Base_T_seq::NP_data(),
(int)l*elmSize,
(omni::alignment_t)elmAlignment);
if (s.unmarshal_byte_swap() && elmAlignment != 1) {
if (elmSize == 2) {
for (_CORBA_ULong i=0; i<l; i++) {
_CORBA_UShort t = ((_CORBA_UShort*)Base_T_seq::NP_data())[i];
((_CORBA_UShort*)Base_T_seq::NP_data())[i] = Swap16(t);
}
}
else if (elmSize == 4) {
for (_CORBA_ULong i=0; i<l; i++) {
_CORBA_ULong t = ((_CORBA_ULong*)Base_T_seq::NP_data())[i];
((_CORBA_ULong*)Base_T_seq::NP_data())[i] = Swap32(t);
}
}
else if (elmSize == 8) {
l *= 2;
for (_CORBA_ULong i=0; i<l; i+=2) {
_CORBA_ULong tl1 = ((_CORBA_ULong*)Base_T_seq::NP_data())[i+1];
_CORBA_ULong tl2 = Swap32(tl1);
tl1 = ((_CORBA_ULong*)Base_T_seq::NP_data())[i];
((_CORBA_ULong*)Base_T_seq::NP_data())[i] = tl2;
((_CORBA_ULong*)Base_T_seq::NP_data())[i+1] = Swap32(tl1);
}
}
}
}
//////////////////////////////////////////////////////////////////////
#ifdef OMNI_MIXED_ENDIAN_DOUBLE
// Template member function specializations to use the base
// marshalling functions for double, so the doubles are properly
// word-swapped.
template<>
inline
void
_CORBA_Unbounded_Sequence_w_FixSizeElement<_CORBA_Double,8,8>::operator>>= (cdrStream& s) const
{
Base_T_seq::operator>>=(s);
}
template<>
inline
void
_CORBA_Unbounded_Sequence_w_FixSizeElement<_CORBA_Double,8,8>::operator<<= (cdrStream& s)
{
Base_T_seq::operator<<=(s);
}
template<int max>
inline
void
_CORBA_Bounded_Sequence_w_FixSizeElement<_CORBA_Double,max,8,8>::operator>>= (cdrStream& s) const
{
Base_T_seq::operator>>=(s);
}
template<int max>
inline
void
_CORBA_Bounded_Sequence_w_FixSizeElement<_CORBA_Double,max,8,8>::operator<<= (cdrStream& s)
{
Base_T_seq::operator<<=(s);
}
#endif
//////////////////////////////////////////////////////////////////////
inline
void
_CORBA_Sequence_Char::operator>>= (cdrStream& s) const
{
_CORBA_ULong l = Base_T_seq::length();
l >>= s;
for( _CORBA_ULong i = 0; i < l; i++ )
s.marshalChar(this->pd_buf[i]);
}
//////////////////////////////////////////////////////////////////////
inline
void
_CORBA_Sequence_Char::operator<<= (cdrStream& s)
{
_CORBA_ULong l;
l <<= s;
if (!s.checkInputOverrun(1,l) || (this->pd_bounded && l > this->pd_max)) {
_CORBA_marshal_sequence_range_check_error(s);
// never reach here
}
this->length(l);
for( _CORBA_ULong i = 0; i < l; i++ )
this->pd_buf[i] = s.unmarshalChar();
}
//////////////////////////////////////////////////////////////////////
inline
void
_CORBA_Sequence_Boolean::operator>>= (cdrStream& s) const
{
_CORBA_ULong l = Base_T_seq::length();
l >>= s;
if (l==0) return;
# if !defined(HAS_Cplusplus_Bool) || (SIZEOF_BOOL == 1)
s.put_octet_array((_CORBA_Octet*)this->pd_buf,l);
# else
for ( _CORBA_ULong i = 0; i < l; i++ )
s.marshalBoolean(this->pd_buf[i]);
# endif
}
//////////////////////////////////////////////////////////////////////
inline
void
_CORBA_Sequence_Boolean::operator<<= (cdrStream& s)
{
_CORBA_ULong l;
l <<= s;
if (!s.checkInputOverrun(1,l) || (pd_bounded && l > this->pd_max)) {
_CORBA_marshal_sequence_range_check_error(s);
// never reach here
}
this->length(l);
if (l==0) return;
# if !defined(HAS_Cplusplus_Bool) || (SIZEOF_BOOL == 1)
s.get_octet_array((_CORBA_Octet*)this->pd_buf,l);
# else
for ( _CORBA_ULong i = 0; i < l; i++ )
this->pd_buf[i] = s.unmarshalBoolean();
# endif
}
//////////////////////////////////////////////////////////////////////
inline
void
_CORBA_Sequence_Octet::operator>>= (cdrStream& s) const
{
_CORBA_ULong l = Base_T_seq::length();
l >>= s;
if (l==0) return;
s.put_octet_array(this->pd_buf,l);
}
//////////////////////////////////////////////////////////////////////
inline
void
_CORBA_Sequence_Octet::operator<<= (cdrStream& s)
{
_CORBA_ULong l;
l <<= s;
if (!s.checkInputOverrun(1,l) || (this->pd_bounded && l > this->pd_max)) {
_CORBA_marshal_sequence_range_check_error(s);
// never reach here
}
this->length(l);
if (l==0) return;
s.get_octet_array(this->pd_buf,l);
}
//////////////////////////////////////////////////////////////////////
inline
void
_CORBA_Sequence_WChar::operator>>= (cdrStream& s) const
{
_CORBA_ULong l = Base_T_seq::length();
l >>= s;
for( _CORBA_ULong i = 0; i < l; i++ )
s.marshalWChar(this->pd_buf[i]);
}
//////////////////////////////////////////////////////////////////////
inline
void
_CORBA_Sequence_WChar::operator<<= (cdrStream& s)
{
_CORBA_ULong l;
l <<= s;
if (!s.checkInputOverrun(1,l) || (this->pd_bounded && l > this->pd_max)) {
_CORBA_marshal_sequence_range_check_error(s);
// never reach here
}
this->length(l);
for( _CORBA_ULong i = 0; i < l; i++ )
this->pd_buf[i] = s.unmarshalWChar();
}
//////////////////////////////////////////////////////////////////////
template <class T,class T_slice,class Telm,int dimension>
inline void
_CORBA_Unbounded_Sequence_Array<T,T_slice,Telm,dimension>::operator>>= (cdrStream& s) const
{
this->pd_len >>= s;
for (_CORBA_ULong i=0; i<this->pd_len; i++) {
for (_CORBA_ULong j=0; j<dimension; j++) {
*((Telm*)(this->pd_buf[i]) + j) >>= s;
}
}
return;
}
//////////////////////////////////////////////////////////////////////
template <class T,class T_slice,class Telm,int dimension>
inline void
_CORBA_Unbounded_Sequence_Array<T,T_slice,Telm,dimension>::operator<<= (cdrStream& s)
{
_CORBA_ULong l;
l <<= s;
if (!s.checkInputOverrun(1,l) || (this->pd_bounded && l > this->pd_max)) {
_CORBA_marshal_sequence_range_check_error(s);
// never reach here
}
this->length(l);
for (_CORBA_ULong i=0; i<l; i++) {
for (_CORBA_ULong j=0; j<dimension; j++) {
*((Telm*)(this->pd_buf[i]) + j) <<= s;
}
}
return;
}
//////////////////////////////////////////////////////////////////////
template <class T,class T_slice,class Telm,int dimension,int max>
inline void
_CORBA_Bounded_Sequence_Array<T,T_slice,Telm,dimension,max>::operator>>= (cdrStream& s) const
{
this->pd_len >>= s;
for (_CORBA_ULong i=0; i<this->pd_len; i++) {
for (_CORBA_ULong j=0; j<dimension; j++) {
*((Telm*)(this->pd_buf[i]) + j) >>= s;
}
}
return;
}
//////////////////////////////////////////////////////////////////////
template <class T,class T_slice,class Telm,int dimension,int max>
inline void
_CORBA_Bounded_Sequence_Array<T,T_slice,Telm,dimension,max>::operator<<= (cdrStream& s)
{
_CORBA_ULong l;
l <<= s;
if (!s.checkInputOverrun(1,l) || (l > max)) {
_CORBA_marshal_sequence_range_check_error(s);
// never reach here
}
this->length(l);
for (_CORBA_ULong i=0; i<l; i++) {
for (_CORBA_ULong j=0; j<dimension; j++) {
*((Telm*)(this->pd_buf[i]) + j) <<= s;
}
}
return;
}
//////////////////////////////////////////////////////////////////////
template<class T, class T_slice, int dimension>
inline void
_CORBA_Sequence_Array_Char<T,T_slice,dimension>::operator>>=(cdrStream& s) const
{
this->pd_len >>= s;
for (_CORBA_ULong i=0; i<this->pd_len; i++) {
for (_CORBA_ULong j=0; j<dimension; j++) {
s.marshalChar(*((_CORBA_Char*)(this->pd_buf[i]) + j));
}
}
}
//////////////////////////////////////////////////////////////////////
template<class T, class T_slice, int dimension>
inline void
_CORBA_Sequence_Array_Char<T,T_slice,dimension>::operator<<=(cdrStream& s)
{
_CORBA_ULong l;
l <<= s;
if (!s.checkInputOverrun(1,l) || (this->pd_bounded && l > this->pd_max)) {
_CORBA_marshal_sequence_range_check_error(s);
// never reach here
}
this->length(l);
for (_CORBA_ULong i=0; i<l; i++) {
for (_CORBA_ULong j=0; j<dimension; j++) {
*((_CORBA_Char*)(this->pd_buf[i]) + j) = s.unmarshalChar();
}
}
}
//////////////////////////////////////////////////////////////////////
template<class T, class T_slice, int dimension>
inline void
_CORBA_Sequence_Array_Boolean<T,T_slice,dimension>::operator>>=(cdrStream& s) const
{
this->pd_len >>= s;
if (this->pd_len==0) return;
# if !defined(HAS_Cplusplus_Bool) || (SIZEOF_BOOL == 1)
s.put_octet_array((_CORBA_Octet*)this->pd_buf,(int)this->pd_len*dimension);
# else
for (_CORBA_ULong i=0; i<this->pd_len; i++) {
for (_CORBA_ULong j=0; j<dimension; j++) {
s.marshalBoolean(*((_CORBA_Boolean*)(this->pd_buf[i]) + j));
}
}
# endif
}
//////////////////////////////////////////////////////////////////////
template<class T, class T_slice, int dimension>
inline void
_CORBA_Sequence_Array_Boolean<T,T_slice,dimension>::operator<<=(cdrStream& s)
{
_CORBA_ULong l;
l <<= s;
if (!s.checkInputOverrun(1,l) || (this->pd_bounded && l > this->pd_max)) {
_CORBA_marshal_sequence_range_check_error(s);
// never reach here
}
this->length(l);
if (l==0) return;
# if !defined(HAS_Cplusplus_Bool) || (SIZEOF_BOOL == 1)
s.get_octet_array((_CORBA_Octet*)this->pd_buf,(int)l*dimension);
# else
for (_CORBA_ULong i=0; i<l; i++) {
for (_CORBA_ULong j=0; j<dimension; j++) {
*((_CORBA_Boolean*)(this->pd_buf[i]) + j) = s.unmarshalBoolean();
}
}
# endif
}
//////////////////////////////////////////////////////////////////////
template<class T, class T_slice, int dimension>
inline void
_CORBA_Sequence_Array_Octet<T,T_slice,dimension>::operator>>=(cdrStream& s) const
{
this->pd_len >>= s;
if (this->pd_len==0) return;
s.put_octet_array((_CORBA_Octet*)this->pd_buf,(int)this->pd_len*dimension);
}
//////////////////////////////////////////////////////////////////////
template<class T, class T_slice, int dimension>
inline void
_CORBA_Sequence_Array_Octet<T,T_slice,dimension>::operator<<=(cdrStream& s)
{
_CORBA_ULong l;
l <<= s;
if (!s.checkInputOverrun(1,l) || (this->pd_bounded && l > this->pd_max)) {
_CORBA_marshal_sequence_range_check_error(s);
// never reach here
}
this->length(l);
if (l==0) return;
s.get_octet_array((_CORBA_Octet*)this->pd_buf,(int)l*dimension);
}
//////////////////////////////////////////////////////////////////////
template<class T, class T_slice, int dimension>
inline void
_CORBA_Sequence_Array_WChar<T,T_slice,dimension>::operator>>=(cdrStream& s) const
{
this->pd_len >>= s;
for (_CORBA_ULong i=0; i<this->pd_len; i++) {
for (_CORBA_ULong j=0; j<dimension; j++) {
s.marshalWChar(*((_CORBA_WChar*)(this->pd_buf[i]) + j));
}
}
}
//////////////////////////////////////////////////////////////////////
template<class T, class T_slice, int dimension>
inline void
_CORBA_Sequence_Array_WChar<T,T_slice,dimension>::operator<<=(cdrStream& s)
{
_CORBA_ULong l;
l <<= s;
if (!s.checkInputOverrun(1,l) || (this->pd_bounded && l > this->pd_max)) {
_CORBA_marshal_sequence_range_check_error(s);
// never reach here
}
this->length(l);
for (_CORBA_ULong i=0; i<l; i++) {
for (_CORBA_ULong j=0; j<dimension; j++) {
*((_CORBA_WChar*)(this->pd_buf[i]) + j) = s.unmarshalWChar();
}
}
}
//////////////////////////////////////////////////////////////////////
template <class T,class T_slice,class Telm,int dimension,int elmSize,int elmAlignment>
inline
void
_CORBA_Unbounded_Sequence_Array_w_FixSizeElement<T,T_slice,Telm,dimension,elmSize,elmAlignment>::operator>>= (cdrStream& s) const
{
if (s.marshal_byte_swap()) {
Base_T_seq::operator>>=(s);
return;
}
_CORBA_ULong l = Base_T_seq::length();
l >>= s;
if (l==0) return;
s.put_octet_array((_CORBA_Octet*)Base_T_seq::NP_data(),
(int)l*dimension*elmSize,
(omni::alignment_t)elmAlignment);
}
//////////////////////////////////////////////////////////////////////
template <class T,class T_slice,class Telm,int dimension,int elmSize,int elmAlignment>
inline
void
_CORBA_Unbounded_Sequence_Array_w_FixSizeElement<T,T_slice,Telm,dimension,elmSize,elmAlignment>::operator<<= (cdrStream& s)
{
_CORBA_ULong l;
l <<= s;
if (!s.checkInputOverrun(elmSize,l*dimension)) {
_CORBA_marshal_sequence_range_check_error(s);
// never reach here
}
Base_T_seq::length(l);
if (l==0) return;
s.get_octet_array((_CORBA_Octet*)Base_T_seq::NP_data(),
(int)l*dimension*elmSize,
(omni::alignment_t)elmAlignment);
if (s.unmarshal_byte_swap() && elmAlignment != 1) {
if (elmSize == 2) {
l *= dimension;
for (_CORBA_ULong i=0; i<l; i++) {
_CORBA_UShort t = ((_CORBA_UShort*)Base_T_seq::NP_data())[i];
((_CORBA_UShort*)Base_T_seq::NP_data())[i] = Swap16(t);
}
}
else if (elmSize == 4) {
l *= dimension;
for (_CORBA_ULong i=0; i<l; i++) {
_CORBA_ULong t = ((_CORBA_ULong*)Base_T_seq::NP_data())[i];
((_CORBA_ULong*)Base_T_seq::NP_data())[i] = Swap32(t);
}
}
else if (elmSize == 8) {
l *= 2*dimension;
for (_CORBA_ULong i=0; i<l; i+=2) {
_CORBA_ULong tl1 = ((_CORBA_ULong*)Base_T_seq::NP_data())[i+1];
_CORBA_ULong tl2 = Swap32(tl1);
tl1 = ((_CORBA_ULong*)Base_T_seq::NP_data())[i];
((_CORBA_ULong*)Base_T_seq::NP_data())[i] = tl2;
((_CORBA_ULong*)Base_T_seq::NP_data())[i+1] = Swap32(tl1);
}
}
}
}
//////////////////////////////////////////////////////////////////////
template <class T,class T_slice,class Telm,int dimension,int max,int elmSize,int elmAlignment>
inline
void
_CORBA_Bounded_Sequence_Array_w_FixSizeElement<T,T_slice,Telm,dimension,max,elmSize,elmAlignment>::operator>>= (cdrStream& s) const
{
if (s.marshal_byte_swap()) {
Base_T_seq::operator>>=(s);
return;
}
_CORBA_ULong l = Base_T_seq::length();
l >>= s;
if (l==0) return;
s.put_octet_array((_CORBA_Octet*)Base_T_seq::NP_data(),
(int)l*dimension*elmSize,
(omni::alignment_t)elmAlignment);
}
//////////////////////////////////////////////////////////////////////
template <class T,class T_slice,class Telm,int dimension,int max,int elmSize,int elmAlignment>
inline
void
_CORBA_Bounded_Sequence_Array_w_FixSizeElement<T,T_slice,Telm,dimension,max,elmSize,elmAlignment>::operator<<= (cdrStream& s)
{
_CORBA_ULong l;
l <<= s;
if (!s.checkInputOverrun(elmSize,l*dimension)) {
_CORBA_marshal_sequence_range_check_error(s);
// never reach here
}
Base_T_seq::length(l);
if (l==0) return;
s.get_octet_array((_CORBA_Octet*)Base_T_seq::NP_data(),
(int)l*dimension*elmSize,
(omni::alignment_t)elmAlignment);
if (s.unmarshal_byte_swap() && elmAlignment != 1) {
if (elmSize == 2) {
l *= dimension;
for (_CORBA_ULong i=0; i<l; i++) {
_CORBA_UShort t = ((_CORBA_UShort*)Base_T_seq::NP_data())[i];
((_CORBA_UShort*)Base_T_seq::NP_data())[i] = Swap16(t);
}
}
else if (elmSize == 4) {
l *= dimension;
for (_CORBA_ULong i=0; i<l; i++) {
_CORBA_ULong t = ((_CORBA_ULong*)Base_T_seq::NP_data())[i];
((_CORBA_ULong*)Base_T_seq::NP_data())[i] = Swap32(t);
}
}
else if (elmSize == 8) {
l *= 2*dimension;
for (_CORBA_ULong i=0; i<l; i+=2) {
_CORBA_ULong tl1 = ((_CORBA_ULong*)Base_T_seq::NP_data())[i+1];
_CORBA_ULong tl2 = Swap32(tl1);
tl1 = ((_CORBA_ULong*)Base_T_seq::NP_data())[i];
((_CORBA_ULong*)Base_T_seq::NP_data())[i] = tl2;
((_CORBA_ULong*)Base_T_seq::NP_data())[i+1] = Swap32(tl1);
}
}
}
}
//////////////////////////////////////////////////////////////////////
template <class T, class ElemT,class T_Helper>
inline void
_CORBA_Sequence_ObjRef<T,ElemT,T_Helper>::operator>>= (cdrStream& s) const
{
::operator>>=(_CORBA_ULong(this->pd_len), s);
for( int i = 0; i < (int)this->pd_len; i++ )
T_Helper::marshalObjRef(pd_data[i],s);
}
//////////////////////////////////////////////////////////////////////
template <class T, class ElemT,class T_Helper>
inline void
_CORBA_Sequence_ObjRef<T,ElemT,T_Helper>::operator<<= (cdrStream& s)
{
_CORBA_ULong l;
l <<= s;
if (!s.checkInputOverrun(1,l) || (this->pd_bounded && l > this->pd_max)) {
_CORBA_marshal_sequence_range_check_error(s);
// never reach here
}
this->length(l);
for( _CORBA_ULong i = 0; i < l; i++ )
operator[](i) = T_Helper::unmarshalObjRef(s);
}
#undef Swap16
#undef Swap32
#endif // __SEQTEMPLATEDEFNS_H__
|