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

📄 signal.h

📁 qnx下sigc++的源代码
💻 H
📖 第 1 页 / 共 2 页
字号:

/// @ingroup Signals
template <class R,class P1,class P2,class P3,class P4,class P5,class Marsh=Marshal<R> >
class Signal5 : public SignalBase
  {
    public:
      typedef Slot5<R,P1,P2,P3,P4,P5> InSlotType;
      typedef Slot5<typename Marsh::OutType,P1,P2,P3,P4,P5> OutSlotType;
      typedef typename Trait<typename Marsh::OutType>::type OutType;
 
    private:
      // Used for both emit and proxy.
      static OutType emit_(typename Trait<P1>::ref p1,typename Trait<P2>::ref p2,typename Trait<P3>::ref p3,typename Trait<P4>::ref p4,typename Trait<P5>::ref p5,void* data);

    public:
      OutSlotType slot() const
        { return create_slot((FuncPtr)(&emit_)); }

      operator OutSlotType() const
        { return create_slot((FuncPtr)(&emit_)); }

      /// You can call Connection::disconnect() later.
      Connection connect(const InSlotType& s)
        { return Connection(push_back(s)); }

      /// Call all the connected methods.
      OutType emit(typename Trait<P1>::ref p1,typename Trait<P2>::ref p2,typename Trait<P3>::ref p3,typename Trait<P4>::ref p4,typename Trait<P5>::ref p5)
        { return emit_(p1,p2,p3,p4,p5,impl_); }

      /// See emit()
      OutType operator()(typename Trait<P1>::ref p1,typename Trait<P2>::ref p2,typename Trait<P3>::ref p3,typename Trait<P4>::ref p4,typename Trait<P5>::ref p5)
        { return emit_(p1,p2,p3,p4,p5,impl_); }
 
      Signal5() 
        : SignalBase() 
        {}

      Signal5(const InSlotType& s)
        : SignalBase() 
        { connect(s); }

      ~Signal5() {}
  };


// emit
template <class R,class P1,class P2,class P3,class P4,class P5,class Marsh>
typename Signal5<R,P1,P2,P3,P4,P5,Marsh>::OutType
Signal5<R,P1,P2,P3,P4,P5,Marsh>::emit_(typename Trait<P1>::ref p1,typename Trait<P2>::ref p2,typename Trait<P3>::ref p3,typename Trait<P4>::ref p4,typename Trait<P5>::ref p5,void* data)
  {
    SignalNode* impl = static_cast<SignalNode*>(data);

    if (!impl || !impl->begin_)
      return Marsh::default_value();

    Exec exec(impl);
    Marsh rc;
    SlotNode* s = 0;

    for (SignalConnectionNode* i = impl->begin_; i; i=i->next_)
      {
        if (i->blocked()) continue;
        s = i->dest();
        if (rc.marshal(((typename Slot5<R,P1,P2,P3,P4,P5>::Proxy)(s->proxy_))(p1,p2,p3,p4,p5,s)))
          return rc.value();
      }
    return rc.value();
  }



#ifdef SIGC_CXX_PARTIAL_SPEC

/// @ingroup Signals
template <class Marsh>
class Signal0<void,Marsh> : public SignalBase
  {
    public:
      typedef Slot0<void> InSlotType;
      typedef InSlotType OutSlotType;
      typedef void OutType;
 
    private:
      // Used for both emit and proxy.
      static OutType emit_(void* data);

    public:
      OutSlotType slot() const
        { return create_slot((FuncPtr)(&emit_)); }

      operator OutSlotType() const
        { return create_slot((FuncPtr)(&emit_)); }

      /// You can call Connection::disconnect() later.
      Connection connect(const InSlotType& s)
        { return Connection(push_back(s)); }

      /// Call all the connected methods.
      OutType emit()
        {  emit_(impl_); }

      /// See emit()
      OutType operator()()
        {  emit_(impl_); }
 
      Signal0() 
        : SignalBase() 
        {}

      Signal0(const InSlotType& s)
        : SignalBase() 
        { connect(s); }

      ~Signal0() {}
  };


