Revision: 44665
          http://brlcad.svn.sourceforge.net/brlcad/?rev=44665&view=rev
Author:   davidloman
Date:     2011-05-24 18:00:34 +0000 (Tue, 24 May 2011)

Log Message:
-----------
Implement a ListCmd for the test client.

Modified Paths:
--------------
    geomcore/trunk/src/GS/CMakeLists.txt

Added Paths:
-----------
    geomcore/trunk/include/ListCmd.h
    geomcore/trunk/src/GS/cmds/ListCmd.cxx

Added: geomcore/trunk/include/ListCmd.h
===================================================================
--- geomcore/trunk/include/ListCmd.h                            (rev 0)
+++ geomcore/trunk/include/ListCmd.h    2011-05-24 18:00:34 UTC (rev 44665)
@@ -0,0 +1,54 @@
+/*                       L I S T C M D . H
+ * BRL-CAD
+ *
+ * Copyright (c) 2011 United States Government as represented by
+ * the U.S. Army Research Laboratory.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this file; see the file named COPYING for more
+ * information.
+ */
+/** @file ListCmd.h
+ *
+ * Brief description
+ *
+ */
+
+#ifndef __LISTCMD_H__
+#define __LISTCMD_H__
+
+#include "AbstractClientCmd.h"
+#include <string>
+
+class ListCmd : public AbstractClientCmd {
+public:
+       ListCmd();
+       virtual ~ListCmd();
+
+       std::string getUsage();
+       std::string getHelp();
+
+protected:
+       bool _exec(GSCmdLineClient* client, std::list<std::string> args);
+};
+
+#endif /* __LISTCMD_H__ */
+
+/*
+ * Local Variables:
+ * tab-width: 8
+ * mode: C
+ * indent-tabs-mode: t
+ * c-file-style: "stroustrup"
+ * End:
+ * ex: shiftwidth=4 tabstop=8
+ */


Property changes on: geomcore/trunk/include/ListCmd.h
___________________________________________________________________
Added: svn:mime-type
   + text/plain
Added: svn:keywords
   + Revision Date Author
Added: svn:eol-style
   + native

Modified: geomcore/trunk/src/GS/CMakeLists.txt
===================================================================
--- geomcore/trunk/src/GS/CMakeLists.txt        2011-05-24 17:55:12 UTC (rev 
44664)
+++ geomcore/trunk/src/GS/CMakeLists.txt        2011-05-24 18:00:34 UTC (rev 
44665)
@@ -52,6 +52,7 @@
        cmds/AbstractClientCmd.cxx
        cmds/HelpCmd.cxx
        cmds/GetCmd.cxx
+       cmds/ListCmd.cxx
        cmds/LoginCmd.cxx
        cmds/LogoutCmd.cxx
        cmds/ShutdownCmd.cxx
@@ -94,6 +95,7 @@
        AbstractClientCmd.h
        HelpCmd.h
        GetCmd.h
+       ListCmd.h
        LoginCmd.h
        LogoutCmd.h
        ShutdownCmd.h

Added: geomcore/trunk/src/GS/cmds/ListCmd.cxx
===================================================================
--- geomcore/trunk/src/GS/cmds/ListCmd.cxx                              (rev 0)
+++ geomcore/trunk/src/GS/cmds/ListCmd.cxx      2011-05-24 18:00:34 UTC (rev 
44665)
@@ -0,0 +1,85 @@
+/*                     L I S T C M D . C X X
+ * BRL-CAD
+ *
+ * Copyright (c) 2011 United States Government as represented by
+ * the U.S. Army Research Laboratory.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this file; see the file named COPYING for more
+ * information.
+ */
+/** @file ListCmd.cxx
+ *
+ * Brief description
+ *
+ */
+
+#include "ListCmd.h"
+#include "Portal.h"
+#include "PortalManager.h"
+#include "TypeOnlyMsg.h"
+#include "NetMsgTypes.h"
+#include "DirListReqMsg.h"
+
+ListCmd::ListCmd() : AbstractClientCmd("list") {}
+
+ListCmd::~ListCmd() {}
+
+std::string
+ListCmd::getUsage()
+{
+    return "Usage: list pathToGeometry";
+}
+
+std::string
+ListCmd::getHelp()
+{
+    return "Attempts to get a list of geometry for the provided path from the 
current GeometryService";
+}
+
+bool
+ListCmd::_exec(GSCmdLineClient* client, std::list<std::string> args)
+{
+    int argn = args.size();
+
+    if (argn != 1) {
+       this->printUsage();
+       return false;
+    }
+
+    /* Check to see if we are connected */
+    Portal* p = client->getCurrentPortal();
+    if (p == NULL) {
+       this->log->logWARNING("ListCmd", "Not connected to a Geometry 
Service.");
+               return false;
+    }
+    std::list<std::string>::iterator it = args.begin();
+    std::string path(*it);
+
+    this->log->logINFO("ListCmd", "Attempting to list: '" + path + "'.");
+
+    DirListReqMsg req(path);
+
+    p->send(&req);
+
+    return true;
+}
+
+/*
+ * Local Variables:
+ * tab-width: 8
+ * mode: C
+ * indent-tabs-mode: t
+ * c-file-style: "stroustrup"
+ * End:
+ * ex: shiftwidth=4 tabstop=8
+ */


Property changes on: geomcore/trunk/src/GS/cmds/ListCmd.cxx
___________________________________________________________________
Added: svn:mime-type
   + text/plain
Added: svn:keywords
   + Revision Date Author
Added: svn:eol-style
   + native


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
vRanger cuts backup time in half-while increasing security.
With the market-leading solution for virtual backup and recovery, 
you get blazing-fast, flexible, and affordable data protection.
Download your free trial now. 
http://p.sf.net/sfu/quest-d2dcopy1
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to