MIRA
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Names and namespaces

Overview

In MIRA Units/Authorities, RPC services as well as Channels are identified and distinguished by name. Hence they must always have a unique name. Sometimes multiple instances of the same Unit are used in one configuration. Also multiple channels with the same name can exist in an application but it's not desired that two channels with the same name should contain the same data. To be able to also differentiate between these instances additionally to the names namespaces are used.

Lets take a look at the following example. We have two laser scanner Units publishing a channel Laser and also two instances of a map builder subscribing to the channel Laser.

Name Scanner
Channel Laser
}
Name Scanner
Channel Laser
}
Name MapBuilder
Channel Laser
}
Name MapBuilder
Channel Laser
}

This example shows the problems mentioned. We have multiple Units with the same name. Since each Unit name must be unique we have to rename them. We also have two publishers of the same channel Laser though we know we should have two channels with different data, so we have to rename them. Finally we have two subscribers to the channel Laser though we like the two mappers to access different laser data. Again we have to rename the channels. To overcome this problem of conflicting names we can use namespaces. This way Units and channels can have the same name but as long as they reside in different namespaces no conflicts will occur.

Namespace Scanner1 {
Unit {
Name Scanner
Channel Laser
}
Unit {
Name MapBuilder
Channel Laser
}
}
Namespace Scanner2 {
Unit {
Name Scanner
Channel Laser
}
Unit {
Name MapBuilder
Channel Laser
}
}

Now each mapper and scanner act as a pair in their own namespace avoiding name conflicts. Each mapper accesses the right Laser channel.

Namespaces can be nested and are separated by a "/" in a fully resolved Unit name. In the above example, the second map builder can be accessed by the id /Scanner2/MapBuilder. If no namespace is given, a Unit resides in the root namespace "/" as well as all channels published by this Unit.