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

Helper functions



I have various helper functions that are probably generally useful. I am ambivalent about what to do with them.

One set is utilities for getting and setting attributes which look like
/**
Set the value of the string attribute name to val, whether or not it was already there.
*/
bool set_string(ModelData *m,
                  Particle *p,
                  const String& name,
                  std::string val)
and
/**
Get the string attribute name or return default_value if the particle does not have any such attribute.
*/
const String& get_string(ModelData *m,
                  Particle *p,
                  const String& name,
                  const String& default_value=String())
 Obviously there are int and float versions.

Should such things go in to imp proper? On one hand they are extremely useful. On the other it is increasing the size of the interface and while it makes it more convenient, it doesn't add any power.



Next I have some helpers for manipulating hierarchy and bond particles (getting the number of children, getting specific children etc). These should go somewhere to establish norms for hierarchies.