// emit
template <class Marsh>
void Signal0<void,Marsh>::emit_(void* data)
  {
    SignalNode* impl = static_cast<SignalNode*>(data);

    if (!impl||!impl->begin_)
      return;

    Exec exec(impl);
    SlotNode* s = 0;
    for (SignalConnectionNode* i = impl->begin_; i; i = i->next_)
      {
        if (i->blocked())
          continue;

        s = i->dest();
        ((typename Slot0<void>::Proxy)(s->proxy_))(s);
      }
    return;
  }



/// @ingroup Signals
template <class P1,class Marsh>
class Signal1<void,P1,Marsh> : public SignalBase
  {
    public:
      typedef Slot1<void,P1> InSlotType;
      typedef InSlotType OutSlotType;
      typedef void OutType;
 
    private:
      // Used for both emit and proxy.
      static OutType emit_(typename Trait<P1>::ref p1,void* data);

    public:
      OutSlotType slot() const
        { return create_slot((FuncPtr)(&emit_)); }

      operator OutSlotType() const
        { return create_slot((FuncPtr)(&emit_)); }

      /// You can call Connection::disconnect() later.
      Connection connect(const InSlotType& s)
        { return Connection(push_back(s)); }

      /// Call all the connected methods.
      OutType emit(typename Trait<P1>::ref p1)
        {  emit_(p1,impl_); }

      /// See emit()
      OutType operator()(typename Trait<P1>::ref p1)
        {  emit_(p1,impl_); }
 
      Signal1() 
        : SignalBase() 
        {}

      Signal1(const InSlotType& s)
        : SignalBase() 
        { connect(s); }

      ~Signal1() {}
  };


// emit
template <class P1,class Marsh>
void Signal1<void,P1,Marsh>::emit_(typename Trait<P1>::ref p1,void* data)
  {
    SignalNode* impl = static_cast<SignalNode*>(data);

    if (!impl||!impl->begin_)
      return;

    Exec exec(impl);
    SlotNode* s = 0;
    for (SignalConnectionNode* i = impl->begin_; i; i = i->next_)
      {
        if (i->blocked())
          continue;

        s = i->dest();
        ((typename Slot1<void,P1>::Proxy)(s->proxy_))(p1,s);
      }
    return;
  }



/// @ingroup Signals
template <class P1,class P2,class Marsh>
class Signal2<void,P1,P2,Marsh> : public SignalBase
  {
    public:
      typedef Slot2<void,P1,P2> InSlotType;
      typedef InSlotType OutSlotType;
      typedef void OutType;
 
    private:
      // Used for both emit and proxy.
      static OutType emit_(typename Trait<P1>::ref p1,typename Trait<P2>::ref p2,void* data);

    public:
      OutSlotType slot() const
        { return create_slot((FuncPtr)(&emit_)); }

      operator OutSlotType() const
        { return create_slot((FuncPtr)(&emit_)); }

      /// You can call Connection::disconnect() later.
      Connection connect(const InSlotType& s)
        { return Connection(push_back(s)); }

      /// Call all the connected methods.
      OutType emit(typename Trait<P1>::ref p1,typename Trait<P2>::ref p2)
        {  emit_(p1,p2,impl_); }

      /// See emit()
      OutType operator()(typename Trait<P1>::ref p1,typename Trait<P2>::ref p2)
        {  emit_(p1,p2,impl_); }
 
      Signal2() 
        : SignalBase() 
        {}

      Signal2(const InSlotType& s)
        : SignalBase() 
        { connect(s); }

      ~Signal2() {}
  };


