📄 router.hh
字号:
#if CLICK_LINUXMODULE Vector<struct module*> _modules;#endif Router(const Router&); Router& operator=(const Router&); Connection *remove_connection(Connection *cp); void hookup_error(const Port &p, bool isoutput, const char *message, ErrorHandler *errh, bool active = false); int check_hookup_elements(ErrorHandler*); int check_hookup_range(ErrorHandler*); int check_hookup_completeness(ErrorHandler*); const char *hard_flow_code_override(int e) const; int processing_error(const Connection &conn, bool, int, ErrorHandler*); int check_push_and_pull(ErrorHandler*); void set_connections(); void sort_connections(); int connindex_lower_bound(bool isoutput, const Port &port) const; void port_list_elements(Vector<Port>&, Vector<Element*>&) const; void make_gports(); inline int ngports(bool isout) const { return _element_gport_offset[isout].back(); } inline int gport(bool isoutput, const Port &port) const; int element_lerror(ErrorHandler*, Element*, const char*, ...) const; // private handler methods void initialize_handlers(bool, bool); inline Handler* xhandler(int) const; int find_ehandler(int, const String&, bool allow_star) const; static inline Handler fetch_handler(const Element*, const String&); void store_local_handler(int eindex, Handler &h, int type); static void store_global_handler(Handler &h, int type); static inline void store_handler(const Element *element, Handler &h, int type); int global_port_flow(bool forward, Element* first_element, int first_port, ElementFilter* stop_filter, Vector<Port> &results); // global handlers static String router_read_handler(Element*, void*); /** @cond never */ friend class Master; friend class Task; friend int Element::set_nports(int, int); /** @endcond never */};/** @brief Increment the router's reference count. * * Routers are reference counted objects. A Router is created with one * reference, which is held by its Master object. Normally the Router and * all its elements will be deleted when the Master drops this reference, but * you can preserve the Router for longer by adding a reference yourself. */inline voidRouter::use(){ _refcount++;}/** @brief Return true iff the router is currently running. * * A running router has been successfully initialized (so running() implies * initialized()), and has not stopped yet. */inline boolRouter::running() const{ return _running > 0;}/** @brief Return true iff the router has been successfully initialized. */inline boolRouter::initialized() const{ return _state == ROUTER_LIVE;}/** @brief Return true iff the router's handlers have been initialized. * * handlers_ready() returns false until each element's * Element::add_handlers() method has been called. This happens after * Element::configure(), but before Element::initialize(). */inline boolRouter::handlers_ready() const{ return _state > ROUTER_PRECONFIGURE;}/** @brief Returns a vector containing all the router's elements. * @invariant elements()[i] == element(i) for all i in range. */inline const Vector<Element*>&Router::elements() const{ return _elements;}/** @brief Returns the number of elements in the router. */inline intRouter::nelements() const{ return _elements.size();}/** @brief Returns the element with index @a i. * @param i element index, or -1 for root_element() * @invariant If element(i) isn't null, then element(i)->@link Element::eindex eindex@endlink() == i. * * This function returns the element with index @a i. If @a i == * -1, returns root_element(). If @a i is otherwise out of range, * returns null. */inline Element*Router::element(int i) const{ return element(this, i);}/** @brief Returns this router's root element. * * Every router has a root Element. This element has Element::eindex() -1 and * name "". It is not configured or initialized, and doesn't appear in the * configuration; it exists only for convenience, when other Click code needs * to refer to some arbitrary element at the top level of the compound * element hierarchy. */inline Element*Router::root_element() const{ return _root_element;}inline const Vector<String>&Router::requirements() const{ return _requirements;}inline ThreadSched*Router::thread_sched() const{ return _thread_sched;}inline voidRouter::set_thread_sched(ThreadSched* ts){ _thread_sched = ts;}inline intRouter::initial_home_thread_id(Task* t, bool scheduled) const{ if (!_thread_sched) return ThreadSched::THREAD_UNKNOWN; else return _thread_sched->initial_home_thread_id(t, scheduled);}/** @cond never *//** @brief Return the NameInfo object for this router, if it exists. * * Users never need to call this. */inline NameInfo*Router::name_info() const{ return _name_info;}/** @endcond never *//** @brief Return the Master object for this router. */inline Master*Router::master() const{ return _master;}/** @brief Return the router's runcount. * * The runcount is an integer that determines whether the router is running. * A running router has positive runcount. Decrementing the router's runcount * to zero or below will cause the router to stop, although elements like * DriverManager can intercept the stop request and continue processing. * * Elements request that the router stop its processing by calling * adjust_runcount() or please_stop_driver(). */inline int32_tRouter::runcount() const{ return _runcount.value();}/** @brief Request a driver stop by adjusting the runcount by -1. * @note Equivalent to adjust_runcount(-1). */inline voidRouter::please_stop_driver(){ adjust_runcount(-1);}/** @brief Returns the router's initial configuration string. * @return The configuration string specified to the constructor. */inline const String&Router::configuration_string() const{ return _configuration;}/** @brief Returns the overriding flow code for element @a e, if any. * @param eindex element index * @return The flow code, or null if none has been set. */inline const char *Router::flow_code_override(int eindex) const{ if (_flow_code_override.size()) return hard_flow_code_override(eindex); else return 0;}inline voidRouter::activate(ErrorHandler* errh){ activate(true, errh);}/** @brief Finds an element named @a name. * @param name element name * @param errh optional error handler * * Returns the unique element named @a name, if any. If no element named @a * name is found, reports an error to @a errh and returns null. The error is * "<tt>no element named 'name'</tt>". If @a errh is null, no error is * reported. * * This function is equivalent to find(const String&, String, ErrorHandler*) * with a context argument of the empty string. */inline Element *Router::find(const String& name, ErrorHandler *errh) const{ return find(name, "", errh);}inline HashMap_ArenaFactory*Router::arena_factory() const{ return _arena_factory;}/** @brief Returns the currently-installed router this router will eventually * replace. * * This function is only meaningful during a router's initialization. If this * router was installed with the hotswap option, then hotswap_router() will * return the currently-installed router that this router will eventually * replace (assuming error-free initialization). Otherwise, hotswap_router() * will return 0. */inline Router*Router::hotswap_router() const{ return _hotswap_router;}inlineHandler::Handler(const String &name) : _name(name), _thunk1(0), _thunk2(0), _flags(0), _use_count(0), _next_by_name(-1){ _hook.rw.r = 0; _hook.rw.w = 0;}CLICK_ENDDECLS#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -