Beispiel #1
0
static void print_object_attributes(SaNtfNotificationHandleT notificationHandle,
		SaNtfAttributeT * input)
{
	printf("- Attribute ID: %d -\n", (int)input->attributeId);
	printf(" Attribute Type: (%d) %s\n",(int)input->attributeType,
			sa_attribute_type_list[(int)input->attributeType]);

	print_attribute_value(notificationHandle, input->attributeType,
			&input->attributeValue);
}
Beispiel #2
0
static void print_changed_attributes(SaNtfNotificationHandleT notificationHandle,
		SaNtfAttributeChangeT * input)
{
	printf("- Attribute ID: %d -\n", input->attributeId);

	printf(" Attribute Type: (%d) %s\n",(int)input->attributeType,
			sa_attribute_type_list[(int)input->attributeType]);
	if (input->oldAttributePresent == SA_TRUE) {
		printf(" Old Attribute Present: Yes\n");
		printf(" Old Attribute: \n");
		print_attribute_value(notificationHandle, input->attributeType,
		&input->oldAttributeValue);
	} else {
		printf(" Old Attribute Present: No\n");
	}

	print_attribute_value(notificationHandle, input->attributeType,
		&input->newAttributeValue);
}
Beispiel #3
0
void Node::process_attribute_command_( std::string name, std::istream& rest ) {
    BaseAttribute* a = attributes.look_up( name );
    if ( ! a ) 
        throw std::runtime_error("Unknown node '" + name + "'");

    std::string command;
    rest >> command;
    if ( command == "query" ) {
        std::stringstream s;
        s << "in " << a->get_name() << " ";
        declare_attribute( a, s );
        backend_node->print( s.str() );
    } else if ( command == "set" ) {
        std::string line;
        std::getline( rest, line );
        bool successful = a->set_value( line );
        if ( ! successful )
            print_attribute_value( *a );
    } else if ( command == "unset" ) {
        a->unset_value();
    } else
        throw std::runtime_error("Unknown attribute command: " + command );
}