Main Page | Modules | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

ogrid.cpp

Go to the documentation of this file.
00001 #include <iostream>
00002 #include <fstream>
00003 #include <sstream>
00004 #include <vector>
00005 #include "parsecl.hpp"
00006 #include "properties.hpp"
00007 #include "occupancy_grid.hpp"
00008 
00009 using namespace Arak;
00010 
00015 int main(int argc, char** argv) {
00016   using namespace Arak::Util;
00017   // Parse the command line.
00018   CommandLine cl;
00019   CommandLine::MultiParameter<std::string>
00020     propFiles("-p", "--prop-file", "specifies a property file");
00021   cl.add(propFiles);
00022   CommandLine::MultiParameter<std::string>
00023     propDefs("-D", "--define-prop", "defines a property value");
00024   cl.add(propDefs);
00025 
00026   if (!cl.parse(argc, argv, std::cerr)) {
00027     cl.printUsage(std::cerr);
00028     exit(1);
00029   }
00030 
00031   // Parse the properties files.
00032   Arak::Util::PropertyMap properties;
00033   const std::vector<std::string>& propFilePaths = propFiles.values();
00034   for (std::vector<std::string>::const_iterator it = propFilePaths.begin();
00035        it != propFilePaths.end(); it++) {
00036     std::string path = *it;
00037     std::ifstream in(path.data());
00038     in >> properties;
00039   }
00040   // Parse the overriding property definitions.
00041   const std::vector<std::string>& propDefinitions = propDefs.values();
00042   for (std::vector<std::string>::const_iterator it = propDefinitions.begin();
00043        it != propDefinitions.end(); it++) {
00044     std::string def = *it;
00045     std::istringstream in(def);
00046     in >> properties;
00047   }
00048 
00049   std::cerr << "Properties:" << std::endl << properties << std::endl;
00050 
00051   // Build the occupancy grid.
00052   OccupancyGrid grid(properties);
00053 
00054   // Write the result to standard out.
00055   grid.write(std::cout);
00056   
00057 }

Generated on Wed May 25 14:39:17 2005 for Arak by doxygen 1.3.6