Revert "Minor modernization of DynamicAny code"
[ACE_TAO.git] / TAO / tao / Principal.cpp
blob7b5f1c318cbcf93fa7eba6b8d657ac5eafd8f60f
1 // Copyright 1994-1995 by Sun Microsystems Inc.
2 // All Rights Reserved
3 // ORB: Principal identifier pseudo-objref
5 #include "tao/Principal.h"
6 #include "tao/CDR.h"
8 #if !defined (__ACE_INLINE__)
9 #include "tao/Principal.inl"
10 #endif /* __ACE_INLINE__ */
12 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
14 CORBA::Principal::Principal ()
15 : refcount_ (1)
19 CORBA::Principal::~Principal ()
23 CORBA::Boolean
24 operator<< (TAO_OutputCDR & cdr, CORBA::Principal * x)
26 if (x != nullptr)
28 CORBA::ULong length = x->id.length ();
29 cdr.write_long (length);
30 cdr.write_octet_array (x->id.get_buffer (), length);
32 else
34 cdr.write_ulong (0);
37 return cdr.good_bit ();
40 CORBA::Boolean
41 operator>> (TAO_InputCDR & cdr, CORBA::Principal *& x)
43 CORBA::ULong length;
44 cdr.read_ulong (length);
46 if (length == 0 || !cdr.good_bit ())
48 x = nullptr;
50 else
52 ACE_NEW_RETURN (x, CORBA::Principal, 0);
53 x->id.length (length);
54 cdr.read_octet_array (x->id.get_buffer (), length);
57 return cdr.good_bit ();
60 TAO_END_VERSIONED_NAMESPACE_DECL