Skip to content

create sensible $print functions for the different R6 classes #26

@bart6114

Description

@bart6114

low priority

consider:

> simmer()
<Simmer>
  Public:
    add_generator: function
    add_resource: function
    clone: function
    get_capacity: function
    get_generators: function
    get_mon_arrivals: function
    get_mon_attributes: function
    get_mon_resources: function
    get_n_generated: function
    get_queue_count: function
    get_queue_size: function
    get_resources: function
    get_server_count: function
    initialize: function
    name: anonymous
    now: function
    peek: function
    reset: function
    run: function
    step: function

  Private:
    mon_gen: NULL
    mon_res: NULL
    sim_obj: externalptr

a minimal example:

Simmer <- R6Class("Simmer",
  public = list(
    print = function() cat(paste0(
      "Simmer instance: ",self$name,"\n",
      "============================\n",
      "current sim time: ", self$now())),
    ....etc.....

which results in:

> simmer()
Simmer instance: anonymous
============================
current sim time: 0

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions