Changeset 10301 for trunk


Ignore:
Timestamp:
04/07/11 12:44:21 (14 years ago)
Author:
tbretz
Message:
Implemented commands to display the command description and the availabl services.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/src/RemoteControl.h

    r10183 r10301  
    6464    typedef std::map<const std::string, StateClient*> ClientList;
    6565
    66     ServiceList fServiceList;    /// An up-to-date list of all available commands
     66    ServiceList fCommandList;    /// An up-to-date list of all available commands
     67    ServiceList fServiceList;    /// An up-to-date list of all available services
    6768    ClientList  fClientList;     /// A list with all MESSAGE services to which we subscribed
    6869
     
    7677        MessageImp(out),
    7778        DimErrorRedirecter(static_cast<MessageImp&>(*this)),
    78         lout(in), fServiceList("CMD", out)
    79     {
     79        lout(in), fCommandList("CMD", out), fServiceList("", out)
     80    {
     81        fCommandList.SetHandler(this);
    8082        fServiceList.SetHandler(this);
    8183    }
     
    119121        {
    120122            if (fCurrentServer.empty())
    121                 return T::Complete(fServiceList.GetServerList(), text);
     123                return T::Complete(fCommandList.GetServerList(), text);
    122124            else
    123                 return T::Complete(fServiceList.GetServiceList(fCurrentServer), text);
    124         }
    125         return T::Complete(fServiceList.GetServiceList(l), text);
     125                return T::Complete(fCommandList.GetServiceList(fCurrentServer), text);
     126        }
     127        return T::Complete(fCommandList.GetServiceList(l), text);
    126128    }
    127129
     
    129131    {
    130132        RemoteControlImp::infoHandler();
    131         if (!fCurrentServer.empty() && !fServiceList.HasServer(fCurrentServer))
     133        if (!fCurrentServer.empty() && !fCommandList.HasServer(fCurrentServer))
    132134        {
    133135            fCurrentServer = "";
     
    142144        lout(T::GetStreamIn())
    143145    {
    144         fServiceList.SetHandler(this);
    145146    }
    146147
     
    151152        lout << " " << kUnderline << "Specific commands:" << endl;
    152153        lout << kBold << "  s,servers   " << kReset << "List all servers which are connected." << endl;
     154        lout << kBold << "  svc,service " << kReset << "List all services in the network." << endl;
    153155        lout << endl;
    154156        return true;
     
    158160    {
    159161        lout << endl << kBold << "List of commands:" << endl;
    160         fServiceList.PrintServiceList(lout);
     162        fCommandList.PrintDescription(lout);
    161163        return true;
    162164    }
     
    170172        if (str=="servers" || str=="s")
    171173        {
    172             fServiceList.PrintServerList(lout);
     174            fCommandList.PrintServerList(lout);
     175            return true;
     176        }
     177
     178        if (str=="service" || str=="svc")
     179        {
     180            fServiceList.PrintDescription(lout);
    173181            return true;
    174182        }
Note: See TracChangeset for help on using the changeset viewer.