83 lines
3.0 KiB
C++
83 lines
3.0 KiB
C++
/*
|
|
* File: SemanticSplitValidator.cc
|
|
* Author: jgaebler
|
|
*
|
|
* Created on May 12, 2011, 6:01 PM
|
|
*/
|
|
|
|
#include "SemanticSplitValidator.h"
|
|
|
|
namespace ubeeme {
|
|
namespace moversight {
|
|
|
|
/**
|
|
* @brief Constructor
|
|
* @param dis A reference to the moversight dispatcher.
|
|
*/
|
|
SemanticSplitValidator::SemanticSplitValidator( Dispatcher& dis)
|
|
: MessageValidator(dis) {
|
|
}
|
|
|
|
/**
|
|
* @brief Destructor
|
|
*/
|
|
SemanticSplitValidator::~SemanticSplitValidator(){
|
|
}
|
|
|
|
/**
|
|
* @brief Checks, if the received interior message valid within the current group.
|
|
* @param msg The message to validate.
|
|
* @return True, if the received message checked as valid message within the current group, false otherwise.
|
|
*/
|
|
bool
|
|
SemanticSplitValidator::isValid( const MoversightMessage& msg) const {
|
|
return membershipService.contains( msg.getSourceID());
|
|
}
|
|
|
|
/**
|
|
* @brief Checks, if the received multicast message valid within the current view, or not (in terms of relates to the current group setting).
|
|
* @param msg The message to validate.
|
|
* @return True, if the received message checked as valid message within the current view, false otherwise.
|
|
*/
|
|
bool
|
|
SemanticSplitValidator::isValid( const MulticastMessage& msg) const {
|
|
if( membershipService.contains( msg.getSourceID())) {
|
|
if( msg.getViewID() != membershipService.getViewID()) {
|
|
if( msg.getViewID() == membershipService.getLastViewID()) {
|
|
switch (msg.getType()) {
|
|
case JA: return false;
|
|
case MCA: return false;
|
|
case SPA: return false;
|
|
case MR: return false;
|
|
case MC: return false;
|
|
case MA: return false;
|
|
case MAB: return false;
|
|
case MFL: return false;
|
|
case MF: return false;
|
|
|
|
default: return true;
|
|
}//End switch
|
|
}//End if
|
|
}//End if
|
|
else {
|
|
//get message with current view, so we can switch do standard validator
|
|
dispatcher.setStandardMessageValidator();
|
|
return true;
|
|
}//End else
|
|
}//End if
|
|
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* @brief Checks, if the received exterior message valid within the current view, or not.
|
|
* @param msg The message to validate.
|
|
* @return True, if the received message checked as valid message within the current view, false otherwise.
|
|
*/
|
|
bool
|
|
SemanticSplitValidator::isValid( const ExteriorMessage& msg) const {
|
|
return true;
|
|
}
|
|
}
|
|
}
|