update20140630
This commit is contained in:
121
uni/masterarbeit/source/moversight/split/SplitOptions.cc
Normal file
121
uni/masterarbeit/source/moversight/split/SplitOptions.cc
Normal file
@@ -0,0 +1,121 @@
|
||||
/*
|
||||
* File: SplitOptions.cc
|
||||
* Author: jgaebler
|
||||
*
|
||||
* Created on November 14, 2011, 6:37 PM
|
||||
*/
|
||||
|
||||
#include "SplitOptions.h"
|
||||
|
||||
|
||||
namespace ubeeme {
|
||||
namespace moversight {
|
||||
|
||||
/**
|
||||
* @brief Defines the shifts for the option parameter within the SPA message.
|
||||
*/
|
||||
enum ShiftTypes {
|
||||
SHIFT_SEMANTIC = 0x7, //0b00000111,
|
||||
SHIFT_FLUSH = 0x6, //0b00000110,
|
||||
SHIFT_REPLY = 0x5 //0b00000101
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Defines the test bit for each synchronisation
|
||||
*/
|
||||
enum SyncTypes {
|
||||
FLUSH = 0x1, //0b00000001,
|
||||
SEMANTIC = 0x1, //0b00000001
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Defines the bit masks for the reply parameter within the SPA message.
|
||||
*/
|
||||
enum ReplyTypes {
|
||||
REPLY_ALL = 0x1, //0b00000001
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Constructor
|
||||
*/
|
||||
SplitOptions::SplitOptions(){
|
||||
options = '\0';
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Constructor
|
||||
* @param o The options to store as bit pattern.
|
||||
*/
|
||||
SplitOptions::SplitOptions(unsigned char o) {
|
||||
options = o;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Destructor
|
||||
*/
|
||||
SplitOptions::~SplitOptions() {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Check if a semantic synchronisation shall start.
|
||||
* @param options The options where the semantic flag is set. Get by bit shifting.
|
||||
* @return True if the semantic flag is set in options otherwise false.
|
||||
*/
|
||||
bool
|
||||
SplitOptions::isSemanticValidation() const {
|
||||
|
||||
unsigned char semantic = options >> SHIFT_SEMANTIC;
|
||||
|
||||
if ((semantic & SEMANTIC) == SEMANTIC) {
|
||||
return true;
|
||||
}// End if
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Check if a flush synchronisation shall start.
|
||||
* @param options The options where the flush flag is set. Get by bit shifting.
|
||||
* @return True if the flush flag is set in options otherwise false.
|
||||
*/
|
||||
bool
|
||||
SplitOptions::isFlushSynchronisation() const {
|
||||
|
||||
unsigned char flush = options >> SHIFT_FLUSH;
|
||||
|
||||
if ((flush & FLUSH) == FLUSH) {
|
||||
return true;
|
||||
}// End if
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Check if the reply all option is set.
|
||||
* @return True, should each peer response, which should be segregated, false otherwhise.
|
||||
*/
|
||||
bool
|
||||
SplitOptions::isReplyAll() const {
|
||||
|
||||
unsigned char reply = options >> SHIFT_REPLY;
|
||||
|
||||
if ((reply && REPLY_ALL) == REPLY_ALL ) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Permits access to the raw option bit sequence.
|
||||
* @return The options as bit sequence.
|
||||
*/
|
||||
unsigned char
|
||||
SplitOptions::getRaw() const {
|
||||
return options;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user