[clam-devel] Adding and Removing attributes in a DT in a positional way

David García Garzón david.garcia at upf.edu
Tue Jun 21 17:16:50 PDT 2011


A Dimarts 21 Juny 2011 19:02:10, Xavier Serra Román va escriure:
> On Jun 20, 2011, at 5:01 PM, David García Garzón wrote:
> > Xavi is working rigth now in supporting optional attributes in dynamic
> > types (configurations) from ipyclam. For that he needs interface to add
> > and remove an attribute by index which does not exist (there is a
> > private AddAtttr_ which requires the size of the type as second
> > parameter which is too much an implementation detail.
> > 
> > I changed AddAttr_ to use the size already stored in the attribute
> > information struct and not requiring the size parameter (patch
> > attached). But, still the
> > 
> > method names are not ready for a public interface. What about:
> > 	void AddAttribute(unsigned i)
> > 	void AddDynamicTypeAttribute(unsigned i)
> > 	void AddAttributeByIndex(unsigned i)
> > 
> > Any thoughs or preferences?
> 
> Either AddAttribute or AddAttributeByIndex makes sense for me. Maybe I
> balance more in favor of AddAttributeByIndex because it's what the method
> really does. Perhaps some day someone will come along needing an
> AddAttributeByName method and it will be strange having one called
> AddAttribute

If we choose AddAttribute, an eventual by-name version could be just an 
overload, as we already did for ports and controls related methods. My fear is 
that AddAttribute will eventually collide with Add##NAME when 
NAME=="Attribute", but thinking it twice, i just noticed that in this case 
overloading will might save us again.


-- 
David García Garzón
(Work) david dot garcia at upf anotherdot edu
http://www.dtic.upf.edu/~dgarcia



More information about the clam-devel mailing list