⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 time_node.h

📁 彩信浏览器
💻 H
📖 第 1 页 / 共 2 页
字号:
	bool is_alive() const {		time_state_type tst = m_state->ident(); 		return tst == ts_proactive || tst == ts_active || tst == ts_postactive;	}		bool is_activateable() const {		time_state_type tst = m_state->ident(); 		return tst == ts_proactive || tst == ts_postactive;	}		// this may be called by a second thread	bool is_active() const { return m_active;}		// For excl children, mainly: return true if the node is in fill mode	bool is_filled() const { return !m_active && m_needs_remove; }	// Returns the current interval associated with this (maybe invalid)	const interval_type& get_current_interval() const {		return m_interval;	}	// Returns the first interval associated with this (maybe invalid)	const interval_type& get_first_interval(bool asdoc = false) const;		// Returns the last interval associated with this (maybe invalid)	const interval_type& get_last_interval() const;		// Returns true when this has played any interval	bool played() const { return !m_history.empty();}		// Returns the last calc dur 	// Used to avoid recursion when a child makes calcs 	// that depend on parent simple dur	// but parent's simple dur depends on the child	time_type get_last_dur() const { return m_last_cdur;}	// Returns the priority class of this node	// Applicable for excl children.	int priority() const { return m_priority;}	void set_priority(int prio) { m_priority = prio;}		// Excl set/get flags	bool paused() const { return m_paused;}	void set_paused(bool b) { m_paused = b;}	bool deferred() const { return m_deferred;}	void set_deferred(bool b) { m_deferred = b;}		// fast forward mode	void set_ffwd_mode(bool b);		////////////////////////	// Time calculations		// Calculates the simple duration of this node	time_type calc_dur();			// Calculate interval	interval_type calc_first_interval();	interval_type calc_next_interval(interval_type prev = interval_type::unresolved);		// Re-calculate current interval end	time_type calc_current_interval_end();			std::string to_string() const;		std::string get_sig() const;	// Verifier 	static int get_node_counter() {return node_counter;} 	 	friend class time_state; 	 	// public S/O transitions	void set_deferred_interval(qtime_type timestamp);	void set_begin_event_inst(time_type inst) {m_begin_event_inst = inst;}	 protected:	context_type *m_context;		// The underlying DOM node	// Mimimize or eliminate usage after timegraph construction 	const node *m_node;		// Attributes parser	time_attrs m_attrs;		// The time type of this node	time_container_type m_type;		// The intrinsic time type of this node 	// Always false for time containers	bool m_discrete;				// The timer assigned to this node by the timegraph builder	lib::timer_control *m_timer;		// The lifetime state of this node.	// Summarizes the state variables below.	// For each state the analytic state variables below 	// take particular values.	time_state	*m_state;		// Smil timing calculator	time_calc *m_time_calc;		// The current interval associated with this time node.	// When this has not a current interval this is set to unresolved	interval_type m_interval;		// Past intervals	// Some intervals may have not "played" but they did	// affected the state of the model by propagating 	// time change notifications.	// Canceled intervals do not contribute.	std::list<interval_type> m_history;	std::list<interval_type> m_doc_history;		// Flag set when this is active 	// e.g during the current interval	bool m_active;		// Flag set when this node has finished an interval,	// has called start against its peer playable but not stop yet.	// e.g there maybe display effects that should be removed	// == this has to call stop() against its peer playable.	bool m_needs_remove;		// Accumulated repeat duration	// Incremented after the completion of a simple dur	// Last begin or repeat instance as measured by the AD timer of this node.	time_type m_rad;		// Number of completed repeat counts	// e.g. the current zero-based repeat index	long m_precounter;		// End Of Media (EOM) flag	bool m_eom_flag;		// The priority of this node	// Applicable for excl children.	int m_priority;		// Paused flag	bool m_paused;		// Accumulated pause duration	time_type m_pad;		// Register for storing pause time	time_type m_paused_sync_time;		// Defered flag	bool m_deferred;		// Fast forward mode flag	bool m_ffwd_mode;		// Sync update event	std::pair<bool, qtime_type> m_update_event;		// Sync rules	typedef std::list<sync_rule*> rule_list;		// The begin sync rules of this node.	rule_list m_begin_list;		// The end sync rules of this node.	rule_list m_end_list;		// The transOut sync rule of this node.	sync_rule *m_transout_sr;		// On reset all event instances are cleared. 	// Keep a register for holding one such instance	// The one that will start the current interval	time_type m_begin_event_inst;		// Special DOM calls sync rule of this node.	sync_rule *m_domcall_rule;		// The dependents of this node.	// Use pointers to minimize the overhead when there are no dependents	typedef std::map<sync_event, rule_list* > dependency_map;	dependency_map m_dependents;		// rule_list manipulation helpers	void get_instance_times(const rule_list& rules, time_mset& set) const;	void reset(rule_list& rules, time_node *src);		// preventing cycles flag	bool m_locked;	void lock() { m_locked = true;}	void unlock() { m_locked = false;}	bool locked() const { return m_locked;}		// when set the associated renderer should notify for DOM events	bool m_want_activate_events;	bool m_want_focusin_events;	bool m_want_focusout_events;	bool m_want_inbounds_events;	bool m_want_outofbounds_events;		// when set the associated UI should notify for accesskey events	bool m_want_accesskey;		// Cashed implicit duration of a continous media node (audio, video).	// It is set to m_mediadur when an EOM event is raised by the playing media node.	time_type m_impldur;		// Last calc_dur() result	time_type m_last_cdur;		// Provide access to the states	friend class reset_state;	friend class proactive_state;	friend class active_state;	friend class postactive_state;	friend class dead_state;		// logger	lib::logger *m_logger;	  private:	// Time states	time_state* m_time_states[ts_dead+1];	void create_time_states();    	// timing-tree bonds	time_node *m_parent;	time_node *m_next;	time_node *m_child;			// verifier	static int node_counter;	};class time_container : public time_node {  public:	time_container(context_type *ctx, const lib::node *n, time_container_type type) 	:	time_node(ctx, n, type) {}		~time_container() {}		virtual time_type get_implicit_dur();	virtual bool end_sync_cond_applicable() const;	virtual bool end_sync_cond() const;  private:	time_type calc_implicit_dur_for_esr_first(std::list<const time_node*>& cl);	time_type calc_implicit_dur_for_esr_last(std::list<const time_node*>& cl);	time_type calc_implicit_dur_for_esr_all(std::list<const time_node*>& cl);	time_type calc_implicit_dur_for_esr_id(std::list<const time_node*>& cl);};class par : public time_container {  public:	par(context_type *ctx, const lib::node *n) 	:	time_container(ctx, n, tc_par) {}	~par() {}};class seq : public time_container {  public:	seq(context_type *ctx, const lib::node *n) 	:	time_container(ctx, n, tc_seq) {}	~seq() {}	virtual time_type get_implicit_dur();	virtual bool end_sync_cond() const;};class excl_queue;class excl : public time_container {  public:	excl(context_type *ctx, const lib::node *n); 	~excl();	void interrupt(time_node *c, qtime_type timestamp);	void on_child_normal_end(time_node *c, qtime_type timestamp);	void built_priorities();	void remove(time_node *c);  private:	time_node* get_active_child();	time_node* get_filled_child();	excl_queue *m_queue;	int m_num_classes;	typedef priority_attrs* priority_attrs_ptr;	priority_attrs_ptr *m_priority_attrs;};class excl_queue {  public:	void push_pause(time_node *tn);	void push_defer(time_node *tn);	void remove(time_node *tn) { m_cont.remove(tn);}	bool empty() const { return m_cont.empty();}	time_node *pop() { 		if(m_cont.empty()) return 0;		time_node *tn = m_cont.front(); 		m_cont.pop_front();		return tn;	} 	void assert_invariants() const; private:	typedef std::list<time_node*> cont;	cont m_cont;};template <class T> T qualify(time_node *n) {	// Bad, but we can't assume RTTI available	// return dynamic_cast<T>(n);		return static_cast<T>(n);}} // namespace smil2 } // namespace ambulant#endif // AMBULANT_SMIL2_TIME_NODE_H

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -