00001 // PropertySeq.cpp,v 1.9 2006/03/14 06:14:34 jtc Exp 00002 00003 #include "orbsvcs/Notify/PropertySeq.h" 00004 00005 #if ! defined (__ACE_INLINE__) 00006 #include "orbsvcs/Notify/PropertySeq.inl" 00007 #endif /* __ACE_INLINE__ */ 00008 00009 ACE_RCSID(Notify, TAO_Notify_PropertySeq, "PropertySeq.cpp,v 1.9 2006/03/14 06:14:34 jtc Exp") 00010 00011 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00012 00013 TAO_Notify_PropertySeq::TAO_Notify_PropertySeq (void) 00014 { 00015 } 00016 00017 TAO_Notify_PropertySeq::~TAO_Notify_PropertySeq () 00018 { 00019 } 00020 00021 int 00022 TAO_Notify_PropertySeq::init (const CosNotification::PropertySeq& prop_seq) 00023 { 00024 ACE_CString name; 00025 00026 for (CORBA::ULong i = 0; i < prop_seq.length (); ++i) 00027 { 00028 name = prop_seq[i].name.in (); 00029 00030 if (this->property_map_.rebind (name, prop_seq[i].value) == -1) 00031 return -1; 00032 } 00033 // Note call to rebind. This allows to call <init> to set updates. 00034 00035 return 0; 00036 } 00037 00038 int 00039 TAO_Notify_PropertySeq::populate (CosNotification::PropertySeq_var& prop_seq) const 00040 { 00041 PROPERTY_MAP::CONST_ITERATOR iterator (this->property_map_); 00042 00043 int index = prop_seq->length (); 00044 prop_seq->length (static_cast<CORBA::ULong> (index + this->property_map_.current_size ())); 00045 00046 for (PROPERTY_MAP::ENTRY *entry = 0; 00047 iterator.next (entry) != 0; 00048 iterator.advance (), ++index) 00049 { 00050 (*prop_seq)[index].name = CORBA::string_dup (entry->ext_id_.c_str ()); 00051 (*prop_seq)[index].value = entry->int_id_; 00052 } 00053 00054 return 0; 00055 } 00056 00057 void 00058 TAO_Notify_PropertySeq::add(const ACE_CString& name, const CORBA::Any& val) 00059 { 00060 int ret = this->property_map_.rebind (name, val); 00061 ACE_ASSERT(ret >= 0); 00062 ACE_UNUSED_ARG (ret); // because the assert disappears in release builds 00063 } 00064 00065 TAO_END_VERSIONED_NAMESPACE_DECL