Click here to Skip to main content
15,896,118 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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:
C++
#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.
Posted
Updated 3-Oct-10 22:26pm
v2

1 solution

As router's a template don't you get an error in main at:

Router integerRouter;


?

Cheers,

Ash
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900