To easily check, compare, etc. VectorComposite should have the method getStructure() however, the ordering in the unordered_map and the string provided by the user does necessarily follow the same order.
So I propose to return a sorted (alphabetically) string. And agreeing on the Wolf::Structure are a sorted, maybe a class instead of a typedef is required here, I don't know.
Alphabetical order is easy to achieve. Just replace unordered_map by map, and that's it. Then obtaining getters and so on is simple.
However alphabetical order is not the best desired option. We are used to PO, POV, and the like, for a reason, because it is more intuitive. I want to keep this custom ordering.
For this, we can have a field structure in VectorComposite, in the same manner as we have it in HasStateBlocks (therefore Sensor, Frame, Capture and Landmark), and in Processors and Problem.
This field structure_ can be defined beforehand (i.e. in the constructor) or built incrementally as state blocks are emplaced in the VectorComposite. HasStateBlocks has a similar mechanism.
Of course the order is not "very important". It just contributes to peace of mind when viewing logs and debugging.
I think that for comparing strings the order should be clear. Otherwise we can leave it unordered and whenever it has to be compared, then it has to be sorted (this is not convenient for assertions and simple checks).
If we want to specify an special order we can, for example, first in this order POVW, afterwards in alphabetical order.
If in this issue you are mostly concerned with comparing structures, then yes, a predictable order is necessary, and this can be alphabetical. In such case I'd redesign VectorComposite as a regular map to really simplify (and also make more efficient) the getter:
This would be also beneficial, for the same reason, in HasStateBlocks.
However, this has some impact in other classes. In particular, currently Problem, Processor and HasStateBlocks already have the getStructure() and this returns the predefined order, which is not alphabetical.
My worries about StateStructure being a mere typedef of string is that it is very limited.
As structure, for example, we might want to store the sizes of each block; the local sizes; the name of the state block that it is supposed to represent (in case you want to create a state block with it using a Factory), and the like. Then, as you say, you can add methods to manipulate (union, intersection, concatenation, comparison, etc).
I thought about doing it during the big merge but I had so many things to touch that I could not think clearly about what we really needed, and I did not want to create a whole now fancy class if it was not necessary.
BTW as a small temporary fix concerning the last part of #349 (comment 7414), I am going to homogenize the API for the name of the structure_ variables and the getStructure() methods. This will be pushed to devel without further discussion.
From here, one can use the pretty option for ordering the elements "POV" when e.g. printing on screen, but the normal structure when doing any other kind of manipulation.
Why not define a to_string method and just iterate the underlying set and build structure_pretty when you want to print it instead of keeping it updated every time you add a char. Then StateStructure is just a set with a custom to_string method.
The idea is not to have a pretty string to print the string itself, but to have a pretty order to print the blocks in good order, e.g. if pretty = "POVba" then,