OpenDDS::DCPS::InstanceState Class Reference

manage the states of a received data instance. More...

#include <InstanceState.h>

Inheritance diagram for OpenDDS::DCPS::InstanceState:

Inheritance graph
[legend]
Collaboration diagram for OpenDDS::DCPS::InstanceState:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 InstanceState (DataReaderImpl *reader, ACE_Recursive_Thread_Mutex &lock, DDS::InstanceHandle_t handle)
 Constructor.
virtual ~InstanceState ()
 Destructor.
void sample_info (DDS::SampleInfo &si, const ReceivedDataElement *de)
 Populate the SampleInfo structure.
DDS::InstanceStateKind instance_state () const
 Access instance state.
DDS::ViewStateKind view_state () const
 Access view state.
size_t disposed_generation_count () const
 Access disposed generation count.
size_t no_writers_generation_count () const
 Access no writers generation count.
bool dispose_was_received (const PublicationId &writer_id)
bool unregister_was_received (const PublicationId &writer_id)
void data_was_received (const PublicationId &writer_id)
 Data sample received for this instance.
void lively (const PublicationId &writer_id)
 LIVELINESS message received for this DataWriter.
void accessed ()
 A read or take operation has been performed on this instance.
bool most_recent_generation (ReceivedDataElement *item) const
void empty (bool value)
 DataReader has become empty.
void schedule_pending ()
 Schedule a pending release of resources.
void schedule_release ()
 Schedule an immediate release of resources.
void cancel_release ()
 Cancel a scheduled or pending release of resources.
void release_if_empty ()
void release ()
 Remove the instance immediately.
void writer_became_dead (const PublicationId &writer_id, int num_alive_writers, const ACE_Time_Value &when)
 tell this instance when a DataWriter transitions to NOT_ALIVE
DataReaderImpldata_reader () const
virtual int handle_timeout (const ACE_Time_Value &current_time, const void *arg)
void set_owner (const PublicationId &owner)
PublicationIdget_owner ()
bool is_exclusive () const
bool registered ()
void registered (bool flag)
bool is_last (const PublicationId &pub)
bool no_writer () const
void reset_ownership (::DDS::InstanceHandle_t instance)

Private Types

typedef std::set< PublicationId,
GUID_tKeyLessThan
Writers

Private Attributes

ACE_Recursive_Thread_Mutex & lock_
DDS::InstanceStateKind instance_state_
DDS::ViewStateKind view_state_
size_t disposed_generation_count_
size_t no_writers_generation_count_
bool empty_
bool release_pending_
long release_timer_id_
DataReaderImplreader_
DDS::InstanceHandle_t handle_
Writers writers_
PublicationId owner_
bool exclusive_
bool registered_

Detailed Description

manage the states of a received data instance.

Provide a mechanism to manage the view state and instance state values for an instance contained within a DataReader. The instance_state and view_state are managed by this class. Accessors are provided to query the current value of each of these states.


Member Typedef Documentation

typedef std::set<PublicationId, GUID_tKeyLessThan> OpenDDS::DCPS::InstanceState::Writers [private]


Constructor & Destructor Documentation

OpenDDS::DCPS::InstanceState::InstanceState ( DataReaderImpl reader,
ACE_Recursive_Thread_Mutex &  lock,
DDS::InstanceHandle_t  handle 
)

Constructor.

OpenDDS::DCPS::InstanceState::~InstanceState (  )  [virtual]

Destructor.


Member Function Documentation

ACE_INLINE void OpenDDS::DCPS::InstanceState::accessed (  ) 

A read or take operation has been performed on this instance.

void OpenDDS::DCPS::InstanceState::cancel_release (  ) 

Cancel a scheduled or pending release of resources.

ACE_INLINE OpenDDS::DCPS::DataReaderImpl * OpenDDS::DCPS::InstanceState::data_reader (  )  const

ACE_INLINE void OpenDDS::DCPS::InstanceState::data_was_received ( const PublicationId writer_id  ) 

Data sample received for this instance.

bool OpenDDS::DCPS::InstanceState::dispose_was_received ( const PublicationId writer_id  ) 

DISPOSE message received for this instance. Return flag indicates whether the instance state was changed. This flag is used by concreate DataReader to determine whether it should notify listener. If state is not changed, the dispose message is ignored.

ACE_INLINE size_t OpenDDS::DCPS::InstanceState::disposed_generation_count (  )  const

Access disposed generation count.

ACE_INLINE void OpenDDS::DCPS::InstanceState::empty ( bool  value  ) 

DataReader has become empty.

OpenDDS::DCPS::PublicationId & OpenDDS::DCPS::InstanceState::get_owner (  ) 

int OpenDDS::DCPS::InstanceState::handle_timeout ( const ACE_Time_Value &  current_time,
const void *  arg 
) [virtual]

ACE_INLINE DDS::InstanceStateKind OpenDDS::DCPS::InstanceState::instance_state (  )  const

