Module: nagvis
Branch: master
Commit: 89ad8d58f7bf8cff80549132ef36053529a14bc1
URL:    
http://nagvis.git.sourceforge.net/git/gitweb.cgi?p=nagvis/nagvis;a=commit;h=89ad8d58f7bf8cff80549132ef36053529a14bc1

Author: LaMi <[email protected]>
Date:   Mon Mar 22 23:29:57 2010 +0100

Reduced map configuration reading in object loop

---

 share/server/core/classes/CoreModAutoMap.php |   14 +++++++-------
 share/server/core/classes/CoreModMap.php     |   17 ++++++++---------
 2 files changed, 15 insertions(+), 16 deletions(-)

diff --git a/share/server/core/classes/CoreModAutoMap.php 
b/share/server/core/classes/CoreModAutoMap.php
index b6b1e61..484c382 100644
--- a/share/server/core/classes/CoreModAutoMap.php
+++ b/share/server/core/classes/CoreModAutoMap.php
@@ -28,6 +28,7 @@
 class CoreModAutoMap extends CoreModule {
        private $name = null;
        private $opts = null;
+       private $MAPCFG  = null;
        
        public function __construct(GlobalCore $CORE) {
                $this->CORE = $CORE;
@@ -195,6 +196,10 @@ class CoreModAutoMap extends CoreModule {
                // Initialize backends
                $BACKEND = new GlobalBackendMgmt($this->CORE);
                
+               // Read the map configuration file
+               $this->MAPCFG = new NagVisAutomapCfg($this->CORE, $this->name);
+               $this->MAPCFG->readMapConfig();
+               
                $numObjects = count($arrType);
                for($i = 0; $i < $numObjects; $i++) {
                        // Get the object configuration
@@ -270,16 +275,11 @@ class CoreModAutoMap extends CoreModule {
        private function getObjConf($objType, $objName1, $objName2 = '') {
                $objConf = Array();
                
-               $MAPCFG = new NagVisAutomapCfg($this->CORE, $this->name);
-                               
-               // Read the map configuration file
-               $MAPCFG->readMapConfig();
-               
                // Default object configuration
-               $objConf = $MAPCFG->getObjectConfiguration($objName1);
+               $objConf = $this->MAPCFG->getObjectConfiguration($objName1);
 
                // backend_id is filtered in getObjectConfiguration(). Set it 
manually
-               $objConf['backend_id'] = $MAPCFG->getValue('global', 0, 
'backend_id');
+               $objConf['backend_id'] = $this->MAPCFG->getValue('global', 0, 
'backend_id');
                        
                return $objConf;
        }
diff --git a/share/server/core/classes/CoreModMap.php 
b/share/server/core/classes/CoreModMap.php
index 696c196..035c844 100644
--- a/share/server/core/classes/CoreModMap.php
+++ b/share/server/core/classes/CoreModMap.php
@@ -27,6 +27,7 @@
  */
 class CoreModMap extends CoreModule {
        private $name = null;
+       private $MAPCFG = null;
        
        public function __construct(GlobalCore $CORE) {
                $this->CORE = $CORE;
@@ -952,6 +953,10 @@ class CoreModMap extends CoreModule {
                // Initialize backends
                $BACKEND = new GlobalBackendMgmt($this->CORE);
                
+               // Initialize map configuration (Needed in getMapObjConf)
+               $this->MAPCFG = new NagVisMapCfg($this->CORE, $this->name);
+               $this->MAPCFG->readMapConfig();
+               
                $numObjects = count($arrType);
                for($i = 0; $i < $numObjects; $i++) {
                        // Get the object configuration
@@ -1027,13 +1032,7 @@ class CoreModMap extends CoreModule {
                // Get the object configuration from map configuration (object 
and
                // defaults)
                
-               // Initialize map configuration
-               $MAPCFG = new NagVisMapCfg($this->CORE, $this->name);
-               
-               // Read the map configuration file
-               $MAPCFG->readMapConfig();
-               
-               if(is_array($objs = $MAPCFG->getDefinitions($objType))){
+               if(is_array($objs = $this->MAPCFG->getDefinitions($objType))){
                        $count = count($objs);
                        for($i = 0; $i < $count && count($objConf) >= 0; $i++) {
                                if($objs[$i]['object_id'] == $objectId) {
@@ -1050,8 +1049,8 @@ class CoreModMap extends CoreModule {
                
                if(count($objConf) > 0) {
                        // merge with "global" settings
-                       foreach($MAPCFG->getValidTypeKeys($objType) AS $key) {
-                               $objConf[$key] = $MAPCFG->getValue($objType, 
$objConf['id'], $key);
+                       foreach($this->MAPCFG->getValidTypeKeys($objType) AS 
$key) {
+                               $objConf[$key] = 
$this->MAPCFG->getValue($objType, $objConf['id'], $key);
                        }
                } else {
                        // object not on map


------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Nagvis-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nagvis-checkins

Reply via email to