[gephex-devel] gephex--main--0.4--patch-1857

gephex at sonnenland.kexbox.org gephex at sonnenland.kexbox.org
Sun Mar 6 00:43:20 CET 2005


Archive: gephex at gephex.org--2004
New revision: gephex--main--0.4--patch-1857

--
Revision: gephex--main--0.4--patch-1857
Archive: gephex at gephex.org--2004
Creator: The Gephex Source Archive <gephex at gephex.org>
Date: Sun Mar  6 00:40:44 CET 2005
Standard-date: 2005-03-05 23:40:44 GMT
Modified-files: engine/src/engine/controller.cpp
    engine/src/engine/main.cpp engine/src/model/model.cpp
    engine/src/model/model.h
New-patches: gephex at gephex.org--2004/gephex--main--0.4--patch-1857
    martin at gephex.org--2004/gephex--martin--0.4--patch-60
    martin at gephex.org--2004/gephex--martin--0.4--patch-61
Summary: [MERGE-REQUEST] bugfix #103
Keywords: 

Patches applied:

 * martin at gephex.org--2004/gephex--martin--0.4--patch-60
   engine is now always in headless mode

 * martin at gephex.org--2004/gephex--martin--0.4--patch-61
   refactor small part of the engine startup

* added files

    {arch}/gephex/gephex--main/gephex--main--0.4/gephex at gephex.org--2004/patch-log/patch-1857
    {arch}/gephex/gephex--martin/gephex--martin--0.4/martin at gephex.org--2004/patch-log/patch-60
    {arch}/gephex/gephex--martin/gephex--martin--0.4/martin at gephex.org--2004/patch-log/patch-61

* modified files

--- orig/engine/src/engine/controller.cpp
+++ mod/engine/src/engine/controller.cpp
@@ -324,15 +324,8 @@
 
     sf = utils::AutoPtr<AutoTypeLoader>(new AutoTypeLoader(pDllLoader));
 
-    if (config.get_bool_param("headless"))
-      {
-	aml=utils::AutoPtr<AutoModuleLoader>(new AutoModuleLoader(pDllLoader));
-	pDllLoader.registerModuleClassNameReceiver(*aml);
-      }
-    else
-      {
-	pDllLoader.registerModuleClassNameReceiver(moduleClassNameReceiver);
-      }
+    aml=utils::AutoPtr<AutoModuleLoader>(new AutoModuleLoader(pDllLoader));
+    pDllLoader.registerModuleClassNameReceiver(*aml);
 
     pDllLoader.registerTypeClassNameReceiver(*sf);
 
@@ -368,36 +361,43 @@
     pDllLoader.readDlls(modules, types, frei0rs);
     std::cout << "   done
";
 
-    if (config.get_bool_param("headless"))
-      {
-	pDllLoader.registerModuleClassNameReceiver(moduleClassNameReceiver);
-      }
+    pDllLoader.registerModuleClassNameReceiver(moduleClassNameReceiver);
 	
     std::cout << "Reading graphs...";
     std::cout.flush();
     pModel.updateFileSystem();
     std::cout << "   done
";
 
-    try 
+    std::string render_graph_id=config.get_string_param("render_graph_id");
+    std::string render_snap_id =config.get_string_param("render_snap_id");
+
+    //create graph and snapshot if they don't already exist
+    if( !pModel.check_for_graph_id(render_graph_id) )
       {
-        pModel.newGraphWithID("default", "_default_", false);
-        pModel.newControlValueSetWithID("_default_", "default", "_default_");
-        pModel.changeRenderedGraph("_default_", "_default_");
-        pModel.changeEditGraph("_default_", "_default_");
+	std::cout << "create new graph: " << render_graph_id << std::endl;
+	pModel.newGraphWithID(render_graph_id, render_graph_id, false);
       }
