]> SALOME platform Git repositories - modules/kernel.git/blob - src/RessourcesCatalog/SALOME_RessourcesCatalog_Client.cxx
Salome HOME
This commit was generated by cvs2git to track changes on a CVS vendor
[modules/kernel.git] / src / RessourcesCatalog / SALOME_RessourcesCatalog_Client.cxx
1 using namespace std;
2 /* $Header$ */
3
4 #include <iostream.h>
5 #include "SALOME_NamingService.hxx"
6 #include <SALOMEconfig.h>
7 #include CORBA_SERVER_HEADER(SALOME_RessourcesCatalog)
8 #include <string>
9 #include "utilities.h"
10
11 int main(int argc,char **argv)
12 {
13   CORBA::ORB_var orb;
14   CosNaming::NamingContext_var _rootContext;
15   CORBA::Object_var objVar, objVarN;
16   try {
17
18         // initialize the ORB
19
20   orb = CORBA::ORB_init (argc, argv);
21
22  
23   // Get CORBA reference of the catalog
24   SALOME_NamingService NS(orb);
25   CORBA::Object_var objVarN = NS.Resolve("/Kernel/RessourcesCatalog");
26
27   SALOME_RessourcesCatalog::RessourcesCatalog_var Catalogue  = SALOME_RessourcesCatalog::RessourcesCatalog::_narrow(objVarN); 
28   MESSAGE("Ressources distant catalog found");
29
30   //Get Computer list information
31   SALOME_RessourcesCatalog::ListOfComputer_var _list = Catalogue->GetComputerList();
32   for (unsigned int ind = 0; ind < _list->length();ind++)
33     {
34       MESSAGE("Ressources list : " << _list[ind]);
35     }
36
37   //Get container type list of computer eri
38   SALOME_RessourcesCatalog::ListOfContainerType_var list = Catalogue->GetContainerTypeList("eri");
39   for (unsigned int ind = 0; ind < list->length();ind++)
40     {
41       MESSAGE("Container type list of eri : " << list[ind]);
42     }
43
44   // Get processors information of eri
45   SALOME_RessourcesCatalog::computer_info_var computer = Catalogue->GetComputerInfo("eri");
46   MESSAGE("Ressource name : " << computer->name);
47   MESSAGE("Ressource OS : " << computer->OS);
48   MESSAGE("Ressource OS version : " << computer->OS_version);
49   for (unsigned int ind = 0; ind < computer->procs.length();ind++)
50     {
51       MESSAGE("Processor number : " << computer->procs[ind].number);
52       MESSAGE("Processor model name : " << computer->procs[ind].model_name);
53       MESSAGE("Processor cpu : " << computer->procs[ind].cpu_mhz);
54       MESSAGE("Processor cache : " << computer->procs[ind].cache_size);
55     }
56
57   }
58   catch(SALOME_RessourcesCatalog::NotFound &){
59     INFOS("SALOME_RessourcesCatalog::NotFound");
60   }
61     catch(CORBA::SystemException&) {
62       INFOS("Caught CORBA::SystemException.")
63   }
64     catch (CosNaming::NamingContext::CannotProceed &) {
65       INFOS("CosNaming::NamingContext::CannotProceed")
66   }
67     catch (CosNaming::NamingContext::NotFound &) {
68       INFOS("CosNaming::NamingContext::NotFound")
69   }
70     catch (CosNaming::NamingContext::InvalidName &) {
71       INFOS("CosNaming::NamingContext::InvalidName")
72   }
73     catch (CosNaming::NamingContext::AlreadyBound &) {
74       INFOS("CosNaming::NamingContext::AlreadyBound")
75   }
76     catch (CosNaming::NamingContext::NotEmpty &) {
77       INFOS("CosNaming::NamingContext::NotEmpty")
78   }
79
80   catch(CORBA::Exception &sysEx) {
81     INFOS("Caught CORBA::Exception.")
82   }
83
84
85   return 0;
86 }