Beispiel #1
0
Variant DynamicObject::m_GetProperty(int numargs, Variant args[])
{
    ObjectProperty *prop = GetProperty(args[0]);
    if (prop) {
        return anytovariant(prop->GetName());
    }
    return VARNULL;
}
Beispiel #2
0
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;
}
Beispiel #3
0
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;
}
Beispiel #5
0
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));
}
Beispiel #6
0
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() )
	}}
Beispiel #7
0
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() )
	}
}