F
forums_mp
I've come full circle on a design here. Consider the case where I've
got two modes of operation, uni-cast or multi-cast.
In either mode you can transmit(send) and/or receive.
The distinction between the two modes amounts to a set of vendor APIs.
When transmitting, to estabilish a connection in uni-cast mode I'll do:
openConnection(/*stuff*/);
establishUConnection(/*stuff*/);
tearDownUConnection(/*stuff*/); <- destructor activity
In multi-cast mode I'll do:
openConnection(/*stuff*/);
establishMConnection(/*stuff*/);
tearDownMConnection(/*stuff*/); <- destructor activity
When receiving the mode of operation is irrelevant. ie. You'll perform
the same operation in _either_ mode. i.e
openConnection(/*stuff*/);
configureRxChannel(/*stuff*/); configure the receive channel
tearDownRxChannel( /* stuff */)
You're allowed to call openConnection once, independent of the mode.
For instance, if I desire to send and receive in multi-cast mode. I
call openConnection once. So now:
openConnection(/*stuff*/);
establishMConnection(/*stuff*/);
configureRxChannel(/*stuff*/); configure the receive channel
So the best I could come with is as follows:
struct Connections {}; // vendor stuff
struct Channels {}; // vendor stuff
class receiver()
{
public:
receiver(vector<Connections>& coVec,
vector<Channels>& chVec))
{
if (openConnection(coVec)) {}
if (configureRxChannel(chVec)) {}
}
~receiver() throw() { if ( tearDownRxChannel(/*stuff*/)) }
// miscellaneous functions for status info.
};
class uniC
{
receiver& ref
public:
//constructor for the case where you desire to send and receive
uniC (receiver& r)
: ref(r)
{}
// constructor for the case where i desire to send only.
uniC (vector<Connections>& coVec)
{ if (openConnection(coVec)) {} }
~uniC () throw() { if ( tearDownUConnection(/*stuff*/)){} }
bool establishUConnection(/*stuff*/) {}
};
class multiC
{
receiver ref;
public:
// for the case where you desire to send and receive
multiC(receiver& r)
: ref(r)
{}
// for the case where i desire to send only.
multiC(vector<Connections>& coVec)
{ if (openConnection(coVec)) {} }
~multiC() throw() { if ( tearDownMConnection(/*stuff*/)){} }
bool establishMConnection(/*stuff*/) {}
};
Just uncertain if I'm on the right track here. So I'd appreaciate some
feedback.
Thanks in advance.
got two modes of operation, uni-cast or multi-cast.
In either mode you can transmit(send) and/or receive.
The distinction between the two modes amounts to a set of vendor APIs.
When transmitting, to estabilish a connection in uni-cast mode I'll do:
openConnection(/*stuff*/);
establishUConnection(/*stuff*/);
tearDownUConnection(/*stuff*/); <- destructor activity
In multi-cast mode I'll do:
openConnection(/*stuff*/);
establishMConnection(/*stuff*/);
tearDownMConnection(/*stuff*/); <- destructor activity
When receiving the mode of operation is irrelevant. ie. You'll perform
the same operation in _either_ mode. i.e
openConnection(/*stuff*/);
configureRxChannel(/*stuff*/); configure the receive channel
tearDownRxChannel( /* stuff */)
You're allowed to call openConnection once, independent of the mode.
For instance, if I desire to send and receive in multi-cast mode. I
call openConnection once. So now:
openConnection(/*stuff*/);
establishMConnection(/*stuff*/);
configureRxChannel(/*stuff*/); configure the receive channel
So the best I could come with is as follows:
struct Connections {}; // vendor stuff
struct Channels {}; // vendor stuff
class receiver()
{
public:
receiver(vector<Connections>& coVec,
vector<Channels>& chVec))
{
if (openConnection(coVec)) {}
if (configureRxChannel(chVec)) {}
}
~receiver() throw() { if ( tearDownRxChannel(/*stuff*/)) }
// miscellaneous functions for status info.
};
class uniC
{
receiver& ref
public:
//constructor for the case where you desire to send and receive
uniC (receiver& r)
: ref(r)
{}
// constructor for the case where i desire to send only.
uniC (vector<Connections>& coVec)
{ if (openConnection(coVec)) {} }
~uniC () throw() { if ( tearDownUConnection(/*stuff*/)){} }
bool establishUConnection(/*stuff*/) {}
};
class multiC
{
receiver ref;
public:
// for the case where you desire to send and receive
multiC(receiver& r)
: ref(r)
{}
// for the case where i desire to send only.
multiC(vector<Connections>& coVec)
{ if (openConnection(coVec)) {} }
~multiC() throw() { if ( tearDownMConnection(/*stuff*/)){} }
bool establishMConnection(/*stuff*/) {}
};
Just uncertain if I'm on the right track here. So I'd appreaciate some
feedback.
Thanks in advance.