//----------------------------------------------------------------------------- void Supplier::populateHeader(const CORBA::Any &any) { if (any.type()->kind()!=CORBA::tk_sequence) { setEventType(any.type()->name()); } else { std::string etName= acsnc::SEQUENCE_EVENT_TYPE_PREFIX; //_SequenceOf_ CORBA::Any a; a._tao_set_typecode(any.type()->content_type()); etName+=a.type()->name(); setEventType(etName.c_str()); } populateHeader(event_m); event_m.filterable_data[0].value = any; }
//----------------------------------------------------------------------------- void ArchiveSupplier::send_event(CORBA::Short priority, ACS::Time timeStamp, const std::string& component, const std::string& property, CORBA::Any value, const std::string& container) { //would save space to make this a member variable but there could //be problems with multi-threaded apps CosNotification::StructuredEvent archiving_event; populateHeader(archiving_event); //the eventName consists of container named concatenated with the //component and property names, delimited by ':'s. const char *separator = ":"; ACE_CString eventName = container.c_str(); eventName += separator; eventName += component.c_str(); eventName += separator; eventName += property.c_str(); //std::string eventName = container + ":" + component + ":" + property; //save a CORBA any by placing the container/component/property names in the event_name archiving_event.header.fixed_header.event_name = CORBA::string_dup(eventName.c_str()); //there are only two elements within filterable_data: the time_stamp and the value archiving_event.filterable_data.length(2); archiving_event.filterable_data[0].name = CORBA::string_dup("time_stamp"); archiving_event.filterable_data[0].value <<= timeStamp; archiving_event.filterable_data[1].name = CORBA::string_dup("value"); archiving_event.filterable_data[1].value = value; //delegate to another method which will actually send the event try{ this->publishEvent(archiving_event); } catch(ACSErrTypeCORBA::CORBAReferenceNilExImpl& ex1) { acsncErrType::PublishEventFailureExImpl ex2 (__FILE__, __LINE__, "ArchiveSupplier::send_event"); ex2.setEventName("archiving_event"); ex2.setChannelName(channelName_mp); throw ex2; } catch(ACSErrTypeCORBA::NarrowFailedExImpl& ex1) { acsncErrType::PublishEventFailureExImpl ex2 (__FILE__, __LINE__, "ArchiveSupplier::send_event"); ex2.setEventName("archiving_event"); ex2.setChannelName(channelName_mp); throw ex2; } catch(ACSErrTypeCORBA::FailedToResolveServiceExImpl& ex1) { acsncErrType::PublishEventFailureExImpl ex2 (__FILE__, __LINE__, "ArchiveSupplier::send_event"); ex2.setEventName("archiving_event"); ex2.setChannelName(channelName_mp); throw ex2; } }
//----------------------------------------------------------------------------- void Supplier::publishEvent(const CORBA::Any &eventData) { populateHeader(eventData); publishEvent(event_m); }