Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

ServiceEntryCommand.cpp

Go to the documentation of this file.
00001 #ifdef TEST
00002 
00003 #include "headers.h"
00004 
00005 const static string serviceEntryCommandString = "se";
00006 const static string constructCommandString = "construct";
00007 const static string destructCommandString = "destruct";
00008 const static string toConnectedStateCommandString = "toConnectedState";
00009 const static string connectionAcceptedCommandString = "connectionAccepted";
00010 const static string copyCommandString = "copy";
00011 const static string toDisconnectedStateCommandString = "toDisconnectState";
00012 const static string toConnectingStateCommandString = "toConnectingState";
00013 
00014 
00015 ServiceEntryCommand::ServiceEntryCommand() : Command() {
00016     m_serviceEntry = NULL;
00017 }
00018 
00019 
00020 string 
00021 ServiceEntryCommand::getCommandString() {
00022     return serviceEntryCommandString;
00023 }
00024 
00025 
00026 void
00027 ServiceEntryCommand::run(std::ostream& s) {
00028     if (m_args[1].empty()) {
00029         getHelp(s);
00030         return;
00031     }
00032 
00033     if (m_args[1] == showCommandString) {
00034     }
00035     else if (m_args[1] == constructCommandString) {
00036         m_serviceEntry = new ServiceEntry(NULL);
00037     }
00038     else if (m_args[1] == destructCommandString) {
00039         delete m_serviceEntry;
00040         m_serviceEntry = NULL;
00041     }
00042     else if (m_args[1] == toConnectingStateCommandString) {
00043         m_serviceEntry->toConnectingState();
00044     }
00045     else if (m_args[1] == toConnectedStateCommandString) {
00046         m_serviceEntry->toConnectedState();
00047     }
00048     else if (m_args[1] == connectionAcceptedCommandString) {
00049         m_serviceEntry->connectionAccepted(5);
00050     }
00051     else if (m_args[1] == toDisconnectedStateCommandString) {
00052         m_serviceEntry->toDisconnectedState();
00053     }
00054     else if (m_args[1] == copyCommandString) {
00055         ServiceEntry se(GlobalObjects::instance()->getServiceTable());
00056         se = *m_serviceEntry;
00057         s << "New Copy:\n";
00058         s << se;
00059         s <<" Old Copy:\n";
00060     }
00061     else {
00062         getHelp(s);
00063         return;
00064     }
00065     if (m_serviceEntry != NULL) {
00066         s << *m_serviceEntry;
00067     }
00068 }
00069 
00070 
00071 void
00072 ServiceEntryCommand::getHtmlInterface(std::ostream& s) {
00073     s << "<h2>Service Entry</h2>"
00074         << "This is for testing the Service Entry object.  You can simulate the different states of an end-to-end connection.\n";
00075     beginUl(s);
00076     generateHtmlSubcmd(s, constructCommandString, "construct");
00077     generateHtmlSubcmd(s, destructCommandString, "destruct");
00078     generateHtmlSubcmd(s, showCommandString, "show");
00079     generateHtmlSubcmd(s, toConnectingStateCommandString, "to connecting state");
00080     generateHtmlSubcmd(s, toConnectedStateCommandString, "to connected state");        
00081     generateHtmlSubcmd(s, connectionAcceptedCommandString, "simulate connection accepted");
00082     generateHtmlSubcmd(s, toDisconnectedStateCommandString, "disconnection");
00083     generateHtmlSubcmd(s, copyCommandString, "copy this service entry");
00084     endUl(s);
00085 }
00086 
00087 
00088 void
00089 ServiceEntryCommand::getHelp(std::ostream& s) {
00090     s << serviceEntryCommandString << ": Service Entry Command\n"
00091         << "  " << constructCommandString <<"\n"
00092         << "  " << destructCommandString << "\n"
00093         << "  " << showCommandString << "\n"
00094         << "  " << toConnectingStateCommandString << "\n"
00095         << "  " << toConnectedStateCommandString << "\n"
00096         << "  " << connectionAcceptedCommandString << "\n"
00097         << "  " << toDisconnectedStateCommandString << "\n"
00098         << "  " << copyCommandString << "\n";
00099 }
00100 
00101 #endif
00102 

Generated at Thu Jul 11 13:31:52 2002 for Peekabooty by doxygen1.2.9 written by Dimitri van Heesch, © 1997-2001