// emit
template <class P1,class P2,class Marsh>
void Signal2<void,P1,P2,Marsh>::emit_(typename Trait<P1>::ref p1,typename Trait<P2>::ref p2,void* data)
  {
    SignalNode* impl = static_cast<SignalNode*>(data);

    if (!impl||!impl->begin_)
      return;

    Exec exec(impl);
    SlotNode* s = 0;
    for (SignalConnectionNode* i = impl->begin_; i; i = i->next_)
      {
        if (i->blocked())
          continue;

        s = i->dest();
        ((typename Slot2<void,P1,P2>::Proxy)(s->proxy_))(p1,p2,s);
      }
    return;
  }



/// @ingroup Signals
template <class P1,class P2,class P3,class Marsh>
class Signal3<void,P1,P2,P3,Marsh> : public SignalBase
  {
    public:
      typedef Slot3<void,P1,P2,P3> InSlotType;
      typedef InSlotType OutSlotType;
      typedef void OutType;
 
    private:
      // Used for both emit and proxy.
      static OutType emit_(typename Trait<P1>::ref p1,typename Trait<P2>::ref p2,typename Trait<P3>::ref p3,void* data);

    public:
      OutSlotType slot() const
        { return create_slot((FuncPtr)(&emit_)); }

      operator OutSlotType() const
        { return create_slot((FuncPtr)(&emit_)); }

      /// You can call Connection::disconnect() later.
      Connection connect(const InSlotType& s)
        { return Connection(push_back(s)); }

      /// Call all the connected methods.
      OutType emit(typename Trait<P1>::ref p1,typename Trait<P2>::ref p2,typename Trait<P3>::ref p3)
        {  emit_(p1,p2,p3,impl_); }

      /// See emit()
      OutType operator()(typename Trait<P1>::ref p1,typename Trait<P2>::ref p2,typename Trait<P3>::ref p3)
        {  emit_(p1,p2,p3,impl_); }
 
      Signal3() 
        : SignalBase() 
        {}

      Signal3(const InSlotType& s)
        : SignalBase() 
        { connect(s); }

      ~Signal3() {}
  };


// emit
template <class P1,class P2,class P3,class Marsh>
void Signal3<void,P1,P2,P3,Marsh>::emit_(typename Trait<P1>::ref p1,typename Trait<P2>::ref p2,typename Trait<P3>::ref p3,void* data)
  {
    SignalNode* impl = static_cast<SignalNode*>(data);

    if (!impl||!impl->begin_)
      return;

    Exec exec(impl);
    SlotNode* s = 0;
    for (SignalConnectionNode* i = impl->begin_; i; i = i->next_)
      {
        if (i->blocked())
          continue;

        s = i->dest();
        ((typename Slot3<void,P1,P2,P3>::Proxy)(s->proxy_))(p1,p2,p3,s);
      }
    return;
  }



/// @ingroup Signals
template <class P1,class P2,class P3,class P4,class Marsh>
class Signal4<void,P1,P2,P3,P4,Marsh> : public SignalBase
  {
    public:
      typedef Slot4<void,P1,P2,P3,P4> InSlotType;
      typedef InSlotType OutSlotType;
      typedef void OutType;
 
    private:
      // Used for both emit and proxy.
      static OutType emit_(typename Trait<P1>::ref p1,typename Trait<P2>::ref p2,typename Trait<P3>::ref p3,typename Trait<P4>::ref p4,void* data);

    public:
      OutSlotType slot() const
        { return create_slot((FuncPtr)(&emit_)); }

      operator OutSlotType() const
        { return create_slot((FuncPtr)(&emit_)); }

      /// You can call Connection::disconnect() later.
      Connection connect(const InSlotType& s)
        { return Connection(push_back(s)); }

      /// Call all the connected methods.
      OutType emit(typename Trait<P1>::ref p1,typename Trait<P2>::ref p2,typename Trait<P3>::ref p3,typename Trait<P4>::ref p4)
        {  emit_(p1,p2,p3,p4,impl_); }

      /// See emit()
      OutType operator()(typename Trait<P1>::ref p1,typename Trait<P2>::ref p2,typename Trait<P3>::ref p3,typename Trait<P4>::ref p4)
        {  emit_(p1,p2,p3,p4,impl_); }
 
      Signal4() 
        : SignalBase() 
        {}

      Signal4(const InSlotType& s)
        : SignalBase() 
        { connect(s); }

      ~Signal4() {}
  };


