-
Notifications
You must be signed in to change notification settings - Fork 32
StoreUserDefinedProperties
cschaerfe edited this page Feb 20, 2015
·
7 revisions
BALL offers a class NamedProperty for assigning properties to objects (atoms, bonds, ...)
The following types are supported and can be accessed with
Type | access |
---|---|
BOOL | getProperty(property_name).getBool() |
INT | getProperty(property_name).getInt() |
UNSIGNED_INT | getProperty(property_name).getUnsignedInt () |
FLOAT | getProperty(property_name).getFloat() |
DOUBLE | getProperty(property_name).getDouble() |
STRING | getProperty(property_name).getString () |
#include <BALL/CONCEPT/property.h>
Atom* atom;
float my_fancy_property = 4.2;
// assign your property
atom-> setProperty("myProperty", my_fancy_property)
// query your property
if (atom->hasProperty("myProperty"))
{
cout << atom->getProperty("myProperty").getFloat()) << endl;
}
#!python
from BALL import *
a = Atom()
# assign your property
a.setProperty("myProperty", 3.25)
# query your property
if (a.hasProperty("myProperty")):
print a.getProperty("myProperty").getFloat()