StructuredEvent

Chair for Computer Aided Medical Procedures & Augmented Reality
Lehrstuhl für Informatikanwendungen in der Medizin & Augmented Reality

THIS WEBPAGE IS DEPRECATED - please visit our new website

using namespace CosNotifyComm;

StructuredEvent

A CORBA StructuredEvent is used as a communication channel between services. It is sent by a SvcProtPushSupplier? and received by a SvcProtPushConsumer.

CosNotifyComm.idl defines a StructuredEvent as consisting of a Header, some filterable data and an arbitrary CORBA object (any) for the content.

   struct StructuredEvent {
      EventHeader header;
      FilterableEventBody filterable_data;
      any remainder_of_body;
   };

Packing an Event

Usually you send an event in a SvcProtPushSupplier? to the consumer that gets set by the ServiceManager. Note that in DWARF we use usually only the fixed header of the StrucuredEvent?; the variable header as well as the filterable data are not used. The payload is stored in the remainder_of_body.
    StructuredEvent sevnt;
    sevnt.header.fixed_header.event_type.domain_name = CORBA::string_dup( "DWARF" );
    sevnt.header.fixed_header.event_type.type_name = CORBA::string_dup( "PoseData" );
    sevnt.header.variable_header.length( 0 );
    sevnt.filterable_data.length( 0 );
    sevnt.remainder_of_body <<= myCurrentPose;  // a variable of type PoseData

Now the StructuredEvent is ready to be sent. Don't forget to check if you have a consumer.

    notifyConsumer->push_structured_event(sevnt);  // see SvcProtPushSupplier 

Unpacking an Event

Usually you receive your event in the push_structured_event method of a SvcProtPushConsumer. You then test if the event claims to be what you expect and store it in a local variable of that type.

    if(!strcmp(event.header.fixed_header.event_type.type_name, "PoseData")) {
        PoseData  *posDat;
        event.remainder_of_body >>= posDat;
    }
If the event does not contain what it claims to contain you obviously have a problem.

Q: Can one of these lines throw an exception that should be caught? -- MartinBauer - 17 Jul 2003


Edit | Attach | Refresh | Diffs | More | Revision r1.6 - 23 Mar 2005 - 20:22 - NikolasDoerfler

Lehrstuhl für Computer Aided Medical Procedures & Augmented Reality    rss.gif