| TerraLib 4.1

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files
- Examples

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Types | Public Member Functions | Protected Types | Protected Member Functions
TeCommunicator< DataType > Class Template Reference
General purpose utilitary functions

This is the template class to deal with inter-class communication. More...

`#include <TeCommunicator.h>`

List of all members.

## Public Types

typedef void(* | WrapperFuncPtrT )(const DataType &, void *)
| The objects wrapper function pointer.

## Public Member Functions

| TeCommunicator (void *host_obj_ptr=0, WrapperFuncPtrT wrapper_func_ptr=0, bool enabled_flag=true)
| Default Constructor.
| ~TeCommunicator ()
| Default Destructor.
void | setHostObj (void *host_obj_ptr=0, WrapperFuncPtrT wrapper_func_ptr=0)
| Connects the current instance to a class wrapper function.
bool | connect (TeCommunicator< DataType > &external)
| Connects the current instance to another active instance.
void | disconnect ()
| Disconnects the current instance from all connected instances.
void | disconnect (TeCommunicator< DataType > &external)
| Disconnects the current instance from another instance.
void | send (const DataType &data) const
| Send data to all connected instances.
void | toggle (bool enabled_flag)
| Enables/disables the data emission and rececption.
bool | isEnabled ()
| Check if this instance emission/reception is enabled.

## Protected Types

typedef TeCommunicator < DataType > * | ComPtrT
typedef std::list< ComPtrT > | ContainerT
typedef ContainerT::iterator | ContItT

## Protected Member Functions

void | ConnectMe (ComPtrT my_pointer)
| Used when another active instance requests to be connected to this instance.
void | DisconnectMe (ComPtrT my_pointer)
| Used when another active instance requests to be disconnected from this instance.
void | Receive (const DataType &data) const
| Used when another active instance sends data to this instance.

## Detailed Description

### template<typename DataType>
class TeCommunicator< DataType >

This is the template class to deal with inter-class communication.

Note:
  This is a thread-safe class.

Author:
  Emiliano F. Castejon <castejon@dpi.inpe.br>

## Member Typedef Documentation

template<typename DataType>

TeCommunicator< DataType > * TeCommunicator< DataType >::ComPtrT`[protected]`

Communicator pointer type definition.

template<typename DataType>

std::list< ComPtrT > TeCommunicator< DataType >::ContainerT`[protected]`

Connected communicators pointers container type definition.

template<typename DataType>

typename ContainerT::iterator TeCommunicator< DataType >::ContItT`[protected]`

Connected communicators pointers container iterator type definition.

template<typename DataType>

typedef void(* TeCommunicator< DataType >::WrapperFuncPtrT)(const DataType &, void *)

The objects wrapper function pointer.

Parameters:

  DataType | The data type.
  void | A cast pointer to the active object instance.

## Constructor & Destructor Documentation

template<typename DataType >

TeCommunicator< DataType >::TeCommunicator | ( | void * | host_obj_ptr = `0`,
|  | WrapperFuncPtrT | wrapper_func_ptr = `0`,
|  | bool | enabled_flag = `true`
| ) |  |

Default Constructor.

Parameters:

  host_obj_ptr | A pointer to the active class instance.
  wrapper_func_ptr | A pointer to the class wrapper static function.
  enabled_flag | The emission/reception enabling/disabling flag.

template<typename DataType >

TeCommunicator< DataType >::~TeCommunicator | ( |  | ) |

Default Destructor.

## Member Function Documentation

template<typename DataType>

bool TeCommunicator< DataType >::connect | ( | TeCommunicator< DataType > & | external | ) |

Connects the current instance to another active instance.

Parameters:

  external | The external active instance reference.

Returns:
  true if OK, false on errors.

template<typename DataType >

void TeCommunicator< DataType >::ConnectMe | ( | ComPtrT | my_pointer | ) | `[protected]`

Used when another active instance requests to be connected to this instance.

Parameters:

  my_pointer | The pointer of the active instance.

template<typename DataType>

void TeCommunicator< DataType >::disconnect | ( | TeCommunicator< DataType > & | external | ) |

Disconnects the current instance from another instance.

Parameters:

  external | The external active instance reference.

template<typename DataType >

void TeCommunicator< DataType >::disconnect | ( |  | ) |

Disconnects the current instance from all connected instances.

template<typename DataType >

void TeCommunicator< DataType >::DisconnectMe | ( | ComPtrT | my_pointer | ) | `[protected]`

Used when another active instance requests to be disconnected from this instance.

Parameters:

  my_pointer | The pointer of the active instance.

template<typename DataType >

bool TeCommunicator< DataType >::isEnabled | ( |  | ) |

Check if this instance emission/reception is enabled.

Returns:
  true if enabled, false if disabled.

template<typename DataType>

void TeCommunicator< DataType >::Receive | ( | const DataType & | data | ) | const`[inline, protected]`

Used when another active instance sends data to this instance.

Parameters:

  data | The sent data.

template<typename DataType>

void TeCommunicator< DataType >::send | ( | const DataType & | data | ) | const

Send data to all connected instances.

Parameters:

  data | The data to be sent.

template<typename DataType >

void TeCommunicator< DataType >::setHostObj | ( | void * | host_obj_ptr = `0`,
|  | WrapperFuncPtrT | wrapper_func_ptr = `0`
| ) |  |

Connects the current instance to a class wrapper function.

Parameters:

  host_obj_ptr | A pointer to the active class instance.
  wrapper_func_ptr | A pointer to the class wrapper static function.

template<typename DataType >

void TeCommunicator< DataType >::toggle | ( | bool | enabled_flag | ) |

Enables/disables the data emission and rececption.

Parameters:

  enabled_flag | The emission/reception enabling/disabling flag.

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

- E:/Projetos_Primeiro_Semestre_2012/TerraView/terralib/src/terralib/kernel/TeCommunicator.h

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines