[Clam-devel] TypedControls Patch

Francisco Tufró nictuku at gmail.com
Fri May 9 12:36:45 PDT 2008


Passing a class by copy may bring performance issues on realtime i think,
that's why i did it by reference.
If you want it to be by copy, i have no problem to do it by copy.
For the next patch i'll change it and add the IsConnected test and pass it.
that's all for now


On 5/9/08, Pau Arumí <parumi at iua.upf.edu> wrote:
>
> On dj, 2008-05-08 at 14:43 -0300, Francisco Tufró wrote:
> > After some hours of work i have done 2 tests and passed them.
> > Just check them and tell me if they're ok (and if the patch is well
> > done ^^)
> > :)
>
> Good start! I see the code checked in by Hernan.
> It's is good to go in small steps. Even this simple test brings out some
> issues:
>
>
> +               {
> +                       CLAM::TypedInControl<int> in("IntInControl");
> +                       CLAM::TypedOutControl<int> out("IntOutControl");
> +                       out.AddLink(in);
> +                       int number=1;
> +                       out.SendControl(number);
> +                       CPPUNIT_ASSERT_EQUAL( 1 , in.GetLastValue() );
> +               }
> +
>
> out.SendControl(1); won't work because the signature wants a reference
> to a non-constant var! And we need it to work, for backwards
> compatibility among other reasons.
>
> So change the test passing a constant, and pass the test by changing
> SendControl and DoControl arguments to be const references.
> 
> We want controls to be passed by copy (or maybe in the future:
> copy-on-write smart pointers), but keeping a reference to the original
> object is bad.
>
> I was considering a new "sent by copy" test (e.g. send a var, change the
> var, check that the received value has not changed) but i realize it is
> not necessary, once we have changed the previous test: if you save a a
> const argument it necessarily implies doing copy.
>
> > When you give me the ok, i'll continue with the
> > "TypedInControl::IsConnected(out)" test.
> > Bye!
>
> Yes
>
> Pau
>
>
> _______________________________________________
> Clam-devel mailing list
> Clam-devel at llistes.projectes.lafarga.org
> https://llistes.projectes.lafarga.org/cgi-bin/mailman/listinfo/clam-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.clam-project.org/pipermail/clam-devel-clam-project.org/attachments/20080509/d07fd2ea/attachment-0004.htm>


More information about the clam-devel mailing list