Add SGPropertyNode::setValueReadOnly.

Helper to set value of relative node and mark
read only. Use eg. for exposing configuration
and build values to the property tree.
This commit is contained in:
Thomas Geymayer
2013-10-20 12:03:41 +02:00
parent 8b0c246a7b
commit 0b197501e1
+17
View File
@@ -1241,6 +1241,23 @@ public:
return setValue(&val[0]);
}
/**
* Set relative node to given value and afterwards make read only.
*
* @param relative_path Path to node
* @param value Value to set
*
* @return whether value could be set
*/
template<typename T>
bool setValueReadOnly(const std::string& relative_path, const T& value)
{
SGPropertyNode* node = getNode(relative_path, true);
bool ret = node->setValue(value);
node->setAttributes(READ);
return ret;
}
/**
* Interpolate current value to target value within given time.
*