the sid::component interface

Any component must implement the following interface, though most of the methods can be implemented trivially, if not relevant. Additionally, there are several mix-in classes located in extra SID utility headers. These mix-ins are not part of the official component API, but cover a wide variety of common component implementation strategies and greatly simplify the task of writing a component; programmers are encouraged to read these headers for more details.


        vector<string> attribute_names ();

        vector<string> attribute_names (const string& category);

        string attribute_value (const string& name);

        status set_attribute_value (const string& name, const string& value);

A component's attributes are listed with attribute_names. Once an attribute name is known it can be queried with attribute_value or set with set_attribute_value.


        vector<string> pin_names ();

        pin *find_pin (const string& name);

        status connect_pin (const string& name, pin *pin);

        vector<pin *> connected_pins (const string& name);

        status disconnect_pin (const string& name, pin *pin);

A component's input and output pins are listed, by name, with pin_names. A pointer to an input pin can be obtained, by name, with find_pin. This pointer points to a sid::pin object, and is thus the receiving end of a pin connection. To complete the connection, this pin-pointer must be associated with an output pin name in the component acting as the sending end of the connection, using the connect_pin method. The input pins connected to a given output pins can be fetched with connected_pins, and individually disconnected from the output pin with disconnect_pin.


        vector<string> bus_names ();

        vector<string> accessor_names ();

        bus *find_bus (const string& name);

        status connect_accessor (const string& name, bus *bus);

        status disconnect_accessor (const string& name, bus *bus);

        vector<bus *> connected_bus (const string& name);

A component's buses are listed, by name, with bus_names; its bus accessors are listed with accessor_names. A pointer to a bus can be obtained, by name, with find_bus. This pointer points to a sid::bus object, and is thus the slave end of a bus connection. To complete the connection, this bus-pointer must be associated with an accessor name in the component acting as the bus master, using the connect_accessor method. The bus connected to an accessor can be fetched with connected_bus, and disconnected from the accessor with disconnect_bus.


        vector<string> relationship_names ();

        status relate (const string& name, component *comp);

        status unrelate (const string& name, component *comp);

        vector<component *> related_components (const string& name);

A component's relationship names are listed with relationship_names. Once an relationship name is known components can be added to it with relate or removed from it with unrelate. The set of components currently in a given relationship name can be fetched with related_components