[sigc] provided marshallers



hi everybody,
i was trying to understand how to use a marshaller in sigc++-1.2, and am a bit confused by the 'provided' ones. specifically, how they are usefull:

reading this on the web page:

The following marshallers are provided by default.

  Marshal<void>
  Marshal<T>
  Marshal<R>  (untested, may not be portable)
  FixedMarshal<T,V>
  FastMarshal<T>


1. I can't find FixedMarshal or FastMarshal defined in any of the headers.
2. when i use the following code:

bool marshalled_callback_1()
{
  cout << "marshalled_callback_1()" << endl;
  return false;  // Not done handling signal.
}

bool marshalled_callback_2()
{
  cout << "marshalled_callback_2()" << endl;
  return true;  // Done handling signal.
}

bool marshalled_callback_3()
{
  cout << "marshalled_callback_3()" << endl;
  return false;  // Not done handling signal.
}

SigC::Signal0<bool, Marshal<bool> > signal_marshal_example;
signal_marshal_example.connect(slot(&marshalled_callback_1));
signal_marshal_example.connect(slot(&marshalled_callback_2));
signal_marshal_example.connect(slot(&marshalled_callback_3));
signal_marshal_example();

i get the following ouput, when i wasn't expecting marshalled_callback_3 to be called:
marshalled_callback_1()
marshalled_callback_2()
marshalled_callback_3()

when i replace the Marshal<bool> parameter for signal_marshal_example with my class BoolMarshal, defined below, marshalled_callback_3 is not called. can i use the provided Marshal<bool> in some way to achieve the same thing as BoolMarshal?

class BoolMarshal
{
  public:
    typedef bool OutType;
    typedef bool InType;

    BoolMarshal() {}

    OutType value() { return false; }

    static OutType default_value() { return true; }

    bool marshal(InType new_val)
    {
      return new_val;
    }

  private:
};


thanks!
-tim





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]