Variant DynamicObject::m_GetProperty(int numargs, Variant args[]) { ObjectProperty *prop = GetProperty(args[0]); if (prop) { return anytovariant(prop->GetName()); } return VARNULL; }
int DynamicObject::SetPropertyValue(const char *property, Variant value) { ObjectProperty *prop = FindProperty(property); if (prop) { return prop->SetValue(value); } systemObject->Log(0, "Object %s does not have a property %s", GetName(), property); return -1; }
Variant DynamicObject::GetPropertyValue(const char *property) { ObjectProperty *prop = FindProperty(property); if (prop) { return prop->GetValue(); } systemObject->Log(0, "Object %s does not have a property %s", name, property); return VARNULL; }
semantic_map_msgs::ObjectProperty MessageConversions::objectPropertyToMessage( const ObjectProperty& property) const { semantic_map_msgs::ObjectProperty message = propertyToMessage< semantic_map_msgs::ObjectProperty>(property); message.object = property.getObject().getIdentifier(); return message; }
void ObjectProperty::copy(const ObjectProperty& prop, bool checkType) { if (checkType) { assert(_defaultProp); assert(_defaultProp->getValue()); if ((_defaultProp->getValue()->type() != prop.getDefaultProperty()->getValue()->type())) { throwException(BacnetErrorException(ErrorClassEnum::Property, ErrorCodeEnum::InvalidDataType, "Incompatible type.")); } } _objType = prop._objType; _propId = prop._propId; _defaultProp = new Property(*(prop._defaultProp)); }
void PropertySet::SaveToConfig() { ConfVarTable *op = g_conf.ed_objproperties.GetTable(GetTypeName()); for( int i = 0; i < GetCount(); ++i ) { ObjectProperty *prop = GetProperty(i); switch( prop->GetType() ) { case ObjectProperty::TYPE_INTEGER: op->SetNum(prop->GetName(), prop->GetIntValue()); break; case ObjectProperty::TYPE_FLOAT: op->SetNum(prop->GetName(), prop->GetFloatValue()); break; case ObjectProperty::TYPE_STRING: op->SetStr(prop->GetName(), prop->GetStringValue()); break; case ObjectProperty::TYPE_MULTISTRING: op->SetNum(prop->GetName(), (int) prop->GetCurrentIndex()); break; default: assert(false); } // end of switch( prop->GetType() ) }}
void PropertySet::LoadFromConfig() { ConfVarTable *op = g_conf.ed_objproperties.GetTable(GetTypeName()); for( int i = 0; i < GetCount(); ++i ) { ObjectProperty *prop = GetProperty(i); switch( prop->GetType() ) { case ObjectProperty::TYPE_INTEGER: prop->SetIntValue( __min(prop->GetIntMax(), __max(prop->GetIntMin(), op->GetNum(prop->GetName(), prop->GetIntValue())->GetInt() ))); break; case ObjectProperty::TYPE_FLOAT: prop->SetFloatValue( __min(prop->GetFloatMax(), __max(prop->GetFloatMin(), op->GetNum(prop->GetName(), prop->GetFloatValue())->GetFloat() ))); break; case ObjectProperty::TYPE_STRING: prop->SetStringValue(op->GetStr(prop->GetName(), prop->GetStringValue().c_str())->Get()); break; case ObjectProperty::TYPE_MULTISTRING: prop->SetCurrentIndex( __min((int) prop->GetListSize() - 1, __max(0, op->GetNum(prop->GetName(), (int) prop->GetCurrentIndex())->GetInt() ))); break; default: assert(false); } // end of switch( prop->GetType() ) } }