Class WorkCellChangedEvent


  • public class WorkCellChangedEvent
    extends java.lang.Object
    Event is used for managing subscribtions and firing of events.

    Event is used for managing subscribtions and firing of events. The signature of the
    callback method and the fire method is termined through the template arguments.

    CallBackMethod, defines the signature of the callback method needed for subscribing to
    the event.

    FireEventMethod, defines the interface for firing events.

    Example of usage in RobWorkStudio:
    In: RobWorkStudio.hpp typedef boost::functionvoid(const rw::kinematics::State) StateChangedListener; typedef EventStateChangedListener, StateChangedListener StateChangedEvent; StateChangedEvent stateChangedEvent() { return _stateChangedEvent; } void fireStateChangedEvent(const rw::kinematics::State state) { for(const StateChangedEvent::Listener listener : stateChangedEvent().getListeners()) { listener.callback(state); } } In: RobWorkStudio.cpp RobWorkStudio::RobWorkStudio(...): _stateChangedEvent(boost::bind(RobWorkStudio::fireStateChangedEvent, this, boost::arg1())), ... { ... }
    • Constructor Detail

      • WorkCellChangedEvent

        public WorkCellChangedEvent​(long cPtr,
                                    boolean cMemoryOwn)
      • WorkCellChangedEvent

        public WorkCellChangedEvent()
        constructor
    • Method Detail

      • delete

        public void delete()
      • add

        public void add​(SWIGTYPE_p_WorkCellChangedListener callback,
                        SWIGTYPE_p_void obj,
                        int id)
        Descructor.

        Adds a listener to the event

        Adds callback as a listener to the event. The optional obj and
        id are stored with callback to enable removing listeners. It is
        recommended to set obj as the object on which the callback is defined.

        Direct comparison of boost::function pointers does not work on all
        platform. It is thus necessary to provide the user with the optional
        id to enable removing a specific callback.

        Typical usage
        void MyPlugin::frameSelectedListener(rw::kinematics::Frame* frame) { ... } void MyPlugin::initialize() { getRobWorkStudio()-frameSelectedEvent().add( boost::bind(MyPlugin::frameSelectedListener, this, boost::arg1()), this); }


        Parameters:
        callback - [in] The callback function

        obj - [in] Pointer to object associated with the listener (only used
        when removing listeners)

        id - [in] Id associated with the callback (only used for removing a
        specific listener)
      • add

        public void add​(SWIGTYPE_p_WorkCellChangedListener callback,
                        SWIGTYPE_p_void obj)
        Descructor.

        Adds a listener to the event

        Adds callback as a listener to the event. The optional obj and
        id are stored with callback to enable removing listeners. It is
        recommended to set obj as the object on which the callback is defined.

        Direct comparison of boost::function pointers does not work on all
        platform. It is thus necessary to provide the user with the optional
        id to enable removing a specific callback.

        Typical usage
        void MyPlugin::frameSelectedListener(rw::kinematics::Frame* frame) { ... } void MyPlugin::initialize() { getRobWorkStudio()-frameSelectedEvent().add( boost::bind(MyPlugin::frameSelectedListener, this, boost::arg1()), this); }


        Parameters:
        callback - [in] The callback function

        obj - [in] Pointer to object associated with the listener (only used
        when removing listeners)

      • add

        public void add​(SWIGTYPE_p_WorkCellChangedListener callback)
        Descructor.

        Adds a listener to the event

        Adds callback as a listener to the event. The optional obj and
        id are stored with callback to enable removing listeners. It is
        recommended to set obj as the object on which the callback is defined.

        Direct comparison of boost::function pointers does not work on all
        platform. It is thus necessary to provide the user with the optional
        id to enable removing a specific callback.

        Typical usage
        void MyPlugin::frameSelectedListener(rw::kinematics::Frame* frame) { ... } void MyPlugin::initialize() { getRobWorkStudio()-frameSelectedEvent().add( boost::bind(MyPlugin::frameSelectedListener, this, boost::arg1()), this); }


        Parameters:
        callback - [in] The callback function



      • remove

        public void remove​(SWIGTYPE_p_void obj)
        Removes all callback method from a given obj

        All callbacks associated with obj are removed. Typical use will be to remove
        all callbacks to an object before it is destroyed.

        Parameters:
        obj - [in] Object for which to remove listeners
      • remove

        public void remove​(SWIGTYPE_p_void obj,
                           int id)
        Removes all callback methods associated with the obj and id.

        Parameters:
        obj - [in] Object associated with the callback
        id - [in] Id of the callback