Merge pull request #1551 from DOCGroup/plm_jira_333
[ACE_TAO.git] / TAO / orbsvcs / tests / EC_Custom_Marshal / ECM_Data.cpp
blobd44792d6a43b6f897cbb3388c13f3804116f355f
1 #include "ECM_Data.h"
2 #include "tao/CDR.h"
6 CORBA::Boolean
7 operator<< (TAO_OutputCDR& cdr, ECM_Data& x)
9 // We are a little careless about error checking in this routine,
10 // because one the CDR gets the error bit on it is never disabled.
11 CORBA::ULong count = x.inventory.current_size ();
12 if (cdr << x.description.in ()
13 && cdr << count )
15 for (ECM_Data::Inventory::ITERATOR i = x.inventory.begin ();
16 i != x.inventory.end () && cdr.good_bit ();
17 ++i)
19 const ECM_Data::Inventory::ENTRY& v = *i;
20 cdr << v.ext_id_;
21 cdr << v.int_id_;
24 return cdr.good_bit ();
27 CORBA::Boolean
28 operator>> (TAO_InputCDR& cdr, ECM_Data& x)
30 // We are a little careless about error checking in this routine,
31 // because one the CDR gets the error bit on it is never disabled.
32 CORBA::ULong count;
33 if (cdr >> x.description.out ()
34 && cdr >> count)
36 // ACE_DEBUG ((LM_DEBUG, "Decoding <%d> elements\n", count));
38 for (CORBA::ULong i = 0; i < count && cdr.good_bit (); ++i)
40 CORBA::ULong ext_id;
41 CORBA::Double int_id;
42 cdr >> ext_id;
43 cdr >> int_id;
44 if (cdr.good_bit ())
45 x.inventory.bind (ext_id, int_id);
47 // ACE_DEBUG ((LM_DEBUG, "Boung <%d,%f>\n", ext_id, int_id));
50 return cdr.good_bit ();