famouso::mw::nal::NetworkAdapter< ANL_A, ANL_B > Class Template Reference
The network adapter supports plugging of more than one network layer. More...
#include <NetworkAdapter.h>
Data Structures | |
struct | SNN |
The struct contains the short network name representation of the subject of an event for both sub networks. More... | |
Public Member Functions | |
void | publish_to_network_with_id (const SNN &snn, const Event &e, const famouso::mw::nl::DistinctNL *bnl) |
Publish to a specific network is a support functionality for higher layer e.g the famouso::mw::gwl::Gateway. | |
const bool | event_from_network_with_id (const famouso::mw::nl::DistinctNL *b) const |
Allows for checking if source of event and subscription network matches. | |
const famouso::mw::nl::DistinctNL *const | get_network_id () const |
Allows for geting the source network ID of an arised event. | |
Protected Member Functions | |
void | init () |
Initalizes the sub networks. | |
void | announce (const Subject &s, SNN &snn) |
Announces a subject on all sub networks. | |
void | publish (const SNN &snn, const Event &e) |
Publishes an event on all sub networks. | |
void | subscribe (const Subject &s, SNN &snn) |
Subscribes a subject on all sub networks. | |
int8_t | fetch (const SNN &snn, Event &e, const famouso::mw::nl::DistinctNL *bnl) |
Traverses a specific sub network for a short network name and receives an event from that specific subnetwork. | |
void | event_process_request (famouso::mw::nl::DistinctNL *const bnl) |
Is called by the higher layer to signalise that an event processing request was arised. | |
void | event_processed () |
Is called by the higher layer to signalise that the event is processed now. |
Detailed Description
template<class ANL_A, class ANL_B>
class famouso::mw::nal::NetworkAdapter< ANL_A, ANL_B >
The network adapter supports plugging of more than one network layer.
- Template Parameters:
-
ANL_A first sub network ANL_B second sub network
- Precondition:
- The type of template parameters needs to be of the type famouso::mw::anl::AbstractNetworkLayer
Member Function Documentation
void famouso::mw::nal::NetworkAdapter< ANL_A, ANL_B >::announce | ( | const Subject & | s, | |
SNN & | snn | |||
) | [inline, protected] |
Announces a subject on all sub networks.
- Parameters:
-
[in] s the subject that is announced. [out] snn is the specific short network name that is in this case the struct SNN. After the call the struct contains the short network names of the announced subject.
References famouso::mw::nal::NetworkAdapter< ANL_A, ANL_B >::SNN::SNN_A, and famouso::mw::nal::NetworkAdapter< ANL_A, ANL_B >::SNN::SNN_B.
const bool famouso::mw::nal::NetworkAdapter< ANL_A, ANL_B >::event_from_network_with_id | ( | const famouso::mw::nl::DistinctNL * | b | ) | const [inline] |
Allows for checking if source of event and subscription network matches.
This functionality is also provided for higher layers e.g. the famouso::mw::gwl::Gateway.
- Parameters:
-
[in] b network-ID that needs to be checked
- Returns:
- true if b and the source of the occurred event are equal or if the subscription comes from local because this leads to publishing on all sub networks.
- false otherwise
void famouso::mw::nal::NetworkAdapter< ANL_A, ANL_B >::event_process_request | ( | famouso::mw::nl::DistinctNL *const | bnl | ) | [inline, protected] |
Is called by the higher layer to signalise that an event processing request was arised.
- Parameters:
-
[in] bnl the sub network-ID from where the request came.
void famouso::mw::nal::NetworkAdapter< ANL_A, ANL_B >::event_processed | ( | ) | [inline, protected] |
Is called by the higher layer to signalise that the event is processed now.
int8_t famouso::mw::nal::NetworkAdapter< ANL_A, ANL_B >::fetch | ( | const SNN & | snn, | |
Event & | e, | |||
const famouso::mw::nl::DistinctNL * | bnl | |||
) | [inline, protected] |
Traverses a specific sub network for a short network name and receives an event from that specific subnetwork.
- Parameters:
-
[in] snn is the specific short network name that is in this case the struct SNN. The struct contains the short network name representation of the subject of the event for both sub networks. [out] e the event that is filled with the received event [in] bnl the network from where an event fetching was requested.
- Returns:
- -1 if snn and the snn of the last arosen packet are different
- 0 if they are equal but there is no complete event to fetch
- 1 if they are equal and e contains a complete event
- Todo:
- fetching of stacked gateway are not implemented at this stage and time triggered fetching is also not supported.
References famouso::mw::nal::NetworkAdapter< ANL_A, ANL_B >::SNN::SNN_A, and famouso::mw::nal::NetworkAdapter< ANL_A, ANL_B >::SNN::SNN_B.
const famouso::mw::nl::DistinctNL* const famouso::mw::nal::NetworkAdapter< ANL_A, ANL_B >::get_network_id | ( | ) | const [inline] |
Allows for geting the source network ID of an arised event.
This functionality is provided for higher layers e.g. the famouso::mw::gwl::Gateway.
- Returns:
- the network-ID of the arised event.
void famouso::mw::nal::NetworkAdapter< ANL_A, ANL_B >::init | ( | ) | [inline, protected] |
Initalizes the sub networks.
void famouso::mw::nal::NetworkAdapter< ANL_A, ANL_B >::publish | ( | const SNN & | snn, | |
const Event & | e | |||
) | [inline, protected] |
Publishes an event on all sub networks.
- Parameters:
-
[in] snn is the specific short network name that is in this case the struct SNN. The struct contains the short network name representation of the subject of the event for both sub networks. [in] e the event that is published.
References famouso::mw::nal::NetworkAdapter< ANL_A, ANL_B >::SNN::SNN_A, and famouso::mw::nal::NetworkAdapter< ANL_A, ANL_B >::SNN::SNN_B.
void famouso::mw::nal::NetworkAdapter< ANL_A, ANL_B >::publish_to_network_with_id | ( | const SNN & | snn, | |
const Event & | e, | |||
const famouso::mw::nl::DistinctNL * | bnl | |||
) | [inline] |
Publish to a specific network is a support functionality for higher layer e.g the famouso::mw::gwl::Gateway.
- Parameters:
-
[in] snn is the specific short network name that is in this case the struct SNN. The struct contains the short network name representation of the subject of the event for both sub networks. [in] e the Event that should be selctive published. [in] bnl the sub network in that the event e will be published.
References famouso::mw::nal::NetworkAdapter< ANL_A, ANL_B >::SNN::SNN_A, and famouso::mw::nal::NetworkAdapter< ANL_A, ANL_B >::SNN::SNN_B.
void famouso::mw::nal::NetworkAdapter< ANL_A, ANL_B >::subscribe | ( | const Subject & | s, | |
SNN & | snn | |||
) | [inline, protected] |
Subscribes a subject on all sub networks.
- Parameters:
-
[in] s the subject that is subscribed. [out] snn is the specific short network name that is in this case the struct SNN. After the call the struct contains the short network names of the subsrcibed subject.
References famouso::mw::nal::NetworkAdapter< ANL_A, ANL_B >::SNN::SNN_A, and famouso::mw::nal::NetworkAdapter< ANL_A, ANL_B >::SNN::SNN_B.
The documentation for this class was generated from the following file:
- include/mw/nal/NetworkAdapter.h