-    catch (std::exception& e)
+	
+    if( !pModel.check_for_snap_id(render_graph_id,render_snap_id) )
       {
-        logger->error("Could not create default graph", e.what());
+	std::cout << "create new snap: " << render_graph_id << " "
+		  << render_snap_id << std::endl;
+	pModel.newControlValueSetWithID(render_graph_id,
+					render_snap_id,
+					render_snap_id);
       }
+				    
+    // activate the graph/snapshot combination
+    pModel.changeRenderedGraph(render_graph_id, 
+			       render_snap_id);
+    
+    pModel.changeEditGraph(render_graph_id, 
+			   render_snap_id);
 
-    if (config.get_bool_param("autostart"))
-      {
-        std::string render_graph_id=config.get_string_param("render_graph_id");
-        std::string render_snap_id =config.get_string_param("render_snap_id");
-        pModel.changeRenderedGraph(render_graph_id, 
-				   render_snap_id);
-	pRenderer.start();
-      }
+    
+    // start the render if option is set or if in timeout mode
+    if (config.get_bool_param("autostart") || ttl != 0)
+      pRenderer.start();
   }
 	
   Controller::~Controller()


--- orig/engine/src/engine/main.cpp
+++ mod/engine/src/engine/main.cpp
@@ -248,15 +248,7 @@
                                       "Path and prefix of the unix nodes "
                                       "in the filesystem (unix only)", &def));
 
-
-      def.b = true;
-      params.push_back(config_param_t("headless",
-                                      config_param_t::BOOL_PARAM,
-                                      "engine",
-                                      "Start without GUI, load all "
-                                      "available modules", &def));
-
-      def.b = true;
+      def.b = false;
       params.push_back(config_param_t("autostart",
                                       config_param_t::BOOL_PARAM,
                                       "engine",
@@ -264,7 +256,7 @@
                                       "rendering", &def));
 
 
-      def.s = "_default_";
+      def.s = "default";
       params.push_back(config_param_t("render_graph_id",
                                       config_param_t::STRING_PARAM,
                                       "engine",


--- orig/engine/src/model/model.cpp
+++ mod/engine/src/model/model.cpp
@@ -515,6 +515,40 @@
     gr->graphDataUnSet(type);
   }
 
+  bool Model::check_for_graph_id(const std::string& graph_id)
+  {
+    // check if the id exists
+        GraphMap::const_iterator 
+      it = lookForGraph(graph_id,
+			graphs,
+			specs,
+			*fileSystem,
+			smartAss,
+			m_logger);
+
+	return it != graphs.end();
+  }
+
+  bool Model::check_for_snap_id(const std::string& graph_id,
+				const std::string& snap_id)
+  {
+    GraphMap::const_iterator 
+      it = lookForGraph(graph_id,
+			graphs,
+			specs,
+			*fileSystem,
+			smartAss,
+			m_logger);
+
+    if (it==graphs.end())
+      return false;
+
+    const Graph::ValueSetMap& valueSets = it->second->getValueSetMap();
+			
+    return valueSets.end() != valueSets.find(snap_id);
+  }
+  
+  
   void Model::newGraphWithID(const std::string& graphName,
                              const std::string& graphID,
                              bool notifyAndCreate)


--- orig/engine/src/model/model.h
+++ mod/engine/src/model/model.h
@@ -177,6 +177,22 @@
 
       void updateFileSystem();
 
+      /**
+       * check if a graph with such a ID exists in the model
+       * \param graph_id is the id of the graph to check for
+       * 
eturns true if it exists
+       */
+      bool check_for_graph_id(const std::string& graph_id);
+
+      /**
+       * check if a snapshot with such a ID exists in the model
+       * \param graph_id is the id of the graph to check for
+       * \param snap_id is the id of the snapshot to check for
+       * 
eturns true if it exists
+       */
+      bool check_for_snap_id(const std::string& graph_id,
+			     const std::string& snap_id);
+      
       virtual void modExecTimeSignal(const std::string& graphName,
 				     int nodeID, double execTime);
 



More information about the gephex-devel mailing list