34 #if (defined(_MSC_VER) && defined(ITPP_SHARED_LIB) && !(defined(itpp_EXPORTS) || defined(itpp_debug_EXPORTS))) 36 #ifndef ITPP_PROTOCOL_EXCLUDED 37 #define ITPP_PROTOCOL_EXCLUDED 38 #pragma message( "PROTOCOL definitions are not available for MSVC shared builds" ) 71 friend class Base_Signal;
79 it_assert(delta_time >= 0,
"Only causal simulations are possible");
94 virtual void exec(
void) = 0;
102 unsigned long long int id;
112 return (event1->
id > event2->
id);
129 friend class Base_Signal;
139 static Ttype
now() {
return t;}
149 typedef std::deque<Base_Event*, std::allocator< Base_Event* > >::iterator Base_Event_Iterator;
151 static bool keep_running;
154 std::deque<Base_Event*, std::allocator<Base_Event*> >,
163 template <
class ObjectType>
168 Event(ObjectType *object_pointer,
void (ObjectType::*object_function_pointer)(),
const Ttype delta_time) :
Base_Event(delta_time) {
170 pm = object_function_pointer;
177 virtual void exec(
void) {(*po.*pm)(); }
180 void (ObjectType::*pm)();
194 void (ObjectType::*object_function_pointer)(DataType data),
195 DataType data,
const Ttype delta_time) :
Base_Event(delta_time) {
197 pm = object_function_pointer;
210 void (ObjectType::*pm)(DataType data);
221 #endif // #ifndef EVENTS_H An Event class that executes a function with some data as input when the event expires.
virtual ~Event()
Destructor.
virtual void exec(void)
Execute (call) the assigned function with user data.
static unsigned long long int global_id
ADD DOCUMENTATION HERE.
double Ttype
64-bit floating point time
Compare to events, Returns true if expire time of event1 is larger than the expire time of event2...
static Ttype now()
Return current time.
#define it_assert(t, s)
Abort if t is not true.
Ttype delta_t
ADD DOCUMENTATION HERE.
Ttype expire_t
ADD DOCUMENTATION HERE.
virtual ~Base_Event()
Destructor.
Data_Event(ObjectType *object_pointer, void(ObjectType::*object_function_pointer)(DataType data), DataType data, const Ttype delta_time)
Construct an Event to expire delta_time from now by calling the function (*object_pointer.*object_function_pointer)(data)
~Event_Queue()
Destructor.
An Event class that executes a function when the event expires.
virtual ~Data_Event()
Destructor.
virtual void exec(void)=0
ADD DOCUMENTATION HERE.
Error handling functions - header file.
bool operator()(Base_Event *event1, Base_Event *event2)
ADD DOCUMENTATION HERE.
bool active
ADD DOCUMENTATION HERE.
virtual void exec(void)
Execute (call) the assigned function.
unsigned long long int id
ADD DOCUMENTATION HERE.
Event_Queue()
Constructor.
void cancel()
Cancel an event.
Base_Event(const Ttype delta_time)
Schedule an event at time delta_time from now.
Event(ObjectType *object_pointer, void(ObjectType::*object_function_pointer)(), const Ttype delta_time)
Construct an Event to expire delta_time from now by calling the function (*object_pointer.*object_function_pointer)()