From 4c8aad127d9504c7d355975180f877f5baa9f744 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 5 Feb 2007 06:23:05 +0000 Subject: It's aliiiiivee! git-svn-id: http://svn.drobilla.net/lad/machina@278 a436a847-0d15-0410-975c-d299462d15a1 --- src/Node.hpp | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'src/Node.hpp') diff --git a/src/Node.hpp b/src/Node.hpp index 40fc6f3..e5a3dbe 100644 --- a/src/Node.hpp +++ b/src/Node.hpp @@ -19,6 +19,7 @@ #include #include +#include #include "types.hpp" #include "Action.hpp" @@ -31,12 +32,15 @@ class Edge; * * It contains a action, as well as a duration and pointers to it's * successors (states/nodes that (may) follow it). + * + * Initial nodes do not have enter actions (since they are entered at + * an undefined point in time <= 0). */ class Node : public boost::noncopyable { public: typedef std::string ID; - Node(FrameCount duration=0); + Node(FrameCount duration=0, bool initial=false); void add_enter_action(Action* action); void remove_enter_action(Action* action); @@ -47,23 +51,24 @@ public: void enter(Timestamp time); void exit(Timestamp time); - void add_outgoing_edge(Edge* edge); - void remove_outgoing_edge(Edge* edge); - - Timestamp process(Timestamp time, FrameCount nframes); + void add_outgoing_edge(SharedPtr edge); + void remove_outgoing_edge(SharedPtr edge); + bool is_initial() const { return _is_initial; } + void set_initial(bool i) { _is_initial = i; } bool is_active() const { return _is_active; } - Timestamp start_time() const { return _start_time; } - Timestamp end_time() const { return _start_time + _duration; } + Timestamp enter_time() const { return _enter_time; } + Timestamp exit_time() const { return _enter_time + _duration; } FrameCount duration() { return _duration; } void set_duration(FrameCount d) { _duration = d; } - typedef std::list EdgeList; + typedef std::list > EdgeList; const EdgeList& outgoing_edges() const { return _outgoing_edges; } private: + bool _is_initial; bool _is_active; - Timestamp _start_time; ///< valid iff _is_active + Timestamp _enter_time; ///< valid iff _is_active FrameCount _duration; Action* _enter_action; Action* _exit_action; -- cgit v1.2.1