// emit
template <class P1,class P2,class P3,class P4,class Marsh>
void Signal4<void,P1,P2,P3,P4,Marsh>::emit_(typename Trait<P1>::ref p1,typename Trait<P2>::ref p2,typename Trait<P3>::ref p3,typename Trait<P4>::ref p4,void* data)
  {
    SignalNode* impl = static_cast<SignalNode*>(data);

    if (!impl||!impl->begin_)
      return;

    Exec exec(impl);
    SlotNode* s = 0;
    for (SignalConnectionNode* i = impl->begin_; i; i = i->next_)
      {
        if (i->blocked())
          continue;

        s = i->dest();
        ((typename Slot4<void,P1,P2,P3,P4>::Proxy)(s->proxy_))(p1,p2,p3,p4,s);
      }
    return;
  }



/// @ingroup Signals
template <class P1,class P2,class P3,class P4,class P5,class Marsh>
class Signal5<void,P1,P2,P3,P4,P5,Marsh> : public SignalBase
  {
    public:
      typedef Slot5<void,P1,P2,P3,P4,P5> InSlotType;
      typedef InSlotType OutSlotType;
      typedef void OutType;
 
    private:
      // Used for both emit and proxy.
      static OutType emit_(typename Trait<P1>::ref p1,typename Trait<P2>::ref p2,typename Trait<P3>::ref p3,typename Trait<P4>::ref p4,typename Trait<P5>::ref p5,void* data);

    public:
      OutSlotType slot() const
        { return create_slot((FuncPtr)(&emit_)); }

      operator OutSlotType() const
        { return create_slot((FuncPtr)(&emit_)); }

      /// You can call Connection::disconnect() later.
      Connection connect(const InSlotType& s)
        { return Connection(push_back(s)); }

      /// Call all the connected methods.
      OutType emit(typename Trait<P1>::ref p1,typename Trait<P2>::ref p2,typename Trait<P3>::ref p3,typename Trait<P4>::ref p4,typename Trait<P5>::ref p5)
        {  emit_(p1,p2,p3,p4,p5,impl_); }

      /// See emit()
      OutType operator()(typename Trait<P1>::ref p1,typename Trait<P2>::ref p2,typename Trait<P3>::ref p3,typename Trait<P4>::ref p4,typename Trait<P5>::ref p5)
        {  emit_(p1,p2,p3,p4,p5,impl_); }
 
      Signal5() 
        : SignalBase() 
        {}

      Signal5(const InSlotType& s)
        : SignalBase() 
        { connect(s); }

      ~Signal5() {}
  };


// emit
template <class P1,class P2,class P3,class P4,class P5,class Marsh>
void Signal5<void,P1,P2,P3,P4,P5,Marsh>::emit_(typename Trait<P1>::ref p1,typename Trait<P2>::ref p2,typename Trait<P3>::ref p3,typename Trait<P4>::ref p4,typename Trait<P5>::ref p5,void* data)
  {
    SignalNode* impl = static_cast<SignalNode*>(data);

    if (!impl||!impl->begin_)
      return;

    Exec exec(impl);
    SlotNode* s = 0;
    for (SignalConnectionNode* i = impl->begin_; i; i = i->next_)
      {
        if (i->blocked())
          continue;

        s = i->dest();
        ((typename Slot5<void,P1,P2,P3,P4,P5>::Proxy)(s->proxy_))(p1,p2,p3,p4,p5,s);
      }
    return;
  }


#endif


#ifdef SIGC_CXX_NAMESPACES
}
#endif

#endif // SIGC_SIGNAL_H

⌨️ 快捷键说明

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