The Name DatabaseΒΆ

In a framework like devel.one, there are many objects that are registered somewhere and assigned an ID. Since the IDs are of course important for references, and are therefore also logged, it is important to make these LOGs also readable. Therefore, we have created a way to associate IDs of any form with an explanatory name in string form. In the LOG, the string is often printed instead of the ID.

The name database INameDb, which takes the assignment ID <-> string, can be accessed via the kernel. Some sub name databases are responsible for this:

  • IMessageNameDb: Takes names for message IDs
  • IMessageSlotNameDb: Takes names for SlotKeys
  • IResultNameDb: Takes names for result codes
  • ITargetNameDb: Takes names for target addresses
  • IIdNameDb: Takes names for IDs of the type IId

Typically, programmers store only the names to the IDs. The logging system is then rather the beneficiary of these names.

Saving names in the database is simple:

final IKernel kernel = getKernel();
kernel.getNameDb().getTargetNameDb().putName(getAddress(), "Monitor");

The often cryptic address / ID of the object (here the monitor target address) in the LOG is then easily recognizable. The names are often registered as soon as the ID or the address of an object is established. The above lines are from the message handler of the monitor for the very first message (CRecordStartTarget).