Back to index

salome-kernel  6.5.0
Public Member Functions | Protected Attributes | Private Attributes
data_short_port_provides Class Reference

This class a port that sends a CORBA short with the basic port policy. More...

#include <data_short_port_provides.hxx>

Inheritance diagram for data_short_port_provides:
Inheritance graph
[legend]
Collaboration diagram for data_short_port_provides:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 data_short_port_provides ()
virtual ~data_short_port_provides ()
virtual void put (CORBA::Short data)
 This method implements the CORBA method of the interface.
virtual CORBA::Short get ()
 This method is used by the component to get the last value received.
virtual Ports::Port_ptr get_port_ref ()
 This method gives the port CORBA reference.
virtual void provides_port_changed (int connection_nbr, const Engines::DSC::Message message)
 This method is the callback called by the component to inform the provides port of a new or a removed connection.
virtual Ports::PortProperties_ptr get_port_properties ()
 This is used to get the property object of the port.

Protected Attributes

PortProperties_idefault_properties

Private Attributes

CORBA::Short _val
pthread_mutex_t * short_mutex
pthread_cond_t * short_condition
bool short_termine
pthread_mutex_t * short_mutex_cp
pthread_cond_t * short_condition_cp
bool short_termine_cp

Detailed Description

This class a port that sends a CORBA short with the basic port policy.

Definition at line 41 of file data_short_port_provides.hxx.


Constructor & Destructor Documentation

Definition at line 29 of file data_short_port_provides.cxx.

                                                   {
  _val = 0;
  short_termine = false;                    
  short_mutex = new pthread_mutex_t();
  pthread_mutex_init(short_mutex, NULL);
  short_condition = new pthread_cond_t();
  pthread_cond_init(short_condition, NULL);
  short_termine_cp = true;                  
  short_mutex_cp = new pthread_mutex_t();
  pthread_mutex_init(short_mutex_cp, NULL);
  short_condition_cp = new pthread_cond_t();
  pthread_cond_init(short_condition_cp, NULL);
}

Definition at line 43 of file data_short_port_provides.cxx.

                                                    {
  pthread_mutex_destroy(short_mutex);
  delete short_mutex;
  pthread_cond_destroy(short_condition);
  delete short_condition;
  pthread_mutex_destroy(short_mutex_cp);
  delete short_mutex_cp;
  pthread_cond_destroy(short_condition_cp);
  delete short_condition_cp;
}

Member Function Documentation

CORBA::Short data_short_port_provides::get ( ) [virtual]

This method is used by the component to get the last value received.

Returns:
the last value received (default 0).

Definition at line 73 of file data_short_port_provides.cxx.

                              {
  CORBA::Short result;
  pthread_mutex_lock(short_mutex);
  while (short_termine == false)
  {
     pthread_cond_wait(short_condition, short_mutex);
  }
  result = _val;
  short_termine = false;
  pthread_mutex_unlock(short_mutex);

  // On indique que l'on a copie la valeur
  pthread_mutex_lock(short_mutex_cp);
  short_termine_cp = true;
  pthread_cond_signal(short_condition_cp);
  pthread_mutex_unlock(short_mutex_cp);
  return result;
}

Here is the caller graph for this function:

Ports::PortProperties_ptr base_port::get_port_properties ( ) [virtual, inherited]

This is used to get the property object of the port.

Returns:
property's CORBA reference.

Definition at line 42 of file base_port.cxx.

{
  return default_properties->_this();
}
Ports::Port_ptr data_short_port_provides::get_port_ref ( ) [virtual]

This method gives the port CORBA reference.

Returns:
port's CORBA reference.

Implements provides_port.

Definition at line 93 of file data_short_port_provides.cxx.

                                       {
  return this->_this();
}
virtual void provides_port::provides_port_changed ( int  connection_nbr,
const Engines::DSC::Message  message 
) [inline, virtual, inherited]

This method is the callback called by the component to inform the provides port of a new or a removed connection.

Parameters:
connection_nbrcurrent connection number.
messagemessage associated with this connection.

Definition at line 60 of file provides_port.hxx.

                                                                        {}
void data_short_port_provides::put ( CORBA::Short  data) [virtual]

This method implements the CORBA method of the interface.

See also:
Ports::Data_Short_Port::put

Definition at line 55 of file data_short_port_provides.cxx.

                                             {
  // On attend que le get soit fait
  pthread_mutex_lock(short_mutex_cp);
  while (short_termine_cp == false)
  {
     pthread_cond_wait(short_condition_cp, short_mutex_cp);
  }
  short_termine_cp = false;
  pthread_mutex_unlock(short_mutex_cp);

  pthread_mutex_lock(short_mutex);
  _val = data;
  short_termine = true;
  pthread_cond_signal(short_condition);
  pthread_mutex_unlock(short_mutex);
}

Member Data Documentation

CORBA::Short data_short_port_provides::_val [private]

Definition at line 71 of file data_short_port_provides.hxx.

Definition at line 49 of file base_port.hxx.

pthread_cond_t* data_short_port_provides::short_condition [private]

Definition at line 73 of file data_short_port_provides.hxx.

Definition at line 76 of file data_short_port_provides.hxx.

pthread_mutex_t* data_short_port_provides::short_mutex [private]

Definition at line 72 of file data_short_port_provides.hxx.

pthread_mutex_t* data_short_port_provides::short_mutex_cp [private]

Definition at line 75 of file data_short_port_provides.hxx.

Definition at line 74 of file data_short_port_provides.hxx.

Definition at line 77 of file data_short_port_provides.hxx.


The documentation for this class was generated from the following files: