non-const reference and wrap the real argument using \c boost::ref() (The reason for
this is known as 'The forwarding problem'
- \section Advanced usage: Managing your own container
+ \section senf_ppi_multiconnector_advanced Advanced usage: Managing your own container
If you need to use a completely different type of container, you can take over the container
management yourself. To do this, pass \c void as container type and change \c
save this connector in some container or throw an exception
\code
class MyModule
- : public senf::ppi::module::Modulem,
+ : public senf::ppi::module::Module,
public senf::ppi::module::MultiConnectorMixin<
MyModule, senf::ppi::connector::ActiveInput<>, void, void >
{
void connectorSetup(std::auto_ptr<ConnectorType> c)
{
route(input, *c);
- connectors_.push_back(c);
+ connectors_.push_back(boost::shared_ptr<ConnectorType>(c));
}
void request()
senf::Packet p (input());
for (Connectors::iterator i (connectors_.begin()), i_end (connectors_.end());
i != i_end; ++i)
- (*i)(p);
+ (**i)(p);
}
- typedef boost::ptr_vector<MyModule::ConnectorType> Connectors;
+ typedef std::vector< boost::shared_ptr<MyModule::ConnectorType> > Connectors;
Connectors connectors_;
friend class senf::ppi::module::MultiConnectorMixin<MyModule,