Refactored the devices base classes hierarchy, added the device class template (for shared parts of/for input and output devices).