Home /Modules/operating-system/SLHardwareComponent.sleela

SLHardwareComponent.sleela

lib/operating-system/SLHardwareComponent.sleela · 102 line(s) · sleela

<< lib/operating-system/SLHardwareComponent.sleela
   SLeeLa Standard Library Definition.
   Definition: Defines SLHardwareComponent — the common base of every named
     hardware part in the OS-construction family (RAM/DDR modules, SSDs, hard
     disks, USB devices, UEFI firmware, video cards). It carries the identity
     every part shares: a manufacturer, a model/part name, a device class, and a
     configured flag, plus a human identity line. Concrete device classes extend
     it and add their class-specific specification fields.
   
   The point of the family is name-addressable parts: because the real world has
   a finite catalogue of device types (DDR..DDR5, SATA/NVMe SSDs, USB 1.1..4,
   UEFI revisions, GPU families), each is a named SLeeLa class a machine
   description can request by manufacturer + model, compose into an SLMachine,
   and run on the Sleela VM.
   
   Family: operating-system. Base of the hardware-component hierarchy. >>
#sleela 2.5
material;
class SLHardwareComponent {
  < ---- Descriptive metadata (version 1.11 nested-friendly accessors) ---- >
  << Eleven catalogued attributes with getter/setter pairs, so a GUI, loader,
     or catalog can read and (where appropriate) override this record.
     Values are faithful to the subject's real origin where publicly known. >>
  String metaVersion = "1.0.0";
  int metaId = 10896;
  String metaAuthor = "Kiro Agent";
  String metaDate = "2026-10-16";
  String metaCopyright = "SLeeLa project";
  String metaTrademark = "none";
  String metaCorporation = "none";
  < metaOrigin: National | <nation> | International | Galactic >
  String metaOrigin = "International";
  String metaBirthDate = "2026-10-10";
  < metaScienceRating: maturity/robustness on a 1..10 scale >
  int metaScienceRating = 9;
  < metaNationalSchedule: a real, citable instrument or "none" >
  String metaNationalSchedule = "none";

  String getMetaVersion() { return metaVersion; }
  void setMetaVersion(String v) { metaVersion = v; }
  int getMetaId() { return metaId; }
  void setMetaId(int v) { metaId = v; }
  String getAuthor() { return metaAuthor; }
  void setAuthor(String v) { metaAuthor = v; }
  String getDate() { return metaDate; }
  void setDate(String v) { metaDate = v; }
  String getCopyright() { return metaCopyright; }
  void setCopyright(String v) { metaCopyright = v; }
  String getTrademark() { return metaTrademark; }
  void setTrademark(String v) { metaTrademark = v; }
  String getCorporation() { return metaCorporation; }
  void setCorporation(String v) { metaCorporation = v; }
  String getOrigin() { return metaOrigin; }
  void setOrigin(String v) { metaOrigin = v; }
  String getBirthDate() { return metaBirthDate; }
  void setBirthDate(String v) { metaBirthDate = v; }
  int getScienceRating() { return metaScienceRating; }
  void setScienceRating(int v) { metaScienceRating = v; }
  String getNationalSchedule() { return metaNationalSchedule; }
  void setNationalSchedule(String v) { metaNationalSchedule = v; }
  < Device-class ordinals (what kind of part this is). >
  static final int CLASS_MEMORY  = 0;
  static final int CLASS_SSD     = 1;
  static final int CLASS_HDD     = 2;
  static final int CLASS_USB     = 3;
  static final int CLASS_UEFI    = 4;
  static final int CLASS_VIDEO   = 5;
  static final int CLASS_CPU     = 6;
  static final int CLASS_MAINBOARD = 7;

  < manufacturer, e.g. "Samsung", "NVIDIA" >
  String vendor;
  < model / part name, e.g. "M378A2K43DB1", "GeForce RTX 4090" >
  String model;
  < one of CLASS_* >
  int deviceClass;
  int configured;

  void configureComponent(String manufacturer, String partName, int cls) {
    vendor = manufacturer; model = partName; deviceClass = cls; configured = 1;
  }

  String manufacturer() { return vendor; }
  String partName()     { return model; }
  int componentClass()  { return deviceClass; }
  boolean isConfigured(){ return configured == 1; }

  String className() {
    if (deviceClass == CLASS_MEMORY)    { return "memory"; }
    if (deviceClass == CLASS_SSD)       { return "ssd"; }
    if (deviceClass == CLASS_HDD)       { return "hdd"; }
    if (deviceClass == CLASS_USB)       { return "usb"; }
    if (deviceClass == CLASS_UEFI)      { return "uefi"; }
    if (deviceClass == CLASS_VIDEO)     { return "video"; }
    if (deviceClass == CLASS_CPU)       { return "cpu"; }
    return "mainboard";
  }

  < A short identity line shared by every part, e.g. "ssd Samsung 990 PRO". >
  String identity() { return className() + " " + vendor + " " + model; }
}