message event update for points and boundaries
This commit is contained in:
parent
c3821d03c0
commit
f27fbdd82c
|
@ -21,6 +21,7 @@ Licence:
|
||||||
#define __message_hpp__
|
#define __message_hpp__
|
||||||
|
|
||||||
#include <bitset>
|
#include <bitset>
|
||||||
|
#include <array>
|
||||||
|
|
||||||
#include "types.hpp"
|
#include "types.hpp"
|
||||||
#include "iOstream.hpp"
|
#include "iOstream.hpp"
|
||||||
|
@ -35,22 +36,40 @@ public:
|
||||||
enum EVENT : size_t
|
enum EVENT : size_t
|
||||||
{
|
{
|
||||||
DEFAULT = 0,
|
DEFAULT = 0,
|
||||||
CAP_CHANGED = 1,
|
CAP_CHANGED = 1, // internal points capacity changed
|
||||||
SIZE_CHANGED = 2,
|
SIZE_CHANGED = 2, // internal points size changed
|
||||||
ITEM_DELETE = 3,
|
ITEM_DELETE = 3, // internal points item deleted
|
||||||
ITEM_INSERT = 4,
|
ITEM_INSERT = 4, // internal points item inserted
|
||||||
RANGE_CHANGED = 5,
|
RANGE_CHANGED = 5, // internal points range changed
|
||||||
ITEM_REARRANGE = 6,
|
ITEM_REARRANGE = 6, // internal points item rearrange
|
||||||
ITEM_TRANSFER = 7,
|
BNDR_REARRANGE = 7, // boundary indices rearrange
|
||||||
RESET_COUNTERS = 8
|
BNDR_TRANSFER = 8, // boundary indices transfered
|
||||||
|
BNDR_RESET = 9, // boundary indices reset entirely
|
||||||
|
BNDR_DELETE = 10 // boundary indices deleted
|
||||||
};
|
};
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
static constexpr size_t numberOfEvents_ = 9;
|
private:
|
||||||
|
|
||||||
|
static constexpr size_t numberOfEvents_ = 11;
|
||||||
|
|
||||||
std::bitset<numberOfEvents_> events_{0x0000};
|
std::bitset<numberOfEvents_> events_{0x0000};
|
||||||
|
|
||||||
|
static
|
||||||
|
inline const std::array<word,numberOfEvents_> eventNames_
|
||||||
|
{
|
||||||
|
"",
|
||||||
|
"capacity",
|
||||||
|
"size",
|
||||||
|
"deletedIndices",
|
||||||
|
"insertedIndices",
|
||||||
|
"range",
|
||||||
|
"rearrangedIndices",
|
||||||
|
"rearrangedIndices",
|
||||||
|
"transferredIndices",
|
||||||
|
"",
|
||||||
|
"deletedIndices"
|
||||||
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -142,6 +161,12 @@ public:
|
||||||
return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static
|
||||||
|
const word& eventName(size_t event)
|
||||||
|
{
|
||||||
|
return eventNames_[event];
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
inline
|
inline
|
||||||
|
|
|
@ -48,6 +48,21 @@ pFlow::observer::~observer()
|
||||||
invalidateSubscriber();
|
invalidateSubscriber();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pFlow::observer &pFlow::observer::addEvent(message::EVENT event)
|
||||||
|
{
|
||||||
|
if( !message_.equivalentTo(event) )
|
||||||
|
{
|
||||||
|
message_.add(event);
|
||||||
|
if(!subscriber_->subscribe(message(event),this))
|
||||||
|
{
|
||||||
|
fatalErrorInFunction<<
|
||||||
|
"error when subcribing event from observer "<<endl;
|
||||||
|
fatalExit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
void pFlow::observer::addToSubscriber
|
void pFlow::observer::addToSubscriber
|
||||||
(
|
(
|
||||||
const subscriber* subscrbr,
|
const subscriber* subscrbr,
|
||||||
|
|
|
@ -65,6 +65,8 @@ public:
|
||||||
const subscriber* subscrbr,
|
const subscriber* subscrbr,
|
||||||
message msg);
|
message msg);
|
||||||
|
|
||||||
|
observer& addEvent(message::EVENT event);
|
||||||
|
|
||||||
inline
|
inline
|
||||||
bool subscribed()const
|
bool subscribed()const
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue