33 class Obs_i :
public POA_YACS_ORB::Observer,
34 public PortableServer::RefCountServantBase
46 std::cerr <<
"Obs_i::notifyObserver " << numid <<
event << std::endl;
47 std::cerr <<
"Obs_i::notifyObserver:state= " <<
_server_proc->getState(numid) << std::endl;
48 std::cerr <<
"Obs_i::notifyObserver:XMLstate= " <<
_server_proc->getXMLState(numid) << std::endl;
59 int main(
int argc,
char** argv)
66 CORBA::ORB_var
orb = CORBA::ORB_init(argc, argv);
67 CORBA::Object_var obj = orb->string_to_object(
"corbaname:rir:#test.my_context/Yacs.Object");
68 yacsref = YACS_ORB::YACS_Gen::_narrow(obj);
71 std::cerr <<
"Can't narrow reference to type yacs (or it was nil)." << std::endl;
76 CORBA::Object_var poa = orb->resolve_initial_references(
"RootPOA");
77 PortableServer::POA_var root_poa = PortableServer::POA::_narrow(poa);
78 PortableServer::POAManager_var poa_man = root_poa->the_POAManager();
81 char* xmlFile=
"/local/chris/SALOME2/SUPERV/YACS/BR_CC/YACS_SRC/src/yacsloader/samples/aschema.xml";
88 YACS_ORB::Observer_ptr obs_ptr = obs->_this();
90 YACS_ORB::stringArray_var names;
91 YACS_ORB::longArray_var ids;
94 int len=ids->length();
96 for(
int i=0;
i<len;
i++)
99 yacsref->addObserver(obs_ptr,numid,
"status");
109 catch(CORBA::COMM_FAILURE& ex) {
110 std::cerr <<
"Caught system exception COMM_FAILURE -- unable to contact the "
111 <<
"object." << std::endl;
113 catch(CORBA::SystemException&) {
114 std::cerr <<
"Caught a CORBA::SystemException." << std::endl;
116 catch(CORBA::Exception&) {
117 std::cerr <<
"Caught CORBA::Exception." << std::endl;
119 catch(omniORB::fatalException& fe) {
120 std::cerr <<
"Caught omniORB::fatalException:" << std::endl;
121 std::cerr <<
" file: " << fe.file() << std::endl;
122 std::cerr <<
" line: " << fe.line() << std::endl;
123 std::cerr <<
" mesg: " << fe.errmsg() << std::endl;
126 std::cerr <<
"Caught unknown exception." << std::endl;