Stock Priority Mapping definition for the Stock Quoter Publisher/Subscriber Real-time CORBA Service


The Stock Database class defines the priority mappings used by the stock objects.

Defining the Priority enum

We define five levels of prioriies as follows:

    enum Priority
    {
      VERY_LOW = 0,
      LOW = 1,
      MEDIUM = 2,
      HIGH = 3,
      VERY_HIGH = 4
    };

Implementing the register_mapping () function

The main steps of this function are described as follows:

  • Get the Priority Mapping Manager.
  •     CORBA::Object_var obj = orb->resolve_initial_references ("PriorityMappingManager");
        TAO_Priority_Mapping_Manager_var manager = TAO_Priority_Mapping_Manager::_narrow (obj.in ());
    
  • Create an instance of Stock Priority Mapping object and install it.
  •     RTCORBA::PriorityMapping *my_mapping = new Stock::Priority_Mapping;
        manager->mapping (my_mapping);
    

    Email: shanshan.jiang@vanderbilt.edu