Subject: [proto] question about sub-domains
From: Christophe Henry (christophe.j.henry_at_[hidden])
Date: 2010-09-22 16:35:23
The subject of the day seems to be sub-domains and it's great because
I wanted to check that a use I just made of them was correct.
So the problem is:
In eUML, states are terminals of my state machine domain (sm_domain).
The domain's grammar disables as little as possible (address_of):
struct terminal_grammar : proto::not_<proto::address_of<proto::_> >
// Forward-declare an expression wrapper
: proto::domain< proto::generator<euml_terminal>, terminal_grammar >
Now, I just implemented serialization for state machines using
boost::serialization which happens to define its own DSEL, archive <<
fsm and archive >> fsm.
As state machines are states in eUML, I created a conflict between
both DSELs: << and >> for serialization and my own eUML, like init_ <<
I solved the conflict by creating a sub-domain for states with a
struct state_grammar :
: proto::domain< proto::generator<euml_terminal>, state_grammar,sm_domain >
As init_ is in the super domain sm_domain, init_ << state is allowed,
but as states are in the sub-domain, archive << fsm calls the correct
However, I have some doubt that what I'm doing really is ok or happens
to be working by pure luck.
If it's an acceptable usage, sub-domains helped me out of a tight spot
and I'm really going to be tempted to push this further ;-)
Proto list run by eric at boostpro.com