Wouldn't it make sense to have this in CLinearStructuredOutputMachine? I think most primal solvers will need this, especially the online solvers that you are going to implement in the second phase of gsoc 2013.