I have cut-and-paste the full difinition of "testlist" to the winsock2server.cpp, and also include" router.h" in the winsock2server.cpp( this is for router definition visible), but still does not work.
in my algorithm, the main.cpp file as:
#include <iostream>
#include <string>
using namespace std;
#include "router.h"
template <typename T>
void testList(Router < T > &listObject, const string &typeName)
{
cout <<" Testing a list of " << typeName << " values \n";
instructions ();
int choice;
T value;
do
{
cout << "?";
cin >> choice;
switch (choice)
{
case 1:
cout << "enter" << typeName <<":";
cin >> value;
listObject.Register(value);
listObject.print();
break;
case 2:
cout << "enter" << typeName <<":";
cin >> value;
listObject.sendRegistration(value);
listObject.print();
break;
case 3:
if (listObject.sendRegistrationCancellation(value))
cout << value <<" removed from list\n";
listObject.print();
break;
case 4:
if (listObject.sendCancellationConfirmation(value))
cout << value <<" removed from list\n";
listObject.print();
break;
}
} while (choice != 5);
cout << "End list test \n\n";
}
void instructions ()
{
cout << "enter one of the following:\n"
<< " 1 to register node to the list\n"
<< " 2 to sendRegistration to the node \n"
<<" 3 to sendRegistrationCancellation to the list\n"
<<"4 to end list processing \n";
}
int main ()
{
Router <int> integerRouter;
testList ( integerRouter, "integer");
Router < double> doubleRouter;
testList ( doubleRouter, "double");
return 0;
}
</int>
I want to call this algorithm in the server, so i put
Router <int> integerRouter;
testList ( integerRouter, "integer");
Router <double> doubleRouter;
testList ( doubleRouter, "double");
in the winsock2.server, to try to call,cannot implement sucessfully.