+++ /dev/null
-// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// 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 library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : SALOME_DataTypeCatalog.idl
-// Author : Estelle Deville, Paul Rascle
-// $Header$
-
-module SALOME_DataTypeCatalog{
-// Type definitions
-
-// List of Data Type Names
- typedef sequence<string> ListOfDataTypeName ;
-
- // Exception thrown if a DataType is not found in the catalog
- exception NotFound {};
-//--------------------------------------------------------------------------
-// Interfaces
-
-// Catalog interface :
-// methods to :
-// - obtain the data type names of the catalog
-// - test the compatibility between two type names
-interface DataCatalog
-{
- ListOfDataTypeName GetDataTypeList() ;
- boolean isDerivedFrom(in string type_in, in string type_out) raises(NotFound);
- string GetDataInterfaceRead(in string type) raises(NotFound);
- string GetDataInterfaceWrite(in string type)raises(NotFound);
- ListOfDataTypeName GetDataTypeParents(in string type) raises(NotFound);
-} ;
-};
--- /dev/null
+# =================================================================
+# PARAM SETTINGS
+#
+# ** standard.cfg :
+# sets up the daemon with default params as given
+# in the CosNotification specification.
+#
+# ** channel.cfg :
+# sets up daemon with default params which we prefer.
+#
+# You can choose which one to use, or copy one and edit it
+# to suit your needs.
+#
+# There are only a couple of differences:
+#
+# standard.cfg channel.cfg
+#
+# PacingInterval 0 1000 (1 second)
+# MaximumBatchSize 1 8
+#
+
+# =================================================================
+# omniNotify Configuration (Startup) Properties
+#
+# You can modify startup properties in one of 3 ways
+#
+# 1. copy this file to create your own .cfg file and edit it. Use
+# promp> notifd -i -c myconfig.cfg
+# to start notifd using the config file myconfig.cfg
+#
+# 2. set an environment variable; this will override any
+# config file settings. e.g., for tcsh,
+# promp> setenv LocalClockTDF 0
+# promp> notifd -i -c channel.cfg
+# This uses channel.cfg but changes the time zone to GMT
+#
+# 3. use explicit command-line param definitions
+# these override both the config file and any env variable settings
+# promp> setenv LocalClockTDF 0
+# promp> notifd -i -c channel.cfg -DLocalClockTDF=-60
+# This would set the time zone to 1 hour earlier than GMT
+#
+# omniNotify manages 3 kinds of properties
+#
+# * ServerQOS properties are properties that all channels share;
+# they cannot be changed on a per-channel basis.
+#
+# * AdminQoS properties are properties that can only be
+# set at the channel factory / channel level.
+#
+# * NotifQoS properties are properties that can be set at
+# many levels: channel factory, channel, admin, proxy;
+# some of these can also be changed on a per-event basis.
+#
+# The channel factory's AdminQoS and NotifQoS property settings
+# are used as defaults: when creating a channel these property
+# values are used unless specific overrides are provided in
+# with the channel creation request. Once a channel is created,
+# its AdminQoS and NotifQoS properties can be modified; the
+# factory's properties can also be modified. Note that once a
+# channel is created, its properties are independent of the
+# factory -- modifications to the channel properties do not affect
+# the factory defaults, and modifications to the factory defaults
+# do not affect the properties of already-created channels.
+#
+# The settings specified in config files, environment
+# variables and/or command line param definitions are used to
+# set the initial values for the server's ServerQoS properties and
+# for the channel factory's AdminQoS and NotifQoS
+# default properties. Since the default channel is created on startup,
+# it also takes its AdminQoS and NotifQoS properties from
+# these initial settings.
+#
+#==================================================================
+
+#==================================================================
+# Misc Startup Properties
+# -- these are essentially ServerQoS properties,
+# but are not currently implemented that way
+#==================================================================
+
+# Names to be assigned to the channel factory and channel created by
+# the notifd channel daemon
+
+ChannelFactoryName ChannelFactory
+DefaultChannelName EventChannel
+
+# Path names of the files used to store the string representation of
+# the above channel factory IOR and channel object IOR
+
+FactoryIORFileName /tmp/rdifact.ior
+ChannelIORFileName /tmp/rdichan.ior
+
+# If a file path is given for the following parameter, the file is
+# used for storing debugging information. 'stderr' and 'stdout' can be
+# used to direct output to standard error / standard output.
+
+#DebugLogFile ./debug.log
+DebugLogFile stderr
+
+# If a file path is given for the following parameter, the file is
+# used for storing report information. 'stderr' and 'stdout' can be
+# used to direct output to standard error / standard output.
+
+#ReportLogFile ./report.log
+ReportLogFile stdout
+
+# debug flags -- 0 is "off", 1 is "on"
+DebugDaemon 0
+DebugChannelFactory 0
+DebugFilter 0
+DebugChannel 0
+DebugConsumerAdmin 0
+DebugSupplireAdmin 0
+DebugConsumerProxy 0
+DebugSupplierProxy 0
+DebugEventQueue 0
+DebugRDIEvent 0
+DebugFilterAdmin 0
+DebugFilterEval 0
+DebugCosConsumerProxies 0
+DebugCosSupplierProxies 0
+DebugNotifQoS 0
+DebugAdminQoS 0
+DebugNotifQueue 0
+
+# report flags -- 0 is "off", 1 is "on"
+ReportChannelStats 1
+ReportQueueSizeStats 1
+ReportConnectedConsumers 1
+ReportConnectedSuppliers 1
+ReportConnectedFilters 1
+ReportUnconnectedFilters 1
+ReportEventRejections 1
+ReportEventDrops 1
+ReportNotifQoS 1
+ReportAdminQoS 1
+ReportServerQoS 1
+
+#==================================================================
+# Initial ServerQoS Properties
+#==================================================================
+
+# Each ConsumerAdmin and SupplierAdmin object is assigned to a group
+# and each group is processed by only one thread. The number of such
+# groups and the number of threads that handle the groups have to be
+# at least 1. In addition, the number of threads should not exceed
+# the number of groups
+
+NumAdminGroups 2
+NumAdminThreads 2
+
+# notifd may split the filter evaluation processing in two stages. In
+# this case, a second thread pool is used for evaluating proxy-level
+# filters. The size of the pool is controled by the following
+
+NumProxyThreads 0
+
+# The following variables control the number of threads created for
+# pushing matched events to push-style consumers and pulling events
+# from pull-style suppliers. If these values are 0, each consumer
+# and supplier is assigned its own thread.
+
+NumPushThreads 4
+NumPullThreads 2
+
+# The following variables control the number of threads created for
+# notifying suppliers of subscription changes (using subscription_change)
+# and for notifying consumers of offer changes (using offer_change).
+# CAREFUL: Setting NumSChangeThreads to zero DISABLES
+# the sending of subscription_change messages!
+# CAREFUL: Setting NumOChangeThreads to zero DISABLES
+# the sending of offer_change messages
+
+NumOChangeThreads 1
+NumSChangeThreads 1
+
+# For pull style suppliers, the time period (milliseconds) between
+# pulls is controlled by the following variable.
+# A value of 0 corresponds to continuous pulling
+
+PullEventPeriod 100
+
+# Period in seconds used by the garbage collector of the event queue
+# The minimum number that can be used is 1
+
+QueueGCPeriod 300
+
+# The next entry specifies the time period (in seconds) between
+# each 'report' (the Report.. flags above control what gets reported).
+# The channel may have a built-in minimum, e.g, even if you say 0,
+# the channel may choose a 10 second period. (300 seconds = 5 mins)
+
+ReportingInterval 300
+
+# Description of local clock values returned from omnithread::get_time.
+# These values are here because we do not know a portable way to get
+# the clock accuracy and the time zone across all Unix flavors and
+# Windows. Let us know if you have a portable approach.
+#
+# LocalClockInaccLo/Hi: local clock inaccuracy in units of 100ns
+# (must fit in 48 bits, 32 for Lo, 16 for Hi)
+# LocalClockTDF: local time zone expressed in minutes west of
+# greenwhich meridian; 300=Eastern time zone, USA
+LocalClockInaccLo 0
+LocalClockInaccHi 0
+LocalClockTDF 300
+
+#==================================================================
+# Initial Default AdminQoS Properties
+#==================================================================
+
+# Maximum number of events that will be queued by the Channel before
+# before it begins discarding events or rejecting new ones. A value
+# of 0 does not place any upper limit.
+
+MaxQueueLength 0
+
+# The maximum number of Consumers that can be connected to a Channel
+# at any given time. A value of 0 does not place any upper limit.
+
+MaxConsumers 0
+
+# The maximum number of Suppliers that can be connected to a Channel
+# at any given time. A value of 0 does not place any upper limit.
+
+MaxSuppliers 0
+
+# If 1, newly announced events will be discarded when the number of
+# undelivered events in a Channel is equal to 'MaxQueueLength'. If
+# 0, newly announced events cause existing events to be discarded
+# according to the 'DiscardPolicy' QoS.
+
+RejectNewEvents 1
+
+#==================================================================
+# Initial Default NotifQoS Properties
+#==================================================================
+
+# EventReliability and ConnectionReliability can take the values:
+# 0 --> CosNotification::BestEffort
+# 1 --> CosNotification::Persistent
+# OrderPolicy can take the values:
+# 0 --> CosNotification::AnyOrder
+# 1 --> CosNotification::FifoOrder
+# 2 --> CosNotification::PriorityOrder
+# 3 --> CosNotification::DeadlineOrder
+# DiscardPolicy can take any of the above values and, in addition,
+# 4 --> CosNotification::LifoOrder
+# StartTimeSupported and StopTimeSupported are boolean and can take
+# the values
+# 0 --> FALSE
+# 1 --> TRUE
+#
+# NOTE: the current notifd implementation does NOT support all QoS
+# settings. In particular, it only supports the following:
+# EventReliability 0
+# ConnectionReliability 0
+# StartTimeSupported 0
+# StopTimeSupported 0
+
+# Note -- PacingInterval can be set programmatically to any
+# TimeBase::TimeT value (units = 100s of nanoseconds). Here you
+# set number of MILLISECONDS, e.g., a value of 1000 means send a batch
+# roughly every 1 second (or when MaxBatchSize is reached).
+
+EventReliability 0
+ConnectionReliability 0
+Priority 0
+Timeout 0
+StartTimeSupported 0
+StopTimeSupported 0
+OrderPolicy 0
+DiscardPolicy 0
+PacingInterval 1000
+MaxEventsPerConsumer 0
+MaximumBatchSize 8
+
--- /dev/null
+language=en
\ No newline at end of file
+++ /dev/null
-/* XPM */
-/* Drawn by Mark Donohoe for the K Desktop Environment */
-/* See http://www.kde.org */
-static char*forward[]={
-"16 16 5 1",
-"# c #000000",
-"a c #ffffff",
-"c c #808080",
-"b c #c0c0c0",
-". c None",
-"................",
-"................",
-".........#......",
-".........##.....",
-".........#a#....",
-"..########aa#...",
-"..#aaaaaaabaa#..",
-"..#bbbbbbbbbaa#.",
-"..#bbbbbbbbba#..",
-"..########ba#c..",
-"..ccccccc#a#c...",
-"........c##c....",
-"........c#c.....",
-"........cc......",
-"........c.......",
-"................",
-"................"};
-
+++ /dev/null
-/* XPM */
-/* Drawn by Mark Donohoe for the K Desktop Environment */
-/* See http://www.kde.org */
-static char*home[]={
-"16 16 4 1",
-"# c #000000",
-"a c #ffffff",
-"b c #c0c0c0",
-". c None",
-"........... ....",
-" ....##.......",
-"..#...####......",
-"..#..#aabb#.....",
-"..#.#aaaabb#....",
-"..##aaaaaabb#...",
-"..#aaaaaaaabb#..",
-".#aaaaaaaaabbb#.",
-"###aaaaaaaabb###",
-"..#aaaaaaaabb#..",
-"..#aaa###aabb#..",
-"..#aaa#.#aabb#..",
-"..#aaa#.#aabb#..",
-"..#aaa#.#aabb#..",
-"..#aaa#.#aabb#..",
-"..#####.######..",
-"................"};
-
+++ /dev/null
-#definition of the model
-salomeCommonModel = Model(id="salomeCommonModel")
-
-# Description of all intrinsic types
-dataString = Intrinsic(id='Datastring',
- modelOwner=salomeCommonModel,
- relatedType='STRING')
-identification = Intrinsic(id='Identification',
- modelOwner=salomeCommonModel,
- relatedType='STRING')
-salomeRef = Intrinsic(id='SalomeRef',
- modelOwner=salomeCommonModel,
- relatedType='SALOME_OBJECT_REFERENCE')
-dataReal = Intrinsic(id='Datareal',
- modelOwner=salomeCommonModel,
- relatedType='REAL')
-dataInteger = Intrinsic(id='Datainteger',
- modelOwner=salomeCommonModel,
- relatedType='INTEGER')
-
-# Description of units.
-units = Entity(id='Units',
- modelOwner=salomeCommonModel,
- stereotype='CONCRETE')
-units_name = SimpleField(id='name',
- relatedType=dataString,
- definitionMode='FORCED',
- stereotype='IDENTIFICATION',
- uiInformation=AttributeUi(defaultLabel='Name',
- defaultComment='Name of the unit',
- reentrantMode='NOT_REENTRANT'),
- datatype='PERSISTENT',
- evaluationMode='NONE')
-units_abreviation = SimpleField(id='abreviation',
- relatedType=dataString,
- definitionMode='FORCED',
- stereotype='AGREGATION',
- uiInformation=AttributeUi(defaultLabel='abreviation',
- defaultComment='Abreviation',
- reentrantMode='NOT_REENTRANT'),
- datatype='PERSISTENT',
- evaluationMode='NONE')
-
-units.fields = [units_name,units_abreviation]
-
-units.uiInformation = EntityUi(defaultLabel='Units definition',
- defaultComment='Definition of units',
- reentrantMode='REENTRANT')
-
+++ /dev/null
-# SALOME DataTypeCatalog : catalog of data types
-#
-# Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License.
-#
-# 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 library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#
-# See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-#
-#
-#
-# File : Makefile.am
-# Author : Guillaume Boulant (CSSI)
-# Module : SALOME
-# $Header$
-
-include $(top_srcdir)/salome_adm/unix/make_common_starter.am
-
-#
-# ===============================================================
-# Header to be installed
-# ===============================================================
-#
-# header files
-salomeinclude_HEADERS = \
- SALOME_DataTypeCatalog_impl.hxx \
- SALOME_DataTypeCatalog_Parser.hxx \
- SALOME_DataTypeCatalog_Handler.hxx
-
-#
-# ===============================================================
-# Local definitions
-# ===============================================================
-#
-
-# This local variable defines the list of CPPFLAGS common to all target in this package.
-COMMON_CPPFLAGS=\
- -I$(srcdir)/../Basics \
- -I$(srcdir)/../SALOMELocalTrace \
- -I$(srcdir)/../NamingService \
- -I$(srcdir)/../Utils \
- -I$(top_builddir)/salome_adm/unix \
- -I$(top_builddir)/idl \
- @CORBA_CXXFLAGS@ @CORBA_INCLUDES@
-
-# This local variable defines the list of dependant libraries common to all target in this package.
-COMMON_LIBS =\
- ../NamingService/libSalomeNS.la \
- ../Utils/libOpUtil.la \
- ../SALOMELocalTrace/libSALOMELocalTrace.la \
- ../Basics/libSALOMEBasics.la \
- $(top_builddir)/idl/libSalomeIDLKernel.la
-
-#
-# ===============================================================
-# Libraries targets
-# ===============================================================
-#
-
-lib_LTLIBRARIES = libSalomeDataTypeCatalog.la
-libSalomeDataTypeCatalog_la_SOURCES=\
- SALOME_DataTypeCatalog_Handler.cxx \
- SALOME_DataTypeCatalog_impl.cxx
-
-libSalomeDataTypeCatalog_la_CPPFLAGS =\
- $(COMMON_CPPFLAGS) \
- @QT_MT_INCLUDES@
-
-libSalomeDataTypeCatalog_la_LDFLAGS = -no-undefined -version-info=0:0:0
-libSalomeDataTypeCatalog_la_LIBADD =\
- $(COMMON_LIBS) \
- @QT_MT_LIBS@
-
-#
-# ===============================================================
-# Executables targets
-# ===============================================================
-#
-bin_PROGRAMS = SALOME_DataTypeCatalog_Server SALOME_DataTypeCatalog_Client
-
-#SALOME_DataTypeCatalog_Server
-SALOME_DataTypeCatalog_Server_SOURCES = SALOME_DataTypeCatalog_Server.cxx
-SALOME_DataTypeCatalog_Server_CPPFLAGS =\
- $(COMMON_CPPFLAGS) \
- @QT_MT_INCLUDES@
-
-SALOME_DataTypeCatalog_Server_LDADD =\
- libSalomeDataTypeCatalog.la \
- $(COMMON_LIBS) \
- @CORBA_LIBS@
-
-#SALOME_DataTypeCatalog_Client
-SALOME_DataTypeCatalog_Client_SOURCES = SALOME_DataTypeCatalog_Client.cxx
-SALOME_DataTypeCatalog_Client_CPPFLAGS =\
- $(COMMON_CPPFLAGS) \
- @QT_MT_INCLUDES@
-
-SALOME_DataTypeCatalog_Client_LDADD =\
- libSalomeDataTypeCatalog.la \
- $(COMMON_LIBS) \
- @CORBA_LIBS@
+++ /dev/null
-// SALOME DataTypeCatalog : catalog of data types
-//
-// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// 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 library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : SALOME_DataTypeCatalog_Client.cxx
-// Module : SALOME
-
-/* $Header$ */
-
-#include <iostream>
-#include "SALOME_NamingService.hxx"
-#include "SALOME_DataTypeCatalog.hh"
-#include <string>
-#include "utilities.h"
-using namespace std;
-
-int main(int argc,char **argv)
-{
- CORBA::ORB_var orb;
- CosNaming::NamingContext_var _rootContext;
- CORBA::Object_var objVar, objVarN;
- try {
-
- // initialize the ORB
-
- orb = CORBA::ORB_init (argc, argv);
-
-
- // Get CORBA reference of the catalog
- SALOME_NamingService NS(orb);
- CORBA::Object_var objVarN = NS.Resolve("/Kernel/DataTypeCatalog");
-
- SALOME_DataTypeCatalog::DataCatalog_var Catalogue = SALOME_DataTypeCatalog::DataCatalog::_narrow(objVarN);
- MESSAGE("Distant catalog of data type found")
-
- // Get component list
- SALOME_DataTypeCatalog::ListOfDataTypeName_var list_data_type = Catalogue->GetDataTypeList();
- int indice =-1;
- for (unsigned int ind = 0; ind < list_data_type->length();ind++)
- {
- MESSAGE("Data Type list : " << list_data_type[ind]);
- }
-
-
-
- // obtain interface_read of the first data type defined in the catalog
- char* interf;
- interf =Catalogue->GetDataInterfaceRead(list_data_type[0]);
- MESSAGE("Interface read pour " << list_data_type[0] << " : " << interf);
-
-
-
- // obtain interface_read of the last data type defined in the catalog
- interf =Catalogue->GetDataInterfaceRead(list_data_type[list_data_type->length() -1]);
- MESSAGE("Interface read pour " << list_data_type[list_data_type->length() -1] << " : " << interf);
-
- // obtain interface_write of the first data type defined in the catalog
- interf =Catalogue->GetDataInterfaceWrite(list_data_type[0]);
- MESSAGE("Interface write pour " << list_data_type[0] << " : " << interf);
-
-
-
- // obtain interface_read of the last data type defined in the catalog
- interf =Catalogue->GetDataInterfaceWrite(list_data_type[list_data_type->length() -1]);
- MESSAGE("Interface write pour " << list_data_type[list_data_type->length() -1] << " : " << interf);
-
- //obtain parents name of the last data type defined in the catalog
- SALOME_DataTypeCatalog::ListOfDataTypeName_var list_data_type1 = Catalogue->GetDataTypeParents(list_data_type[list_data_type->length() -1]);
-
- // Test derivation
- if (Catalogue->isDerivedFrom(list_data_type[0],list_data_type[list_data_type->length() -1]))
- {
- MESSAGE("The type " << list_data_type[list_data_type->length() -1] << " derived from " << list_data_type[0] );
- }
- else
- {
- MESSAGE("The type " << list_data_type[list_data_type->length() -1] << " is not derived from " << list_data_type[0]);
- }
-
- }
- catch(SALOME_DataTypeCatalog::NotFound &){
- INFOS("SALOME_DataTypeCatalog::NotFound");
- }
- catch(CORBA::SystemException&) {
- INFOS("Caught CORBA::SystemException.")
- }
- catch (CosNaming::NamingContext::CannotProceed &) {
- INFOS("CosNaming::NamingContext::CannotProceed")
- }
- catch (CosNaming::NamingContext::NotFound &) {
- INFOS("CosNaming::NamingContext::NotFound")
- }
- catch (CosNaming::NamingContext::InvalidName &) {
- INFOS("CosNaming::NamingContext::InvalidName")
- }
- catch (CosNaming::NamingContext::AlreadyBound &) {
- INFOS("CosNaming::NamingContext::AlreadyBound")
- }
- catch (CosNaming::NamingContext::NotEmpty &) {
- INFOS("CosNaming::NamingContext::NotEmpty")
- }
-
- catch(CORBA::Exception &sysEx) {
- INFOS("Caught CORBA::Exception.")
- }
-
-
- return 0;
-}
+++ /dev/null
-// SALOME DataTypeCatalog : catalog of data types
-//
-// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// 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 library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : SALOME_DataTypeCatalog_Handler.cxx
-// Author : Estelle Deville
-// Module : SALOME
-// $Header$
-
-#include "SALOME_DataTypeCatalog_Handler.hxx"
-
-#include "utilities.h"
-
-using namespace std;
-
-// contains all the data types defined in the catalog
-ListOfParserDataType _datatypelist;
-
-//----------------------------------------------------------------------
-// Function : SALOME_DataTypeCatalog_Handler
-// Purpose : Constructor
-//----------------------------------------------------------------------
-SALOME_DataTypeCatalog_Handler::SALOME_DataTypeCatalog_Handler()
-{
- MESSAGE("SALOME_DataTypeCatalog_Handler creation");
- // XML Tags initialisation
- // Used in the function endElement
- test_data_type_name = "DataType-name";
- test_data_type_interf_read = "DataType-interface-read";
- test_data_type_interf_write = "DataType-interface-write";
- test_data_type_parent_name = "Parent-name" ;
- test_data_type_parents = "DataType-Parents-list";
- test_data_type = "DataType";
-}
-
-//----------------------------------------------------------------------
-// Function : ~SALOME_DataTypeCatalog_Handler
-// Purpose : Destructor
-//----------------------------------------------------------------------
-SALOME_DataTypeCatalog_Handler::~SALOME_DataTypeCatalog_Handler()
-{
- MESSAGE("SALOME_DataTypeCatalog_Handler destruction");
-}
-
-//----------------------------------------------------------------------
-// Function : startDocument
-// Purpose : overload handler function
-//----------------------------------------------------------------------
-bool SALOME_DataTypeCatalog_Handler::startDocument()
-{
- MESSAGE("Begin parse document")
- // Empty the private elements
- _datatypelist.resize(0);
- _a_data_parents_list.resize(0);
- return true;
-}
-
-//----------------------------------------------------------------------
-// Function : startElement
-// Purpose : overload handler function
-//----------------------------------------------------------------------
-bool SALOME_DataTypeCatalog_Handler::startElement(const QString&,
- const QString &,
- const QString& qName,
- const QXmlAttributes& atts)
-{
- return true;
-}
-
-//----------------------------------------------------------------------
-// Function : endElement
-// Purpose : overload handler function
-//----------------------------------------------------------------------
-bool SALOME_DataTypeCatalog_Handler::endElement(const QString&,
- const QString &,
- const QString& qName)
-{
- // DataType
-
- // tag test_data_type_name
- if((qName.compare(QString(test_data_type_name))==0))
- _a_data_type.Parserdata_name = content;
- // tag test_data_type_interf_read
- if((qName.compare(QString(test_data_type_interf_read))==0))
- _a_data_type.Parserdata_interface_read = content;
- // tag test_data_type_interf_write
- if((qName.compare(QString(test_data_type_interf_write))==0))
- _a_data_type.Parserdata_interface_write = content;
-
- // tag test_data_type_parent_name
- if((qName.compare(QString(test_data_type_parent_name))==0))
- _a_data_parents_list.push_back(content);
-
- // tag test_data_type_parents
- if((qName.compare(QString(test_data_type_parents))==0))
- {
- _a_data_type.Parserdata_parents = _a_data_parents_list;
- _a_data_parents_list.resize(0);;
- }
-
- // tag test_data_type
- if((qName.compare(QString(test_data_type))==0))
- {
- _datatypelist.push_back(_a_data_type);
-
- // Empty temporary structures
- _a_data_type.Parserdata_name = "";
- _a_data_type.Parserdata_interface_read = "";
- _a_data_type.Parserdata_interface_write = "";
- _a_data_type.Parserdata_parents.resize(0);
- }
-
-
-
- return true;
-}
-
-//----------------------------------------------------------------------
-// Function : characters
-// Purpose : overload handler function
-//----------------------------------------------------------------------
-bool SALOME_DataTypeCatalog_Handler::characters(const QString& chars)
-{
- content = (const char*)chars ;
- return true;
-}
-
-//----------------------------------------------------------------------
-// Function : endDocument
-// Purpose : overload handler function
-// Print all informations find in the catalog
-// (only in DEBUG mode!!)
-//----------------------------------------------------------------------
-bool SALOME_DataTypeCatalog_Handler::endDocument()
-{
- //_datatypelist
- for (unsigned int ind = 0; ind < _datatypelist.size(); ind++)
- {
- MESSAGE("DataType Name :"<<_datatypelist[ind].Parserdata_name);
- MESSAGE("DataType interface read :"<<_datatypelist[ind].Parserdata_interface_read);
- MESSAGE("DataType interface write :"<<_datatypelist[ind].Parserdata_interface_write);
-
- for (unsigned int i = 0; i < _datatypelist[ind].Parserdata_parents.size(); i++)
- MESSAGE("Parent name :" << _datatypelist[ind].Parserdata_parents[i]);
- }
-
- MESSAGE("Document parsed");
- return true;
-}
-
-//----------------------------------------------------------------------
-// Function : errorProtocol
-// Purpose : overload handler function
-//----------------------------------------------------------------------
-QString SALOME_DataTypeCatalog_Handler::errorProtocol()
-{
- return errorProt ;
-}
-
-
-//----------------------------------------------------------------------
-// Function : fatalError
-// Purpose : overload handler function
-//----------------------------------------------------------------------
-bool SALOME_DataTypeCatalog_Handler::fatalError(const QXmlParseException& exception)
-{
- errorProt += QString( "fatal parsing error: %1 in line %2, column %3\n" )
- .arg( exception.message() )
- .arg( exception.lineNumber() )
- .arg( exception.columnNumber() );
-
- return QXmlDefaultHandler::fatalError( exception );
-}
+++ /dev/null
-// SALOME DataTypeCatalog : catalog of data types
-//
-// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// 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 library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : SALOME_DataTypeCatalog_Handler.hxx
-// Author : Estelle Deville
-// Module : SALOME
-// $Header$
-
-#ifndef SALOME_DATA_CATALOG_HANDLER_H
-#define SALOME_DATA_CATALOG_HANDLER_H
-
-#include "SALOME_DataTypeCatalog_Parser.hxx"
-#include <qxml.h>
-#include <string>
-#include <vector>
-
-#if defined DATATYPECATALOG_EXPORTS
-#if defined WIN32
-#define DATATYPECATALOG_EXPORT __declspec( dllexport )
-#else
-#define DATATYPECATALOG_EXPORT
-#endif
-#else
-#if defined WNT
-#define DATATYPECATALOG_EXPORT __declspec( dllimport )
-#else
-#define DATATYPECATALOG_EXPORT
-#endif
-#endif
-
-class DATATYPECATALOG_EXPORT SALOME_DataTypeCatalog_Handler : public QXmlDefaultHandler
-{
-public:
- //! standard constructor
- SALOME_DataTypeCatalog_Handler();
-
- //! standard destructor
- virtual ~SALOME_DataTypeCatalog_Handler();
-
-
- //! method to overload handler function startDocument
- /*! Is called before a xml file is parsed
- \return true if no error was detected
- */
- virtual bool startDocument();
-
-
- //! method to overload handler function startElement
- /*!
- \param Qstring argument by value
- \param Qstring argument by value
- \param Qstring argument by value
- \param QXmlAttributes argument by value
- \return true if no error was detected
- */
- virtual bool startElement(const QString&, const QString &,
- const QString& qName, const QXmlAttributes& atts);
-
- //! method to overload handler function endElement
- /*!
- \param Qstring argument by value
- \param Qstring argument by value
- \param Qstring argument by value
- \return true if no error was detected
- \sa _Find
- */
- virtual bool endElement(const QString&, const QString &,
- const QString& qName);
-
-
- //! method to overload handler function characters
- /*!
- \param Qstring argument by value
- \return true if no error was detected
- */
- virtual bool characters(const QString& chars);
-
- //! method to overload handler function endDocument
- /*! Is called at the end of the parsing
- \return true if no error was detected
- */
- virtual bool endDocument();
-
- //! method to overload handler function errorProtocol
- /*!
- \return the error message
- */
- virtual QString errorProtocol();
-
- //! method to overload handler function fatalError
- /*!
- \param QXmlParseExecption argument by value
- \return true if no error was detected
- */
- virtual bool fatalError(const QXmlParseException& exception);
-
-private:
- QString errorProt ;
-
- std::string content;
-
- const char* test_data_type_name ;
- const char* test_data_type_interf_read ;
- const char* test_data_type_interf_write ;
- const char* test_data_type_parent_name ;
- const char* test_data_type_parents ;
- const char* test_data_type;
-
- ParserDataType _a_data_type;
-
- ListOfParserDataTypeName _a_data_parents_list ;
-};
-
-#endif // SALOME_DATA_CATALOG_HANDLER_H
+++ /dev/null
-// SALOME DataTypeCatalog : catalog of data types
-//
-// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// 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 library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : SALOME_DataTypeCatalog_Parser.hxx
-// Author : Estelle Deville
-// Module : SALOME
-// $Header$
-
-#ifndef SALOME_DATA_CATALOG_PARSER_H
-#define SALOME_DATA_CATALOG_PARSER_H
-
-#include <string>
-#include <vector>
-
-// Type Definitions
-typedef std::vector<std::string> ListOfParserDataTypeName;
-
-struct ParserDataType{
- std::string Parserdata_name ;
- std::string Parserdata_interface_read;
- std::string Parserdata_interface_write;
- ListOfParserDataTypeName Parserdata_parents ;
-};
-
-typedef std::vector<ParserDataType> ListOfParserDataType;
-
-// contains all the data types defined in the catalog
-extern ListOfParserDataType _datatypelist;
-
-
-#endif // SALOME_DATA_CATALOG_PARSER_H
+++ /dev/null
-// SALOME DataTypeCatalog : catalog of data types
-//
-// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// 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 library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : SALOME_DataTypeCatalog_Server.cxx
-// Author : Estelle Deville
-// Module : SALOME
-// $Header$
-
-#include <iostream>
-#include "SALOME_NamingService.hxx"
-#include "SALOME_DataTypeCatalog_impl.hxx"
-#include "utilities.h"
-#include "Utils_SINGLETON.hxx"
-using namespace std;
-
-int main(int argc,char **argv)
-{
- // initialize the ORB
- CORBA::ORB_ptr orb = CORBA::ORB_init (argc, argv);
- try
- {
- CosNaming::NamingContext_var _rootContext, catalogContext;
- // initialize POA
- //
- long TIMESleep = 250000000;
- int NumberOfTries = 40;
- int a;
- timespec ts_req;
- ts_req.tv_nsec=TIMESleep;
- ts_req.tv_sec=0;
- timespec ts_rem;
- ts_rem.tv_nsec=0;
- ts_rem.tv_sec=0;
- CosNaming::NamingContext_var inc;
- PortableServer::POA_var poa;
- CORBA::Object_var theObj;
- CORBA::Object_var obj;
- CORBA::Object_var object;
- int DATA_TYPE_CATALOG=0;
- const char * Env = getenv("USE_LOGGER");
- int EnvL =0;
- if ((Env!=NULL) && (strlen(Env)))
- EnvL=1;
- CosNaming::Name name;
- name.length(1);
- name[0].id=CORBA::string_dup("Logger");
- PortableServer::POAManager_var mgr;
-
- for (int i = 1; i<=NumberOfTries; i++)
- {
- if (i!=1)
-#ifndef WNT
- a=nanosleep(&ts_req,&ts_rem);
-#else
- Sleep(TIMESleep/1000000);
-#endif
- try
- {
- obj = orb->resolve_initial_references("RootPOA");
- if(!CORBA::is_nil(obj))
- poa = PortableServer::POA::_narrow(obj);
- if(!CORBA::is_nil(poa))
- mgr = poa->the_POAManager();
- if(!CORBA::is_nil(orb))
- theObj = orb->resolve_initial_references("NameService");
- if (!CORBA::is_nil(theObj))
- inc = CosNaming::NamingContext::_narrow(theObj);}
- catch( CORBA::SystemException& )
- {
- MESSAGE( "Data Type Catalog: CORBA::SystemException: Unable to contact the Naming Service" );
- }
- if(!CORBA::is_nil(inc))
- {
- MESSAGE( "Data Type Catalog: Naming Service was found" );
- if(EnvL==1)
- {
- CORBA::ORB_var orb1 = CORBA::ORB_init(argc,argv) ;
- SALOME_NamingService &NS = *SINGLETON_<SALOME_NamingService>::Instance() ;
- NS.init_orb( orb1 ) ;
- for(int j=1; j<=NumberOfTries; j++)
- {
- if (j!=1)
-#ifndef WNT
- a=nanosleep(&ts_req, &ts_rem);
-#else
- Sleep(TIMESleep/1000000);
-#endif
- try
- {
- object = inc->resolve(name);
- }
- catch(CosNaming::NamingContext::NotFound)
- {
- MESSAGE( "Data Type Catalog: Logger Server wasn't found" );
- }
- catch(...)
- {
- MESSAGE( "Data Type Catalog: Unknown exception" );
- }
- if (!CORBA::is_nil(object))
- {
- MESSAGE( "Data Type Catalog: Logger Server was found" );
- DATA_TYPE_CATALOG=1;
- break;
- }
-
- }
- }
- }
- if ((DATA_TYPE_CATALOG==1)||((EnvL==0)&&(!CORBA::is_nil(inc))))
- break;
- }
-
- // Active catalog
-
- SALOME_DataTypeCatalogImpl* Catalogue_i = new SALOME_DataTypeCatalogImpl(argc, argv);
- poa->activate_object (Catalogue_i);
-
- mgr->activate();
-
-
- CORBA::Object_ptr myCata = Catalogue_i->_this();
-
- // initialise Naming Service
- SALOME_NamingService *_NS;
- _NS = new SALOME_NamingService(orb);
- // register Catalog in Naming Service
- _NS->Register(myCata ,"/Kernel/DataTypeCatalog");
-
- MESSAGE("Running DataType Catalog Server.")
-
- orb->run();
-
- poa->destroy(1,1);
-
- }
- catch(CORBA::SystemException&) {
- INFOS("Caught CORBA::SystemException.")
- }
- catch(CORBA::Exception&) {
- INFOS("Caught CORBA::Exception.")
- }
-
- // delete myThreadTrace;
- return 0;
-}
+++ /dev/null
-// SALOME DataTypeCatalog : catalog of data types
-//
-// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// 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 library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : SALOME_DataTypeCatalog_impl.cxx
-// Author : Estelle Deville
-// Module : SALOME
-// $Header$
-
-#include "SALOME_DataTypeCatalog_impl.hxx"
-#include "Utils_ExceptHandlers.hxx"
-#include <fstream>
-using namespace std;
-
-UNEXPECT_CATCH(DTC_NotFound, SALOME_DataTypeCatalog::NotFound);
-
-//----------------------------------------------------------------------
-// Function : SALOME_DataTypeCatalogImpl
-// Purpose : Constructor
-//----------------------------------------------------------------------
-SALOME_DataTypeCatalogImpl::SALOME_DataTypeCatalogImpl(int argc, char** argv)
-{
- MESSAGE("DataType Catalog creation");
-
- // Empty used variables
- _datatype_list.resize(0);
-
- // Parse the arguments given at server run
- if (!_parseArguments(argc, argv,&_path_datatype))
- MESSAGE( "Error while argument parsing" )
-
- // Test existency of files
- if (_path_datatype == NULL)
- MESSAGE( "Error the data type catalog should be indicated" )
- else
- {
- MESSAGE("Parse data type catalog");
- // Affect the variable _datatype_list
- _parse_xml_file(_path_datatype,_datatype_list);
-
- // Verification of _datatype_list content
- if(!_verify_data_type(_datatype_list))
- MESSAGE( "Error while parsing the data type list" )
- else MESSAGE("Data Type list OK");
- }
-}
-
-//----------------------------------------------------------------------
-// Function : ~SALOME_DataTypeCatalogImpl
-// Purpose : Destructor
-//----------------------------------------------------------------------
-SALOME_DataTypeCatalogImpl::~SALOME_DataTypeCatalogImpl()
-{
- MESSAGE("DataType Catalog Destruction");
-}
-
-
-//----------------------------------------------------------------------
-// Function : GetDataTypeList
-// Purpose : get a data type name list
-//----------------------------------------------------------------------
-SALOME_DataTypeCatalog::ListOfDataTypeName*
-SALOME_DataTypeCatalogImpl::GetDataTypeList()
-{
- MESSAGE("Begin of GetDataTypeList");
- SALOME_DataTypeCatalog::ListOfDataTypeName_var _list_data =
- new SALOME_DataTypeCatalog::ListOfDataTypeName;
-
- _list_data->length(_datatype_list.size());
-
- // Duplicate each data type name defined in the catalog
- for (unsigned int ind=0; ind < _datatype_list.size();ind++)
- {
- _list_data[ind]=CORBA::string_dup(_datatype_list[ind].Parserdata_name.c_str());
- // SCRUTE(_list_data[ind]) ;
- }
-
- return _list_data._retn();
-}
-
-//----------------------------------------------------------------------
-// Function : isDerivedFrom
-// Purpose : return true if type_out is derived from type_in
-//----------------------------------------------------------------------
-CORBA::Boolean
-SALOME_DataTypeCatalogImpl::isDerivedFrom(const char* type_in,
- const char* type_out)
- throw(SALOME_DataTypeCatalog::NotFound)
-{
- Unexpect aCatch(DTC_NotFound);
- CORBA::Boolean _return_value = false ;
- bool _found_in = false;
- bool _found_out = false;
- for (unsigned int ind=0; ind < _datatype_list.size();ind++)
- {
- if (strcmp((_datatype_list[ind].Parserdata_name).c_str(),type_out) == 0)
- {
- //type_out found
- _found_out = true;
- // Looking if type_in is indicated in the parents list
- _return_value = _explore_parents(type_in,_datatype_list[ind]);
- }
- if (strcmp((_datatype_list[ind].Parserdata_name).c_str(),type_in) == 0)
- _found_in = true;
- }
-
- if(!_found_in)
- {
- MESSAGE("The data type " << type_in << " was not found in the data type catalog")
- throw SALOME_DataTypeCatalog::NotFound() ;
- }
- if(!_found_out)
- {
- MESSAGE( "The data type " << type_out << " was not found in the data type catalog")
- throw SALOME_DataTypeCatalog::NotFound() ;
- }
-
- return _return_value;
-
-}
-
-//----------------------------------------------------------------------
-// Function : GetDataInterfaceRead
-// Purpose : get the read interface name
-//----------------------------------------------------------------------
-char*
-SALOME_DataTypeCatalogImpl::GetDataInterfaceRead(const char* type)
- throw(SALOME_DataTypeCatalog::NotFound)
-{
- Unexpect aCatch(DTC_NotFound);
- char* return_value = NULL;
- bool _find = false;
- for (unsigned int ind=0; ind < _datatype_list.size();ind++)
- {
- if (strcmp((_datatype_list[ind].Parserdata_name).c_str(),type) == 0)
- {
- _find = true;
- return_value = CORBA::string_dup(_datatype_list[ind].Parserdata_interface_read.c_str());
- }
- }
-
- // NotFound Exceptin is thrown if the data type indicated is not found in the catalog
- if(!_find)
- {
- MESSAGE( "The data type " << type << " was not found in the data type catalog")
- throw SALOME_DataTypeCatalog::NotFound() ;
- }
-
- return return_value;
-}
-
-//----------------------------------------------------------------------
-// Function : GetDataInterfaceWrite
-// Purpose : get the write interface name
-//----------------------------------------------------------------------
-char*
-SALOME_DataTypeCatalogImpl::GetDataInterfaceWrite(const char* type)
- throw(SALOME_DataTypeCatalog::NotFound)
-{
- Unexpect aCatch(DTC_NotFound);
- char* return_value = NULL;
- bool _find = false;
- for (unsigned int ind=0; ind < _datatype_list.size();ind++)
- {
- if (strcmp((_datatype_list[ind].Parserdata_name).c_str(),type) == 0)
- {
- _find = true;
- return_value = CORBA::string_dup(_datatype_list[ind].Parserdata_interface_write.c_str());
- }
- }
-
- // NotFound Exceptin is thrown if the data type indicated is not found in the catalog
- if(!_find)
- {
- MESSAGE( "The data type " << type << " was not found in the data type catalog")
- throw SALOME_DataTypeCatalog::NotFound() ;
- }
- return return_value;
-}
-
-//----------------------------------------------------------------------
-// Function : GetDataTypeParents
-// Purpose : get Parents data type name list
-//----------------------------------------------------------------------
-SALOME_DataTypeCatalog::ListOfDataTypeName*
-SALOME_DataTypeCatalogImpl::GetDataTypeParents(const char* type) throw(SALOME_DataTypeCatalog::NotFound)
-{
- Unexpect aCatch(DTC_NotFound);
-
- bool _find = false ;
-
- SALOME_DataTypeCatalog::ListOfDataTypeName_var _list_data =
- new SALOME_DataTypeCatalog::ListOfDataTypeName;
-
- for (unsigned int ind=0; ind < _datatype_list.size();ind++)
- {
- if (strcmp((_datatype_list[ind].Parserdata_name).c_str(),type) == 0)
- {
- // Wanted type is found
- // Get all the parents data type name of the type
- _find = true;
- _list_data->length(_datatype_list[ind].Parserdata_parents.size());
- for (unsigned int ind1=0; ind1 < _datatype_list[ind].Parserdata_parents.size();ind1++)
- {
- _list_data[ind1]=CORBA::string_dup(_datatype_list[ind].Parserdata_parents[ind1].c_str());
- // SCRUTE(_list_data[ind1]) ;
- }
- }
- }
-
- // NotFound Exception is thrown if the data type indicated is not found
- // in the catalog
- if(!_find)
- {
- MESSAGE( "The data type " << type << " was not found in the data type catalog")
- throw SALOME_DataTypeCatalog::NotFound() ;
- }
-
- return _list_data._retn();
-}
-
-//----------------------------------------------------------------------
-// Function : _explore_parents
-// Purpose : return true if type_out is derived from type_in
-//----------------------------------------------------------------------
-CORBA::Boolean
-SALOME_DataTypeCatalogImpl::_explore_parents(const char* type_in,
- ParserDataType& data_out)
-{
-
- MESSAGE( "Begin of _explore_parents with data_out_name " << data_out.Parserdata_name);
-
- CORBA::Boolean found = false ;
- if (data_out.Parserdata_name == type_in)
- found = true ;
- else
- if (data_out.Parserdata_parents.size() >0)
- for (unsigned int ind=0; ind < data_out.Parserdata_parents.size();ind++)
- {
- if (data_out.Parserdata_parents[ind] == type_in)
- found = true ;
- else
- for (unsigned ip =0; ip < _datatype_list.size();ip++)
- {
- // run _explore_parents for each parent data of data_out
- if (_datatype_list[ip].Parserdata_name == data_out.Parserdata_parents[ind])
- found = _explore_parents(type_in, _datatype_list[ip]);
- }
- }
- return found ;
-}
-
-//----------------------------------------------------------------------
-// Function : _parse_xml_file
-// Purpose : parse one module catalog
-//----------------------------------------------------------------------
-void
-SALOME_DataTypeCatalogImpl::_parse_xml_file(const char* file,
- ListOfParserDataType& datatypelist)
-{
- SALOME_DataTypeCatalog_Handler* handler = new SALOME_DataTypeCatalog_Handler();
- QFile xmlFile(file);
-
- QXmlInputSource source(xmlFile);
-
- QXmlSimpleReader reader;
- reader.setContentHandler( handler );
- reader.setErrorHandler( handler );
- reader.parse( source );
- xmlFile.close();
- datatypelist = _datatypelist;
-}
-
-
-//----------------------------------------------------------------------
-// Function : _verify_data_type
-// Purpose : verify the data type structures from the catalog parsing
-// Verify that the parents type associated to a type are defined
-// in the catalog
-//----------------------------------------------------------------------
-bool
-SALOME_DataTypeCatalogImpl::_verify_data_type(ListOfParserDataType datatypelist)
-{
- bool _return_value = true;
- bool _bool = false ;
- vector<string> _data_name_list;
-
- _data_name_list.resize(0);;
- for (unsigned int ind = 0; ind < _datatype_list.size(); ind++)
- _data_name_list.push_back(_datatype_list[ind].Parserdata_name) ;
-
- // Parse if parents data type name of a data type are defined in the
- // datatype catalog
-#ifndef WNT
- for (unsigned int ind = 0; ind < _datatype_list.size(); ind++)
-#else
- for (ind = 0; ind < _datatype_list.size(); ind++)
-#endif
- {
- // Scrute data type parents
- // MESSAGE("Treatment of " << _datatype_list[ind].Parserdata_name);
- for (unsigned int ind1 = 0 ; ind1 < _datatype_list[ind].Parserdata_parents.size(); ind1++)
- {
- // MESSAGE("Looking for " << _datatype_list[ind].Parserdata_parents[ind1] << " in the catalog data type");
- _bool = false;
- // Compare parent data type name to all data type names defined in the catalog
- for (unsigned int ind2 = 0 ; ind2 < _data_name_list.size(); ind2++)
- {
- if(_datatype_list[ind].Parserdata_parents[ind1].compare(_data_name_list[ind2]) == 0)
- {
- // Type found : OK
- MESSAGE("The parents data type " << _datatype_list[ind].Parserdata_parents[ind1] << " of " << _datatype_list[ind].Parserdata_name << " was found in the catalog type");
- _bool = true;
- }
- }
- if(!_bool)
- {
- MESSAGE( "The parents data type " << _datatype_list[ind].Parserdata_parents[ind1] << " of " << _datatype_list[ind].Parserdata_name << " is not defined in the data type catalog" )
- _return_value = false ;
- }
- }
- }
- return _return_value;
-}
-
-
-//----------------------------------------------------------------------
-// Function : _parseArguments
-// Purpose : parse arguments to get general and personal catalog files
-//----------------------------------------------------------------------
-bool
-SALOME_DataTypeCatalogImpl::_parseArguments(int argc, char **argv,
- char **_path_data)
-{
- bool _return_value = true;
- *_path_data = NULL;
- for (int ind = 0; ind < argc ; ind++)
- {
-
- if (strcmp(argv[ind],"-help") == 0)
- {
- MESSAGE( "Usage: " << argv[0] << " -common 'path to data type catalog' -ORBInitRef NameService=corbaname::localhost");
- _return_value = false ;
- }
- if (strcmp(argv[ind],"-common") == 0)
- {
- if (ind + 1 <= argc)
- {
- // General catalog file
- *_path_data = argv[ind + 1] ;
- ifstream _path_data_file(*_path_data);
- if (!_path_data_file)
- {
- MESSAGE( "Sorry the file " << *_path_data << " can't be open" )
- *_path_data = NULL;
- _return_value = false;
- }
- }
- }
-
- }
- return _return_value;
-}
+++ /dev/null
-// SALOME DataTypeCatalog : catalog of data types
-//
-// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// 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 library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : SALOME_DataTypeCatalog_impl.hxx
-// Author : Estelle Deville
-// Module : SALOME
-// $Header$
-
-#ifndef DATATYPECATALOG_IMPL_H
-#define DATATYPECATALOG_IMPL_H
-
-#include "utilities.h"
-#include "SALOME_DataTypeCatalog_Handler.hxx"
-#include <SALOMEconfig.h>
-#include CORBA_SERVER_HEADER(SALOME_DataTypeCatalog)
-
-#if defined DATATYPECATALOG_EXPORTS
-#if defined WIN32
-#define DATATYPECATALOG_EXPORT __declspec( dllexport )
-#else
-#define DATATYPECATALOG_EXPORT
-#endif
-#else
-#if defined WNT
-#define DATATYPECATALOG_EXPORT __declspec( dllimport )
-#else
-#define DATATYPECATALOG_EXPORT
-#endif
-#endif
-
-class DATATYPECATALOG_EXPORT SALOME_DataTypeCatalogImpl: public POA_SALOME_DataTypeCatalog::DataCatalog,
- public PortableServer::RefCountServantBase
-{
-public:
- //! standard constructor
- SALOME_DataTypeCatalogImpl(int argc, char** argv);
-
- //! standard destructor
- virtual ~SALOME_DataTypeCatalogImpl();
-
- //! method to get a data type list
- /*!
- \return a data type list
- */
- virtual SALOME_DataTypeCatalog::ListOfDataTypeName* GetDataTypeList();
-
- //! method to know if type_out is derived from type_in
- /*!
- \param type_in const char* arguments
- \param type_out const char* arguments
- \return a boolean (true if type_out is derived from type_in)
- */
- virtual CORBA::Boolean isDerivedFrom(const char* type_in, const char* type_out) throw(SALOME_DataTypeCatalog::NotFound);
-
- //! method to get the name of the interface to acces the data in read mode
- /*!
- \param type const char* arguments
- \return the read interface name
- */
- virtual char* GetDataInterfaceRead(const char* type) throw(SALOME_DataTypeCatalog::NotFound);
-
-
- //! method to get the name of the interface to acces the data in write mode
- /*!
- \param type const char* arguments
- \return the write interface name
- */
- virtual char* GetDataInterfaceWrite(const char* type) throw(SALOME_DataTypeCatalog::NotFound);
-
- //! method to get parents data type list
- /*!
- \param type const char* arguments
- \return a data type list
- */
- virtual SALOME_DataTypeCatalog::ListOfDataTypeName*
- GetDataTypeParents(const char* type) throw(SALOME_DataTypeCatalog::NotFound);
-
-
-private:
- //! method to know if parents type of data_out derived from type_in
- /*!
- \param type_in const char* arguments
- \param data_out const ParserDataType arguments (by value)
- \return a boolean (true if type_out is derived from type_in)
- */
- virtual CORBA::Boolean _explore_parents(const char* type_in,
- ParserDataType& data_out);
-
-
- //! method to parse the data type catalog
- /*!
- \param file const char* arguments
- \param datatypelist ListOfParserDataType arguments
- */
- virtual void _parse_xml_file(const char* file,
- ListOfParserDataType& datatypelist);
-
-
- //! method to verify data type content
- /*!
- \param datatypelist ListOfParserDataType arguments
- \return true if verfication is OK
- */
- virtual bool _verify_data_type(ListOfParserDataType datatypelist);
-
-
- //! method to parse arguments to get general and personal catalog files
- /*!
- \param argc int arguments
- \param argv char** arguments
- \param _path_data char** arguments
- \return true if parsing is OK
- */
- virtual bool _parseArguments(int argc, char **argv, char **_path_data);
-
-
- // will contain the path to the data type catalog
- char* _path_datatype;
-
-
- //will contain the informations on the data type catalog(after parsing)
- ListOfParserDataType _datatype_list ;
-};
-
-#endif // DATATYPECATALOG_IMPL_H
+++ /dev/null
-# SALOME RessourcesCatalog : implementation of catalog resources parsing (SALOME_ModuleCatalog.idl)
-#
-# Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License.
-#
-# 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 library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#
-# See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-#
-#
-#
-# File : Makefile.am
-# Author : Guillaume Boulant (CSSI)
-# Module : SALOME
-# $Header$
-
-
-include $(top_srcdir)/salome_adm/unix/make_common_starter.am
-
-#
-# ===============================================================
-# Header to be installed
-# ===============================================================
-#
-# header files
-salomeinclude_HEADERS = \
- SALOME_RessourcesCatalog_impl.hxx \
- SALOME_RessourcesCatalog_Parser.hxx \
- SALOME_RessourcesCatalog_Handler.hxx
-
-
-#
-# ===============================================================
-# Local definitions
-# ===============================================================
-#
-
-# This local variable defines the list of CPPFLAGS common to all target in this package.
-COMMON_CPPFLAGS=\
- -I$(srcdir)/../Basics \
- -I$(srcdir)/../SALOMELocalTrace \
- -I$(srcdir)/../NamingService \
- -I$(srcdir)/../Utils \
- -I$(top_builddir)/salome_adm/unix \
- -I$(top_builddir)/idl \
- @CORBA_CXXFLAGS@ @CORBA_INCLUDES@
-
-# This local variable defines the list of dependant libraries common to all target in this package.
-COMMON_LIBS =\
- ../NamingService/libSalomeNS.la \
- ../Utils/libOpUtil.la \
- ../SALOMELocalTrace/libSALOMELocalTrace.la \
- ../Basics/libSALOMEBasics.la \
- $(top_builddir)/idl/libSalomeIDLKernel.la
-
-#
-# ===============================================================
-# Libraries targets
-# ===============================================================
-#
-
-lib_LTLIBRARIES = libSalomeRessourcesCatalog.la
-libSalomeRessourcesCatalog_la_SOURCES=\
- SALOME_RessourcesCatalog_Handler.cxx \
- SALOME_RessourcesCatalog_impl.cxx
-
-libSalomeRessourcesCatalog_la_CPPFLAGS =\
- $(COMMON_CPPFLAGS) \
- @QT_MT_INCLUDES@
-
-libSalomeRessourcesCatalog_la_LDFLAGS = -no-undefined -version-info=0:0:0
-libSalomeRessourcesCatalog_la_LIBADD =\
- $(COMMON_LIBS) \
- @QT_MT_LIBS@
-
-#
-# ===============================================================
-# Executables targets
-# ===============================================================
-#
-bin_PROGRAMS = SALOME_RessourcesCatalog_Server SALOME_RessourcesCatalog_Client
-
-#SALOME_RessourcesCatalog_Server
-SALOME_RessourcesCatalog_Server_SOURCES = SALOME_RessourcesCatalog_Server.cxx
-SALOME_RessourcesCatalog_Server_CPPFLAGS =\
- $(COMMON_CPPFLAGS) \
- @QT_MT_INCLUDES@
-
-SALOME_RessourcesCatalog_Server_LDADD =\
- libSalomeRessourcesCatalog.la \
- $(COMMON_LIBS) \
- @CORBA_LIBS@
-
-#SALOME_RessourcesCatalog_Client
-SALOME_RessourcesCatalog_Client_SOURCES = SALOME_RessourcesCatalog_Client.cxx
-SALOME_RessourcesCatalog_Client_CPPFLAGS =\
- $(COMMON_CPPFLAGS) \
- @QT_MT_INCLUDES@
-
-SALOME_RessourcesCatalog_Client_LDADD =\
- libSalomeRessourcesCatalog.la \
- $(COMMON_LIBS) \
- @CORBA_LIBS@
-
+++ /dev/null
-// SALOME RessourcesCatalog : implementation of catalog resources parsing (SALOME_ModuleCatalog.idl)
-//
-// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// 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 library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : SALOME_RessourcesCatalog_Client.cxx
-// Module : SALOME
-
-/* $Header$ */
-
-#include <iostream>
-#include "SALOME_NamingService.hxx"
-#include <SALOMEconfig.h>
-#ifndef WNT
-#include CORBA_SERVER_HEADER(SALOME_RessourcesCatalog)
-#else
-#include <SALOME_RessourcesCatalog.hh>
-#endif
-#include <string>
-#include "utilities.h"
-using namespace std;
-
-int main(int argc,char **argv)
-{
- CORBA::ORB_var orb;
- CosNaming::NamingContext_var _rootContext;
- CORBA::Object_var objVar, objVarN;
- try {
-
- // initialize the ORB
-
- orb = CORBA::ORB_init (argc, argv);
-
-
- // Get CORBA reference of the catalog
- SALOME_NamingService NS(orb);
- CORBA::Object_var objVarN = NS.Resolve("/Kernel/RessourcesCatalog");
-
- SALOME_RessourcesCatalog::RessourcesCatalog_var Catalogue = SALOME_RessourcesCatalog::RessourcesCatalog::_narrow(objVarN);
- MESSAGE("Ressources distant catalog found");
-
- //Get Computer list information
- SALOME_RessourcesCatalog::ListOfComputer_var _list = Catalogue->GetComputerList();
- for (unsigned int ind = 0; ind < _list->length();ind++)
- {
- MESSAGE("Ressources list : " << _list[ind]);
- }
-
- //Get container type list of computer eri
- SALOME_RessourcesCatalog::ListOfContainerType_var list = Catalogue->GetContainerTypeList("eri");
-#ifndef WNT
- for (unsigned int ind = 0; ind < list->length();ind++)
-#else
- for (ind = 0; ind < list->length();ind++)
-#endif
- {
- MESSAGE("Container type list of eri : " << list[ind]);
- }
-
- // Get processors information of eri
- SALOME_RessourcesCatalog::computer_info_var computer = Catalogue->GetComputerInfo("eri");
- MESSAGE("Ressource name : " << computer->name);
- MESSAGE("Ressource OS : " << computer->OS);
- MESSAGE("Ressource OS version : " << computer->OS_version);
-#ifndef WNT
- for (unsigned int ind = 0; ind < computer->procs.length();ind++)
-#else
- for (ind = 0; ind < computer->procs.length();ind++)
-#endif
- {
- MESSAGE("Processor number : " << computer->procs[ind].number);
- MESSAGE("Processor model name : " << computer->procs[ind].model_name);
- MESSAGE("Processor cpu : " << computer->procs[ind].cpu_mhz);
- MESSAGE("Processor cache : " << computer->procs[ind].cache_size);
- }
-
- }
- catch(SALOME_RessourcesCatalog::NotFound &){
- INFOS("SALOME_RessourcesCatalog::NotFound");
- }
- catch(CORBA::SystemException&) {
- INFOS("Caught CORBA::SystemException.")
- }
- catch (CosNaming::NamingContext::CannotProceed &) {
- INFOS("CosNaming::NamingContext::CannotProceed")
- }
- catch (CosNaming::NamingContext::NotFound &) {
- INFOS("CosNaming::NamingContext::NotFound")
- }
- catch (CosNaming::NamingContext::InvalidName &) {
- INFOS("CosNaming::NamingContext::InvalidName")
- }
- catch (CosNaming::NamingContext::AlreadyBound &) {
- INFOS("CosNaming::NamingContext::AlreadyBound")
- }
- catch (CosNaming::NamingContext::NotEmpty &) {
- INFOS("CosNaming::NamingContext::NotEmpty")
- }
-
- catch(CORBA::Exception &sysEx) {
- INFOS("Caught CORBA::Exception.")
- }
-
-
- return 0;
-}
+++ /dev/null
-// SALOME RessourcesCatalog : implementation of catalog resources parsing (SALOME_ModuleCatalog.idl)
-//
-// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// 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 library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : SALOME_RessourcesCatalog_Handler.cxx
-// Author : Estelle Deville
-// Module : SALOME
-//$Header$
-
-#include "SALOME_RessourcesCatalog_Handler.hxx"
-
-#include "utilities.h"
-
-using namespace std;
-
-ListOfParserressources _ressources_list;
-
-//----------------------------------------------------------------------
-//Function : SALOME_RessourcesCatalog_Handler
-//Purpose: Constructor
-//----------------------------------------------------------------------
-SALOME_RessourcesCatalog_Handler::SALOME_RessourcesCatalog_Handler()
-{
- MESSAGE("SALOME_RessourcesCatalog_Handler creation");
- //XML tags initialisation
- test_computer = "computer";
- test_computer_name="name";
- test_computer_OS="OS";
- test_computer_OS_version = "OS-version";
- test_proc = "proc";
- test_proc_number ="number" ;
- test_proc_model= "model" ;
- test_proc_cpu= "CPU-MHz" ;
- test_proc_cache = "cache" ;
- test_proc_list = "proc-list" ;
- test_container_type = "containertype" ;
- test_container_type_list = "containertype-list" ;
-}
-
-//----------------------------------------------------------------------
-//Function : ~SALOME_RessourcesCatalog_Handler
-//Purpose: Destructor
-//----------------------------------------------------------------------
-SALOME_RessourcesCatalog_Handler::~SALOME_RessourcesCatalog_Handler()
-{
- MESSAGE("SALOME_RessourcesCatalog_Handler destruction");
-}
-
-//----------------------------------------------------------------------
-//Function : startDocument
-//Purpose: overload handler function
-//----------------------------------------------------------------------
-bool
-SALOME_RessourcesCatalog_Handler::startDocument()
-{
- MESSAGE("Begin parse document");
- // Empty private elements
- _procs_list.resize(0);
- _ressources_list.resize(0);
- _container_list.resize(0);
- return true;
-}
-
-//----------------------------------------------------------------------
-//Function : startElement
-//Purpose: overload handler function
-//----------------------------------------------------------------------
-bool
-SALOME_RessourcesCatalog_Handler::startElement(const QString&,
- const QString&,
- const QString& qName,
- const QXmlAttributes& atts)
-{
- return true;
-}
-
-//----------------------------------------------------------------------
-//Function : endElement
-//Purpose: overload handler function
-//----------------------------------------------------------------------
-bool
-SALOME_RessourcesCatalog_Handler::endElement(const QString&, const QString&,
- const QString& qName)
-{
- // Ressources
-
- // tag test_computer_name
- if((qName.compare(QString(test_computer_name))==0))
- _a_ressource.Parsername = content;
-
- // tag test_computer_OS
- if((qName.compare(QString(test_computer_OS))==0))
- _a_ressource.ParserOS = content;
-
- // tag test_computer_OS_version
- if((qName.compare(QString(test_computer_OS_version))==0))
- _a_ressource.ParserOS_version = content;
-
- //tag test_proc_number
- if((qName.compare(QString(test_proc_number))==0))
- _a_proc.Parsernumber = atol(content.c_str());
-
- //tag test_proc_model
- if((qName.compare(QString(test_proc_model))==0))
- _a_proc.Parsermodel_name = content;
-
- //tag test_proc_cpu
- if((qName.compare(QString(test_proc_cpu))==0))
- _a_proc.Parsercpu_mhz = atof(content.c_str());
-
- //tag test_proc_cache
- if((qName.compare(QString(test_proc_cache))==0))
- _a_proc.Parsercache_size = atof(content.c_str());
-
- //tag test_proc
- if((qName.compare(QString(test_proc))==0))
- {
- _procs_list.push_back(_a_proc);
-
- // Empty temporary structures
- _a_proc.Parsernumber = 0;
- _a_proc.Parsermodel_name = "";
- _a_proc.Parsercpu_mhz = 0;
- _a_proc.Parsercache_size = 0;
- }
-
- //tag test_proc_list
- if((qName.compare(QString(test_proc_list))==0))
- {
- _a_ressource.Parserprocs = _procs_list;
-
- // Empty temporary structures
- _procs_list.resize(0);
- }
-
- //tag test_container_type
- if((qName.compare(QString(test_container_type))==0))
- {
- // We just have to compare the first character of content
- // If C => Cpp
- // If p => python
- // If N => NP
- switch(content[0]) {
- case 'C':
- _container_list.push_back(Cpp) ;
- break;
- case 'p':
- _container_list.push_back(python) ;
- break;
- case 'N':
- _container_list.push_back(NP) ;
- break;
-
- default:
- // If it'not in all theses cases, the type is affected to Cpp
- _container_list.push_back(Cpp) ;
- break;
- }
- }
-
- //tag test container_type_list
- if((qName.compare(QString(test_container_type_list))==0))
- {
- _a_ressource.Parsercontainertype = _container_list;
-
- // Empty temporary structures
- _container_list.resize(0);
- }
-
- // tag test_computer
- if((qName.compare(QString(test_computer))==0))
- {
- _ressources_list.push_back(_a_ressource);
-
- // Empty temporary structures
- _a_ressource.Parsername = "";
- _a_ressource.ParserOS="";
- _a_ressource.ParserOS_version="";
- _a_ressource.Parserprocs.resize(0);
- _a_ressource.Parsercontainertype.resize(0);
- }
-
- return true;
-}
-
-//----------------------------------------------------------------------
-//Function : characters
-//Purpose: overload handler function
-//----------------------------------------------------------------------
-bool SALOME_RessourcesCatalog_Handler::characters(const QString& chars)
-{
- content = (const char *)chars ;
- return true;
-}
-
-//----------------------------------------------------------------------
-//Function : endDocument
-//Purpose: overload handler function
-//----------------------------------------------------------------------
-bool SALOME_RessourcesCatalog_Handler::endDocument()
-{
- //_ressources_list
- for (unsigned int ind = 0; ind < _ressources_list.size(); ind++)
- {
- MESSAGE("Ressources name :"<<_ressources_list[ind].Parsername);
- MESSAGE("OS :"<<_ressources_list[ind].ParserOS);
- MESSAGE("OS version :"<<_ressources_list[ind].ParserOS_version);
- for (unsigned int i = 0; i < _ressources_list[ind].Parserprocs.size(); i++)
- {
- MESSAGE("Proc number :" << _ressources_list[ind].Parserprocs[i].Parsernumber);
- MESSAGE("Model name :" << _ressources_list[ind].Parserprocs[i].Parsermodel_name);
- MESSAGE("CPU(MHz) :" << _ressources_list[ind].Parserprocs[i].Parsercpu_mhz);
- MESSAGE("Cache :" << _ressources_list[ind].Parserprocs[i].Parsercache_size);
- }
- for (unsigned int j = 0; j < _ressources_list[ind].Parsercontainertype.size(); j++)
- MESSAGE("Container Type :" << _ressources_list[ind].Parsercontainertype[j]);
- }
-
- return true;
-}
-
-//----------------------------------------------------------------------
-//Function : errorProtocol
-//Purpose: overload handler function
-//----------------------------------------------------------------------
-QString SALOME_RessourcesCatalog_Handler::errorProtocol()
-{
- return errorProt;
-}
-
-//----------------------------------------------------------------------
-//Function : fatalError
-//Purpose: overload handler function
-//----------------------------------------------------------------------
-bool
-SALOME_RessourcesCatalog_Handler::fatalError(const QXmlParseException& exception)
-{
- errorProt += QString( "fatal parsing error: %1 in line %2, column %3\n" )
- .arg( exception.message() )
- .arg( exception.lineNumber() )
- .arg( exception.columnNumber() );
-
- return QXmlDefaultHandler::fatalError( exception );
-}
-
+++ /dev/null
-// SALOME RessourcesCatalog : implementation of catalog resources parsing (SALOME_ModuleCatalog.idl)
-//
-// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// 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 library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : SALOME_RessourcesCatalog_Handler.hxx
-// Author : Estelle Deville
-// Module : SALOME
-//$Header$
-
-#ifndef SALOME_RESSOURCES_CATALOG_HANDLER
-#define SALOME_RESSOURCES_CATALOG_HANDLER
-
-#include "SALOME_RessourcesCatalog_Parser.hxx"
-
-#include <qxml.h>
-#include <string>
-#include <vector>
-
-#if defined RESSOURCESCatalog_EXPORTS
-#if defined WIN32
-#define RESSOURCESCatalog_EXPORT __declspec( dllexport )
-#else
-#define RESSOURCESCatalog_EXPORT
-#endif
-#else
-#if defined WNT
-#define RESSOURCESCatalog_EXPORT __declspec( dllimport )
-#else
-#define RESSOURCESCatalog_EXPORT
-#endif
-#endif
-
-class RESSOURCESCatalog_EXPORT SALOME_RessourcesCatalog_Handler : public QXmlDefaultHandler
-{
-public :
- //! standard constructor
- SALOME_RessourcesCatalog_Handler();
-
- //! standard destructor
- virtual ~SALOME_RessourcesCatalog_Handler();
-
- //! method to overload handler function startDocument
- /*! is called before a xml file is parsed
- \return true if no error was detected
- */
- virtual bool startDocument();
-
- //! method to overload handler function startElement
- /*!
- \param QString argument by value
- \param QString argument by value
- \param QString qName argument by value
- \param QXmlAttributes atts argument by value
- \return true if no error was detected
- */
- virtual bool startElement(const QString& , const QString& ,
- const QString& qName, const QXmlAttributes& atts);
-
- //! method to overload handler function endElement
- /*!
- \param QString argument by value
- \param QString argument by value
- \param QString qName argument by value
- \return true if no error was detected
- */
- virtual bool endElement(const QString&, const QString&,
- const QString& qName);
-
- //! method to overload handler function characters
- /*!
- \param QString chars argument by value
- \return true if no error was detected
- */
- virtual bool characters(const QString& chars);
-
- //! method to overload handler function endDocument
- /*! is called at the end of the parsing
- \return true if no error was detected
- */
- virtual bool endDocument();
-
- //! method to overload handler function errorProtocol
- /*!
- \return the error message
- */
- virtual QString errorProtocol();
-
-//! method to overload handler function fatalError
- /*!
- \param QXmlParseException exception argument by value
- \return true if no error was detected
- */
- virtual bool fatalError(const QXmlParseException& exception);
-
-
-private :
- QString errorProt;
-
- std::string content;
-
- const char* test_computer;
- const char* test_computer_name;
- const char* test_computer_OS;
- const char* test_computer_OS_version;
- const char* test_proc;
- const char* test_proc_number;
- const char* test_proc_model;
- const char* test_proc_cpu;
- const char* test_proc_cache;
- const char* test_proc_list;
- const char* test_container_type;
- const char* test_container_type_list;
-
- Parserressources _a_ressource;
-
- ListOfParserProc _procs_list;
- ParserProc _a_proc;
- ListOfParserContainerType _container_list;
-
-};
-
-#endif // SALOME_RESSOURCES_CATALOG_HANDLER
+++ /dev/null
-// SALOME RessourcesCatalog : implementation of catalog resources parsing (SALOME_ModuleCatalog.idl)
-//
-// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// 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 library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : SALOME_RessourcesCatalog_Parser.hxx
-// Author : Estelle Deville
-// Module : SALOME
-//$Header$
-
-#ifndef SALOME_RESSOURCES_CATALOG_PARSER
-#define SALOME_RESSOURCES_CATALOG_PARSER
-
-#include <string>
-#include <vector>
-
-struct ParserProc{
- long Parsernumber;
- std::string Parsermodel_name;
- float Parsercpu_mhz;
- float Parsercache_size;
-};
-
-typedef std::vector<ParserProc> ListOfParserProc;
-
-enum Parsercontainertype {Cpp, python, NP};
-typedef std::vector<Parsercontainertype> ListOfParserContainerType;
-
-struct Parserressources{
- std::string Parsername;
- std::string ParserOS;
- std::string ParserOS_version;
- ListOfParserProc Parserprocs;
- ListOfParserContainerType Parsercontainertype;
-};
-
-typedef std::vector<Parserressources> ListOfParserressources;
-
-extern ListOfParserressources _ressources_list;
-
-
-#endif //SALOME_RESSOURCES_CATALOG_PARSER
+++ /dev/null
-// SALOME RessourcesCatalog : implementation of catalog resources parsing (SALOME_ModuleCatalog.idl)
-//
-// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// 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 library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : SALOME_RessourcesCatalog_Server.cxx
-// Author : Estelle Deville
-// Module : SALOME
-// $Header$
-
-#include <iostream>
-#include "SALOME_NamingService.hxx"
-#include "SALOME_RessourcesCatalog_impl.hxx"
-#include "utilities.h"
-#include "Utils_SINGLETON.hxx"
-using namespace std;
-
-int main(int argc,char **argv)
-{
- // initialize the ORB
- CORBA::ORB_ptr orb = CORBA::ORB_init (argc, argv);
- try
- {
- CosNaming::NamingContext_var _rootContext, catalogContext;
-
- // initialize POA
- //
- long TIMESleep = 250000000;
- int NumberOfTries = 40;
- int a;
- timespec ts_req;
- ts_req.tv_nsec=TIMESleep;
- ts_req.tv_sec=0;
- timespec ts_rem;
- ts_rem.tv_nsec=0;
- ts_rem.tv_sec=0;
- CosNaming::NamingContext_var inc;
- PortableServer::POA_var poa;
- CORBA::Object_var theObj;
- CORBA::Object_var obj;
- CORBA::Object_var object;
- SALOME_NamingService &naming = *SINGLETON_<SALOME_NamingService>::Instance() ;
- int RESSOURCES_CATALOG=0;
- const char * Env = getenv("USE_LOGGER");
- int EnvL =0;
- if ((Env!=NULL) && (strlen(Env)))
- EnvL=1;
- CosNaming::Name name;
- name.length(1);
- name[0].id=CORBA::string_dup("Logger");
- PortableServer::POAManager_var mgr;
- for (int i = 1; i<=NumberOfTries; i++)
- {
- if (i!=1)
-#ifndef WNT
- a=nanosleep(&ts_req,&ts_rem);
-#else
- Sleep(TIMESleep/1000000);
-#endif
- try
- {
- obj = orb->resolve_initial_references("RootPOA");
- if(!CORBA::is_nil(obj))
- poa = PortableServer::POA::_narrow(obj);
- if(!CORBA::is_nil(poa))
- mgr = poa->the_POAManager();
- if(!CORBA::is_nil(orb))
- theObj = orb->resolve_initial_references("NameService");
- if (!CORBA::is_nil(theObj))
- inc = CosNaming::NamingContext::_narrow(theObj);
- }
- catch( CORBA::SystemException& )
- {
- INFOS( "Ressources Catalog: CORBA::SystemException: Unable to contact the Naming Service" );
- }
- if(!CORBA::is_nil(inc))
- {
- MESSAGE( "Ressources Catalog: Naming Service was found" );
- if(EnvL==1)
- {
- for(int j=1; j<=NumberOfTries; j++)
- {
- if (j!=1)
-#ifndef WNT
- a=nanosleep(&ts_req, &ts_rem);
-#else
- Sleep(TIMESleep/1000000);
-#endif
- try{
- object = inc->resolve(name);
- }
- catch(CosNaming::NamingContext::NotFound)
- {
- INFOS( "Ressources Catalog: Logger Server wasn't found" );
- }
- catch(...)
- {
- INFOS( "Ressources Catalog: Unknown exception" );
- }
- if (!CORBA::is_nil(object))
- {
- MESSAGE( "Ressources Catalog: Loger Server was found" );
- RESSOURCES_CATALOG=1;
- break;
- }
- }
- }
- }
- if ((RESSOURCES_CATALOG==1)||((EnvL==0)&&(!CORBA::is_nil(inc))))
- break;
- }
-
- // Active catalog
-
- SALOME_RessourcesCatalogImpl* Catalogue_i = new SALOME_RessourcesCatalogImpl(argc, argv);
- poa->activate_object (Catalogue_i);
- mgr->activate();
- CORBA::Object_ptr myCata = Catalogue_i->_this();
-
- // initialise Naming Service
- SALOME_NamingService *_NS;
- _NS = new SALOME_NamingService(orb);
- // register Catalog in Naming Service
- _NS->Register(myCata ,"/Kernel/RessourcesCatalog");
-
- MESSAGE("Running Ressources Catalog Server.")
-
- orb->run();
-
- poa->destroy(1,1);
-
- }
- catch(CORBA::SystemException&) {
- INFOS("Caught CORBA::SystemException.")
- }
- catch(CORBA::Exception&) {
- INFOS("Caught CORBA::Exception.")
- }
-
- // delete myThreadTrace;
- return 0;
-}
+++ /dev/null
-// SALOME RessourcesCatalog : implementation of catalog resources parsing (SALOME_ModuleCatalog.idl)
-//
-// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// 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 library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : SALOME_RessourcesCatalog_impl.cxx
-// Author : Estelle Deville
-// Module : SALOME
-
-#include "SALOME_RessourcesCatalog_impl.hxx"
-#include <fstream>
-
-#include "Utils_ExceptHandlers.hxx"
-using namespace std;
-UNEXPECT_CATCH(RC_NotFound, SALOME_RessourcesCatalog::NotFound);
-
-//----------------------------------------------------------------------
-// Function : SALOME_RessourcesCatalogImpl
-// Purpose : Constructor
-//----------------------------------------------------------------------
-SALOME_RessourcesCatalogImpl::SALOME_RessourcesCatalogImpl(int argc, char** argv)
-{
- MESSAGE("Ressources Catalog creation");
-
- // Empty used variables
- _ressourceslist.resize(0);
-
- // Parse the arguments given at server run
- if (!_parseArguments(argc, argv,&_path_ressources))
- MESSAGE( "Error while argument parsing" )
-
- // Test existency of files
- if (_path_ressources == NULL)
- MESSAGE( "Error the ressources catalog should be indicated" )
- else
- {
- MESSAGE("Parse ressources catalog");
- // Affect the variable _ressourceslist
- _parse_xml_file(_path_ressources,_ressourceslist);
-
- // Verification of _datatype_list content
- if(!_verify_ressources(_ressourceslist))
- MESSAGE( "Error while parsing the ressources catalog" )
- else MESSAGE("Ressources Catalog OK");
- }
-}
-
-//----------------------------------------------------------------------
-// Function : ~SALOME_RessourcesCatalogImpl
-// Purpose : Destructor
-//----------------------------------------------------------------------
-SALOME_RessourcesCatalogImpl::~SALOME_RessourcesCatalogImpl()
-{
- MESSAGE("Ressources Catalog Destruction");
-}
-
-//----------------------------------------------------------------------
-// Function : GetComputerList
-// Purpose : get ressources list
-//----------------------------------------------------------------------
-SALOME_RessourcesCatalog::ListOfComputer*
-SALOME_RessourcesCatalogImpl::GetComputerList()
-{
- MESSAGE("Begin of GetComputerList");
- SALOME_RessourcesCatalog::ListOfComputer_var _list = new SALOME_RessourcesCatalog::ListOfComputer;
- _list->length(_ressourceslist.size());
- for (unsigned int ind=0; ind < _ressourceslist.size();ind++)
- {
- _list[ind]=CORBA::string_dup(_ressourceslist[ind].Parsername.c_str());
- }
- return _list._retn();
-}
-
-
-//----------------------------------------------------------------------
-// Function : GetRessourcesList
-// Purpose : get a data type name list
-//----------------------------------------------------------------------
-SALOME_RessourcesCatalog::ListOfContainerType*
-SALOME_RessourcesCatalogImpl::GetContainerTypeList(const char* computer)
- throw(SALOME_RessourcesCatalog::NotFound)
-{
- Unexpect aCatch(RC_NotFound);
- MESSAGE("Begin of GetContainerTypeList");
- SALOME_RessourcesCatalog::ListOfContainerType_var _list =
- new SALOME_RessourcesCatalog::ListOfContainerType;
-
- bool find = false ;
-
- // Looking for ressources named "computer"
- // If found, get container type list
- // If not found, exception is thrown
-
- for (unsigned int ind=0; ind < _ressourceslist.size();ind++)
- {
- if (strcmp((_ressourceslist[ind].Parsername).c_str(),computer) == 0)
- {
- MESSAGE("Ressources named " << computer << " found in the ressources catalog");
- find = true;
-
- _list->length(_ressourceslist[ind].Parsercontainertype.size());
- for (unsigned int ind1=0; ind1 < _ressourceslist[ind].Parsercontainertype.size();ind1++)
- {
- // get container type list
- switch(_ressourceslist[ind].Parsercontainertype[ind1]){
- case Cpp:
- _list[ind1] = SALOME_RessourcesCatalog::Cpp;
- break;
- case python:
- _list[ind1] = SALOME_RessourcesCatalog::python;
- break;
- case NP:
- _list[ind1] = SALOME_RessourcesCatalog::NP;
- break;
- }
- }
- }
- }
-
- if (!find)
- {
- // The ressources was not found, the exception should be thrown
- MESSAGE( "The ressource " << computer << " was not found in the ressources catalog" )
- throw SALOME_RessourcesCatalog::NotFound() ;
- }
- return _list._retn();
-}
-
-//----------------------------------------------------------------------
-// Function : GetComputerInfo
-// Purpose : get ressources information
-//----------------------------------------------------------------------
-SALOME_RessourcesCatalog::computer_info*
-SALOME_RessourcesCatalogImpl::GetComputerInfo(const char* computer)
- throw(SALOME_RessourcesCatalog::NotFound)
-{
- MESSAGE("Begin of GetComputerInfo");
- Unexpect aCatch(RC_NotFound);
- SALOME_RessourcesCatalog::computer_info_var _computer_info =
- new SALOME_RessourcesCatalog::computer_info;
-
- bool find = false ;
-
- // Looking for ressources named "computer"
- // If found, get computer info
- // If not found, exception is thrown
- for (unsigned int ind=0; ind < _ressourceslist.size();ind++)
- {
- if (strcmp((_ressourceslist[ind].Parsername).c_str(),computer) == 0)
- {
- MESSAGE("Ressources named " << computer << " found in the ressources catalog");
- find = true;
-
- _computer_info->name = CORBA::string_dup(_ressourceslist[ind].Parsername.c_str());
- _computer_info->OS = CORBA::string_dup(_ressourceslist[ind].ParserOS.c_str());
- _computer_info->OS_version = CORBA::string_dup(_ressourceslist[ind].ParserOS_version.c_str());
- _computer_info->procs = _duplicate_procs(_ressourceslist[ind].Parserprocs);
- }
- }
-
- if (!find)
- {
- // The ressources was not found, the exception should be thrown
- MESSAGE( "The ressource " << computer << " was not found in the ressources catalog" )
- throw SALOME_RessourcesCatalog::NotFound() ;
- }
- return _computer_info._retn();
-}
-
-
-
-//----------------------------------------------------------------------
-// Function : _parse_xml_file
-// Purpose : parse one module catalog
-//----------------------------------------------------------------------
-void
-SALOME_RessourcesCatalogImpl::_parse_xml_file(const char* file,
- ListOfParserressources& ressourceslist)
-{
- SALOME_RessourcesCatalog_Handler* handler = new SALOME_RessourcesCatalog_Handler();
- QFile xmlFile(file);
-
- QXmlInputSource source(xmlFile);
-
- QXmlSimpleReader reader;
- reader.setContentHandler( handler );
- reader.setErrorHandler( handler );
- reader.parse( source );
- xmlFile.close();
- ressourceslist = _ressources_list;
-}
-
-
-//----------------------------------------------------------------------
-// Function : _verify_ressources
-// Purpose : verify ressources from the catalog parsing
-// Verify that a computer is'nt defined twice in the catalog
-//----------------------------------------------------------------------
-bool
-SALOME_RessourcesCatalogImpl::_verify_ressources(ListOfParserressources ressourceslist)
-{
- bool _return_value = true;
- bool _bool = false ;
- vector<string> _machine_list;
- _machine_list.resize(0);
-
- // Fill a list of all computers indicated in the ressources list
- for (unsigned int ind = 0; ind < ressourceslist.size(); ind++)
- _machine_list.push_back(ressourceslist[ind].Parsername);
-
- // Parse if a computer name is twice in the list of computers
-#ifndef WNT
- for (unsigned int ind = 0; ind < _machine_list.size(); ind++)
-#else
- for (ind = 0; ind < _machine_list.size(); ind++)
-#endif
- {
- for (unsigned int ind1 = ind+1 ; ind1 < _machine_list.size(); ind1++)
- {
- if(_machine_list[ind].compare(_machine_list[ind1]) == 0)
- {
- MESSAGE("The computer " << _machine_list[ind] << " is indicated more than once in the ressources list")
- _return_value = false;
- }
- }
- }
-
- return _return_value;
-}
-
-
-//----------------------------------------------------------------------
-// Function : _parseArguments
-// Purpose : parse arguments to get general and personal catalog files
-//----------------------------------------------------------------------
-bool
-SALOME_RessourcesCatalogImpl::_parseArguments(int argc, char **argv,
- char **_path)
-{
- bool _return_value = true;
- *_path = NULL;
- for (int ind = 0; ind < argc ; ind++)
- {
-
- if (strcmp(argv[ind],"-help") == 0)
- {
- MESSAGE( "Usage: " << argv[0] << " -common 'path to ressources catalog' -ORBInitRef NameService=corbaname::localhost");
- _return_value = false ;
- }
- if (strcmp(argv[ind],"-common") == 0)
- {
- if (ind + 1 <= argc)
- {
- // General catalog file
- *_path= argv[ind + 1] ;
- ifstream _path_file(*_path);
- if (!_path_file)
- {
- MESSAGE( "Sorry the file " << *_path << " can't be open" )
- *_path = NULL;
- _return_value = false;
- }
- }
- }
-
- }
- return _return_value;
-}
-
-//----------------------------------------------------------------------
-// Function : _duplicate_procs
-// Purpose : create a list of processors information from the catalog parsing
-//----------------------------------------------------------------------
-SALOME_RessourcesCatalog::ListOfProc
-SALOME_RessourcesCatalogImpl::_duplicate_procs(ListOfParserProc list_procs)
-{
- SALOME_RessourcesCatalog::ListOfProc _list_procs;
- unsigned int _length = list_procs.size();
- _list_procs.length(_length);
-
- for (unsigned int ind = 0; ind < _length; ind++)
- {
- //duplicate processor number
- _list_procs[ind].number = list_procs[ind].Parsernumber;
-
- //duplicate model name
- _list_procs[ind].model_name = CORBA::string_dup(list_procs[ind].Parsermodel_name.c_str());
-
- //duplicate cpu
- _list_procs[ind].cpu_mhz = list_procs[ind].Parsercpu_mhz;
-
- // duplicate cache size
- _list_procs[ind].cache_size = list_procs[ind].Parsercache_size;
- }
- return _list_procs;
-}
+++ /dev/null
-// SALOME RessourcesCatalog : implementation of catalog resources parsing (SALOME_ModuleCatalog.idl)
-//
-// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// 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 library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : SALOME_RessourcesCatalog_impl.hxx
-// Author : Estelle Deville
-// Module : SALOME
-// $Header$
-
-#ifndef RESSOURCESCATALOG_IMPL_H
-#define RESSOURCESCATALOG_IMPL_H
-
-#include "utilities.h"
-#include "SALOME_RessourcesCatalog_Handler.hxx"
-#include <SALOMEconfig.h>
-#include CORBA_SERVER_HEADER(SALOME_RessourcesCatalog)
-
-#if defined RESSOURCESCatalog_EXPORTS
-#if defined WIN32
-#define RESSOURCESCatalog_EXPORT __declspec( dllexport )
-#else
-#define RESSOURCESCatalog_EXPORT
-#endif
-#else
-#if defined WNT
-#define RESSOURCESCatalog_EXPORT __declspec( dllimport )
-#else
-#define RESSOURCESCatalog_EXPORT
-#endif
-#endif
-
-class RESSOURCESCatalog_EXPORT SALOME_RessourcesCatalogImpl: public POA_SALOME_RessourcesCatalog::RessourcesCatalog,
- public PortableServer::RefCountServantBase
-{
-public:
- //! standard constructor
- SALOME_RessourcesCatalogImpl(int argc, char** argv);
-
- //! standard destructor
- virtual ~SALOME_RessourcesCatalogImpl();
-
- //! method to get the ressources list
- /*!
- \return a computer list
- */
- virtual SALOME_RessourcesCatalog::ListOfComputer* GetComputerList();
-
- //! method to get the container type list of a computer
- /*!
- \param computer const char* arguments
- \return a container type list
- */
- virtual SALOME_RessourcesCatalog::ListOfContainerType* GetContainerTypeList(const char* computer) throw(SALOME_RessourcesCatalog::NotFound);
-
- //! method to get informations on a computer
- /*!
- \param computer const char* arguments
- \return informations of the computer
- */
- virtual SALOME_RessourcesCatalog::computer_info* GetComputerInfo(const char* computer) throw(SALOME_RessourcesCatalog::NotFound);
-
-
-private:
-
- //! method to parse the data type catalog
- /*!
- \param file const char* arguments
- \param datatypelist ListOfParserDataType arguments
- */
- virtual void _parse_xml_file(const char* file,
- ListOfParserressources& ressourceslist);
-
-
- //! method to verify ressources catalog content
- /*!
- \param ressourceslist ListOfParserRessources arguments
- \return true if verfication is OK
- */
- virtual bool _verify_ressources(ListOfParserressources ressourceslist);
-
-
- //! method to parse arguments to get catalog file
- /*!
- \param argc int arguments
- \param argv char** arguments
- \param _path char** arguments
- \return true if parsing is OK
- */
- virtual bool _parseArguments(int argc, char **argv, char **_path);
-
- //! method to create a list of processors information from the catalog parsing
- /*!
- \param list_procs ListOfParserProc arguments
- \return the processors information list
- */
- virtual SALOME_RessourcesCatalog::ListOfProc
- _duplicate_procs(ListOfParserProc list_procs);
-
-
- // will contain the path to the ressources catalog
- char* _path_ressources;
-
-
- //will contain the informations on the data type catalog(after parsing)
- ListOfParserressources _ressourceslist ;
-};
-
-#endif // RESSOURCESCATALOG_IMPL_H