OsinfoResources

## OsinfoResources OsinfoResources — Required or recommended resources for an (guest) OS |

## Synopsis

    #define             OSINFO_ARCHITECTURE_ALL
    #define             OSINFO_MEGAHERTZ
    #define             OSINFO_KIBIBYTES
    #define             OSINFO_MEBIBYTES
    #define             OSINFO_GIBIBYTES
    #define             OSINFO_RESOURCES_PROP_ARCHITECTURE
    #define             OSINFO_RESOURCES_PROP_CPU
    #define             OSINFO_RESOURCES_PROP_N_CPUS
    #define             OSINFO_RESOURCES_PROP_RAM
    #define             OSINFO_RESOURCES_PROP_STORAGE
    struct              OsinfoResources;
    struct              OsinfoResourcesClass;
    OsinfoResources *   osinfo_resources_new                (const gchar *id,
                                                             const gchar *architecture);
    const gchar *       osinfo_resources_get_architecture   (OsinfoResources *resources);
    gint                osinfo_resources_get_n_cpus         (OsinfoResources *resources);
    gint64              osinfo_resources_get_cpu            (OsinfoResources *resources);
    gint64              osinfo_resources_get_ram            (OsinfoResources *resources);
    gint64              osinfo_resources_get_storage        (OsinfoResources *resources);
    void                osinfo_resources_set_n_cpus         (OsinfoResources *resources,
                                                             gint n_cpus);
    void                osinfo_resources_set_cpu            (OsinfoResources *resources,
                                                             gint64 cpu);
    void                osinfo_resources_set_ram            (OsinfoResources *resources,
                                                             gint64 ram);
    void                osinfo_resources_set_storage        (OsinfoResources *resources,
                                                             gint64 storage);

## Object Hierarchy

      GObject
       +----OsinfoEntity
             +----OsinfoResources

## Properties

      "architecture"             gchar*                : Read / Write / Construct Only
      "cpu"                      gint64                : Read / Write
      "n-cpus"                   gint                  : Read / Write
      "ram"                      gint64                : Read / Write
      "storage"                  gint64                : Read / Write

## Description

OsinfoResources is an entity representing required or recommended resources for an (guest) operating system.

## Details

### OSINFO_ARCHITECTURE_ALL

    #define OSINFO_ARCHITECTURE_ALL "all"

### OSINFO_MEGAHERTZ

    #define OSINFO_MEGAHERTZ        1000000

### OSINFO_KIBIBYTES

    #define OSINFO_KIBIBYTES        1024

### OSINFO_MEBIBYTES

    #define OSINFO_MEBIBYTES        1048576

### OSINFO_GIBIBYTES

    #define OSINFO_GIBIBYTES        1073741824

### OSINFO_RESOURCES_PROP_ARCHITECTURE

    #define OSINFO_RESOURCES_PROP_ARCHITECTURE "architecture"

### OSINFO_RESOURCES_PROP_CPU

    #define OSINFO_RESOURCES_PROP_CPU          "cpu"

### OSINFO_RESOURCES_PROP_N_CPUS

    #define OSINFO_RESOURCES_PROP_N_CPUS       "n-cpus"

### OSINFO_RESOURCES_PROP_RAM

    #define OSINFO_RESOURCES_PROP_RAM          "ram"

### OSINFO_RESOURCES_PROP_STORAGE

    #define OSINFO_RESOURCES_PROP_STORAGE      "storage"

### struct OsinfoResources

    struct OsinfoResources;

### struct OsinfoResourcesClass

    struct OsinfoResourcesClass {
    };

### osinfo_resources_new ()

    OsinfoResources *   osinfo_resources_new                (const gchar *id,
                                                             const gchar *architecture);

### osinfo_resources_get_architecture ()

    const gchar *       osinfo_resources_get_architecture   (OsinfoResources *resources);

Retrieves the target hardware architecture to which `resources` applies. Some operating systems specify the same requirements and recommendations for all architectures. In such cases, the string returned by this call will be OSINFO_ARCHITECTURE_ALL.

`resources` : | an OsinfoResources instance
Returns : | the hardware architecture. [transfer none]

### osinfo_resources_get_n_cpus ()

    gint                osinfo_resources_get_n_cpus         (OsinfoResources *resources);

Retrieves the number of CPUs.

`resources` : | an OsinfoResources instance
Returns : | the number of CPUs, or -1.

### osinfo_resources_get_cpu ()

    gint64              osinfo_resources_get_cpu            (OsinfoResources *resources);

Retrieves the CPU frequency in hertz (Hz). Divide the value by OSINFO_MEGAHERTZ if you need this value in megahertz (MHz).

`resources` : | an OsinfoResources instance
Returns : | the CPU frequency, or -1.

### osinfo_resources_get_ram ()

    gint64              osinfo_resources_get_ram            (OsinfoResources *resources);

Retrieves the amount of Random Access Memory (RAM) in bytes. Divide the value by OSINFO_MEBIBYTES if you need this value in mebibytes.

`resources` : | an OsinfoResources instance
Returns : | the amount of RAM, or -1.

### osinfo_resources_get_storage ()

    gint64              osinfo_resources_get_storage        (OsinfoResources *resources);

Retrieves the amount of storage space in bytes. Divide the value by OSINFO_GIBIBYTES if you need this value in gibibytes.

`resources` : | an OsinfoResources instance
Returns : | the amount of storage, or -1.

### osinfo_resources_set_n_cpus ()

    void                osinfo_resources_set_n_cpus         (OsinfoResources *resources,
                                                             gint n_cpus);

Sets the number of CPUs.

`resources` : | an OsinfoResources instance
`n_cpus` : | the number of CPUs

### osinfo_resources_set_cpu ()

    void                osinfo_resources_set_cpu            (OsinfoResources *resources,
                                                             gint64 cpu);

Sets the CPU frequency.

`resources` : | an OsinfoResources instance
`cpu` : | the CPU frequency in hertz (Hz)

### osinfo_resources_set_ram ()

    void                osinfo_resources_set_ram            (OsinfoResources *resources,
                                                             gint64 ram);

Sets the amount of RAM in bytes.

`resources` : | an OsinfoResources instance
`ram` : | the amount of ram in bytes

### osinfo_resources_set_storage ()

    void                osinfo_resources_set_storage        (OsinfoResources *resources,
                                                             gint64 storage);

Sets the amount of storage space.

`resources` : | an OsinfoResources instance
`storage` : | the amount of storage in bytes

## Property Details

### The `"architecture"` property

      "architecture"             gchar*                : Read / Write / Construct Only

The target hardware architecture to which these resources applies.

Default value: NULL

### The `"cpu"` property

      "cpu"                      gint64                : Read / Write

The CPU frequency in hertz (Hz).

Allowed values: [-1,2147483647]

Default value: -1

### The `"n-cpus"` property

      "n-cpus"                   gint                  : Read / Write

The number of CPUs.

Allowed values: >= G_MAXULONG

Default value: -1

### The `"ram"` property

      "ram"                      gint64                : Read / Write

The amount of Random Access Memory (RAM) in bytes.

Allowed values: >= -1

Default value: -1

### The `"storage"` property

      "storage"                  gint64                : Read / Write

The amount of storage space in bytes.

Allowed values: >= -1

Default value: -1

## See Also

OsinfoOs