Logo Khaganat
Translations of this page?:

Inheritance in datasheets

Inheritance is an essential notion in the creation of a set of DS, to avoid repeating itself. This makes it possible to inherit characteristics of a parent DS, and even to rewrite on some, and even to make it possible not specifying “everything again” when we realize a set of DS have common characteristics.

For example, imagine an object my object that can have four characteristics A, B, C and D, having between 0 and 10 as values. One could have:

my_object01
A = 2
B = 3
C = 4
D = 5
my_object02
A = 2
B = 3
C = 4
D = 9

One sees that A, B and C are identical in the two different objects, one could thus simplify the task by making a parent DS:

my_object
A = 2
B = 3
C = 4

Then we call it the other two:

my_object01
parent = my_object
D = 5
my_object02
parent = my_object
D = 9

In addition to not allowing repeating itself, it allows to pass on any change in a “parent” to all of his/her children.

One can nevertheless decide to specify a difference(with respect to the “parent”), which makes it possible to modify a common characteristic.

my_object03
parent = my_object
B = 7
D = 5

In DS, parenting is done through the call:

<PARENT Filename="xxxx.sitem"/>

It is advisable to organize the DS nomenclature in order to be able to identify it quickly, and also to quickly identify a parent of a complete card.. by doing it like this:

  • Put an underscore “_” at the beginning of parents' names to make them come up first in a directory listing;
  • Use underscores “_” for name fields, like for example the code shipped with RC.

This lets you know which parameters are populated and which ones are absent if the nomenclature is explicit.

Of course, a parent DS can call one or more parents, etc.
Attention to inheritances in cascade(as in CSS).

CC Attribution-Share Alike 4.0 International Driven by DokuWiki
en/ds/rcdsparentage.txt · Last modified: 2021/12/03 19:19 by 127.0.0.1

Licences Mentions légales Accueil du site Contact