34 #include <boost/mpl/vector.hpp> 
   35 #include <boost/mpl/begin_end.hpp> 
   36 #include <boost/mpl/next.hpp> 
   37 #include <boost/mpl/deref.hpp> 
   38 #include <boost/mpl/push_back.hpp> 
   39 #include <boost/mpl/empty.hpp> 
   40 #include <boost/utility.hpp> 
   46 namespace connection {
 
   48     namespace server_generation {
 
   49         typedef boost::mpl::vector<vrpn_BaseFlexServer, VrpnAnalogServer,
 
   51                                    VrpnTrackerServer> ServerTypes;
 
   63         bool ShouldInclude<VrpnAnalogServer>::predicate(
 
   65             return init.obj.getAnalogs().is_initialized();
 
   69         bool ShouldInclude<VrpnButtonServer>::predicate(
 
   70             DeviceConstructionData &init) {
 
   71             return init.obj.getButtons().is_initialized();
 
   75         bool ShouldInclude<VrpnTrackerServer>::predicate(
 
   76             DeviceConstructionData &init) {
 
   77             return init.obj.getTracker();
 
   79         typedef boost::mpl::begin<ServerTypes>::type Begin;
 
   80         typedef boost::mpl::end<ServerTypes>::type End;
 
   84         template <
typename Result, 
typename Enable = 
void>
 
   88         template <
typename Result>
 
   90             Result, typename boost::enable_if<
 
   91                         typename boost::mpl::empty<Result>::type>::type> {
 
   97         template <
typename Result>
 
   99             Result, typename boost::disable_if<
 
  100                         typename boost::mpl::empty<Result>::type>::type> {
 
  102                 return vrpn_MainloopObject::wrap(
 
  108         template <
typename Iter = Begin,
 
  109                   typename Result = boost::mpl::vector0<>,
 
  110                   typename Enable = 
void>
 
  114         template <
typename Iter, 
typename Result>
 
  117             typename boost::disable_if<boost::is_same<Iter, End> >::type> {
 
  119                 typedef typename boost::mpl::deref<Iter>::type CurrentType;
 
  120                 typedef typename boost::mpl::next<Iter>::type NextIter;
 
  123                     typename boost::mpl::push_back<Result, CurrentType>::type
 
  128                     return NextWith::run(init);
 
  130                 return NextWithout::run(init);
 
  135         template <
typename Iter, 
typename Result>
 
  138             typename boost::enable_if<boost::is_same<Iter, End> >::type> {
 
  146     vrpn_MainloopObject *
 
Template to invoke construction once sequence filtering is complete. 
Metaprogramming to generate a VRPN server object out of an MPL sequence of types. ...
Template to perform the list filtering.