<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">No sé que se'm deu haver colat. Ara n'hi ha 3 més dels que diu al log i són tots en verd.<div>M'esperaré a que faci el següent testeig a veure si continua fallant<div><div><div><br></div><div>Sorry</div><div><br></div><div>On May 26, 2011, at 11:46 PM, Pau Arumi wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">
<div><p>Ei Xavi, tenim testfarm en vermell per culpa de pyclam. Li faras una ullada please?
<br><font color="#999999">-- </font>
<br><font color="#999999">Sent on the road</font>
<br>
<br>----- Mensaje original -----
<br>>
<br>> On May 26, 2011, at 10:52 PM, David García Garzón wrote:
<br>>
<br>> Xavi, note that attributeValue is a const getter so you cannot use the
<br>> returned reference to assign it. I suggest you add a new method:
<br>> void setAttributeValue(unsigned i, const value_type & value)
<br>> value_type & attribute =
<br>> *(value_type *)_processingConfig->GetAttributeAsVoidPtr( i )
<br>> attribute = value;
<br>> so you can call:
<br>> config.setAttributeValue<std::string>(unsigned i, value)
<br>>
<br>> Worked like a charm. I didn't realize that attributeValue was a const
<br>> method. Thanks!
<br>>
<br>>
<br>>
<br>> A Dijous 26 Maig 2011 20:36:41, Xavier Serra Román va escriure:
<br>> Hi guys..
<br>> I have another issue. How do you set new values to a dynamictype
<br>> attribute? I've seen clam code such as:
<br>> ConcreteString & value = *(ConcreteString
<br>> *)object.GetAttributeAsVoidPtr(attribute); value =
<br>> input->toPlainText().toLocal8Bit().constData();
<br>>
<br>> but in my code I do:
<br>> std::string old = config.attributeValue<std::string>(i);
<br>> old = value;
<br>> with value being passed as const std::string& and attributeValue<type>
<br>> being: *(type *)_processingConfig->GetAttributeAsVoidPtr( i )
<br>> and nothing changes. What am I doing wrong?
<br>>
<br>> Thanks!
<br>>
<br>> PS: I hate pointers
<br>>
<br>> On May 25, 2011, at 8:39 PM, Pau Arumi wrote:
<br>> Check the Component interface. Maybe it is called Clone() or DeepCopy().
<br>> P
<br>>
<br>> On May 25, 2011, at 7:48 PM, David García Garzón wrote:
<br>> On Wednesday 25 May 2011 19:09:23 Xavier Serra Román wrote:
<br>> Hi guys,
<br>> I'm now at the part of ipyclam dealing with configurations and I've
<br>> run into some trouble, I defined a c++ class to wrap into python
<br>> with boost.python that holds a processingconfig.
<br>>
<br>> I need to create the processingconfig in the class from a copy of
<br>> another one so I've defined: ConfigurationProxy(const
<br>> CLAM::ProcessingConfig & prototype)
<br>>
<br>> {
<br>>
<br>> _processingConfig = new CLAM::ProcessingConfig(prototype);
<br>>
<br>> }
<br>>
<br>> this, obviously. doesn't work because abstract classes cannot be
<br>> allocated but I don't know what else to do.
<br>>
<br>> Use the Component::Species() virtual method. It is redefined in
<br>> subclasses (including ProcessinConfig's derivatives) in a way that
<br>> it returns an object of the same class than the receiver. Not a
<br>> copy, just the default constructed one.
<br>>
<br>> How do you call it? I don't seem to be able to make it work, I've tried
<br>> from prototype.Species() to
<br>> CLAM::ProcessingConfig::Species(prototype)..
<br>>
<br>> Be carefull on the code below, if you ned the default constructor (do
<br>> you need it?) initialize all the members.
<br>>
<br>> Be also carefull with the copy constructor (generated by default).
<br>> The default copy constructor copies all members, in this case will
<br>> copy the pointer and you will double delete it on the destructor.
<br>> This might happen not just in assignments but also when passing it
<br>> as parameter or returning not as reference, and it may not be you
<br>> but maybe boost::python. So my suggestiong is to implement it
<br>> private and assert false inside, so, at least if boost::python uses
<br>> it you will be notified at compilation or runtime.
<br>>
<br>> The complete code of the class is:
<br>> class ConfigurationProxy
<br>> {
<br>>
<br>> public:
<br>> CLAM::ProcessingConfig * _processingConfig;
<br>> ConfigurationProxy() {}
<br>> ConfigurationProxy(const CLAM::ProcessingConfig & prototype)
<br>> {
<br>>
<br>> _processingConfig = new CLAM::ProcessingConfig(prototype);
<br>>
<br>> }
<br>> ~ConfigurationProxy()
<br>> {
<br>>
<br>> delete _processingConfig;
<br>>
<br>> }
<br>>
<br>> };
<br>>
<br>> Thanks!
<br>> _______________________________________________
<br>> clam-devel mailing list
<br>> <a href="mailto:clam-devel@lists.clam-project.org">clam-devel@lists.clam-project.org</a><<a href="mailto:clam-devel@lists.clam-project.org">mailto:clam-devel@lists.clam-project.org</a>>
<br>> <a href="http://lists.clam-project.org/listinfo.cgi/clam-devel-clam-project">http://lists.clam-project.org/listinfo.cgi/clam-devel-clam-project</a>.
<br>> org
<br>>
<br>> _______________________________________________
<br>> clam-devel mailing list
<br>> <a href="mailto:clam-devel@lists.clam-project.org">clam-devel@lists.clam-project.org</a><<a href="mailto:clam-devel@lists.clam-project.org">mailto:clam-devel@lists.clam-project.org</a>>
<br>> <a href="http://lists.clam-project.org/listinfo.cgi/clam-devel-clam-project.org">http://lists.clam-project.org/listinfo.cgi/clam-devel-clam-project.org</a>
<br>>
<br>> --
<br>> David García Garzón
<br>> (Work) david dot garcia at upf anotherdot edu
<br>> <a href="http://www.iua.upf.edu/~dgarcia">http://www.iua.upf.edu/~dgarcia</a>
<br>>
<br>
<br><Archivo adjunto> ATT00001.txt
<br><br></p>
</div>
_______________________________________________<br>clam-devel mailing list<br><a href="mailto:clam-devel@lists.clam-project.org">clam-devel@lists.clam-project.org</a><br>http://lists.clam-project.org/listinfo.cgi/clam-devel-clam-project.org<br></blockquote></div><br></div></div></body></html>