Access instance state.

bool OpenDDS::DCPS::InstanceState::is_exclusive (  )  const

ACE_INLINE bool OpenDDS::DCPS::InstanceState::is_last ( const PublicationId pub  ) 

ACE_INLINE void OpenDDS::DCPS::InstanceState::lively ( const PublicationId writer_id  ) 

LIVELINESS message received for this DataWriter.

ACE_INLINE bool OpenDDS::DCPS::InstanceState::most_recent_generation ( ReceivedDataElement item  )  const

ACE_INLINE bool OpenDDS::DCPS::InstanceState::no_writer (  )  const

ACE_INLINE size_t OpenDDS::DCPS::InstanceState::no_writers_generation_count (  )  const

Access no writers generation count.

void OpenDDS::DCPS::InstanceState::registered ( bool  flag  ) 

bool OpenDDS::DCPS::InstanceState::registered (  ) 

void OpenDDS::DCPS::InstanceState::release (  ) 

Remove the instance immediately.

void OpenDDS::DCPS::InstanceState::release_if_empty (  ) 

Remove the instance if it's instance has no samples and no writers.

void OpenDDS::DCPS::InstanceState::reset_ownership ( ::DDS::InstanceHandle_t  instance  ) 

void OpenDDS::DCPS::InstanceState::sample_info ( DDS::SampleInfo si,
const ReceivedDataElement de 
)

Populate the SampleInfo structure.

void OpenDDS::DCPS::InstanceState::schedule_pending (  ) 

Schedule a pending release of resources.

void OpenDDS::DCPS::InstanceState::schedule_release (  ) 

Schedule an immediate release of resources.

void OpenDDS::DCPS::InstanceState::set_owner ( const PublicationId owner  ) 

bool OpenDDS::DCPS::InstanceState::unregister_was_received ( const PublicationId writer_id  ) 

UNREGISTER message received for this instance. Return flag indicates whether the instance state was changed. This flag is used by concreate DataReader to determine whether it should notify listener. If state is not changed, the unregister message is ignored.

ACE_INLINE DDS::ViewStateKind OpenDDS::DCPS::InstanceState::view_state (  )  const

Access view state.

void OpenDDS::DCPS::InstanceState::writer_became_dead ( const PublicationId writer_id,
int  num_alive_writers,
const ACE_Time_Value &  when 
)

tell this instance when a DataWriter transitions to NOT_ALIVE


Member Data Documentation

size_t OpenDDS::DCPS::InstanceState::disposed_generation_count_ [private]

Number of times the instance state changes from NOT_ALIVE_DISPOSED to ALIVE.

bool OpenDDS::DCPS::InstanceState::empty_ [private]

Keep track of whether the DataReader is empty or not.

bool OpenDDS::DCPS::InstanceState::exclusive_ [private]

DDS::InstanceHandle_t OpenDDS::DCPS::InstanceState::handle_ [private]

DDS::InstanceStateKind OpenDDS::DCPS::InstanceState::instance_state_ [private]

Current instance state.

Can have values defined as:

DDS::ALIVE_INSTANCE_STATE DDS::NOT_ALIVE_DISPOSED_INSTANCE_STATE DDS::NOT_ALIVE_NO_WRITERS_INSTANCE_STATE

and can be checked with the masks:

DDS::ANY_INSTANCE_STATE DDS::NOT_ALIVE_INSTANCE_STATE

ACE_Recursive_Thread_Mutex& OpenDDS::DCPS::InstanceState::lock_ [private]

size_t OpenDDS::DCPS::InstanceState::no_writers_generation_count_ [private]

Number of times the instance state changes from NOT_ALIVE_NO_WRITERS to ALIVE.

PublicationId OpenDDS::DCPS::InstanceState::owner_ [private]

DataReaderImpl* OpenDDS::DCPS::InstanceState::reader_ [private]

Reference to our containing reader. This is used to call back and notify the reader that liveliness has been lost on this instance. It is also queried to determine if the DataReader is empty -- that it contains no more sample data.

bool OpenDDS::DCPS::InstanceState::registered_ [private]

bool OpenDDS::DCPS::InstanceState::release_pending_ [private]

Keep track of whether the instance is waiting to be released.

long OpenDDS::DCPS::InstanceState::release_timer_id_ [private]

Keep track of a scheduled release timer.

DDS::ViewStateKind OpenDDS::DCPS::InstanceState::view_state_ [private]

Current instance view state.

Can have values defined as:

DDS::NEW_VIEW_STATE DDS::NOT_NEW_VIEW_STATE

and can be checked with the mask:

DDS::ANY_VIEW_STATE

Writers OpenDDS::DCPS::InstanceState::writers_ [private]


The documentation for this class was generated from the following files:
Generated on Wed Nov 16 15:28:46 2011 for OpenDDS by  doxygen 1.4.7