Skip to content

Commit

Permalink
Switched from boa to poa impl.
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@1064 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Peter Aronsson committed Jan 9, 2004
1 parent 2f3b181 commit 34cc8ba
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 16 deletions.
2 changes: 1 addition & 1 deletion modeq/runtime/Makefile.in
Expand Up @@ -11,7 +11,7 @@ CFLAGS = @DEFS@

SHELL = /bin/sh
CC = gcc
IDL = idl --boa --no-poa
IDL = idl
CFLAGS += -I$(RMLINCLUDE) -I../../c_runtime
CXXFLAGS = $(CFLAGS)
SRC = rtopts.c socketimpl.c printimpl.c systemimpl.c
Expand Down
32 changes: 18 additions & 14 deletions modeq/runtime/corbaimpl.cpp
Expand Up @@ -33,12 +33,11 @@ char * modeq_message;


CORBA::ORB_var orb;
CORBA::BOA_var boa;
PortableServer::POA_var poa;

ModeqCommunication_impl * server;

extern "C" {
void writeServerId(CORBA::ORB_var orb);
void* runOrb(void*arg);

void Corba_5finit(void)
Expand All @@ -56,12 +55,24 @@ RML_BEGIN_LABEL(Corba__initialize)
pthread_mutex_init(&modeq_waitlock,NULL);

orb = CORBA::ORB_init(zero, 0,"mico-local-orb");
boa = orb->BOA_init(zero,0,"mico-local-boa");
CORBA::Object_var poaobj = orb->resolve_initial_references("RootPOA");

poa = PortableServer::POA::_narrow(poaobj);
PortableServer::POAManager_var mgr = poa->the_POAManager();

server = new ModeqCommunication_impl();

writeServerId(orb);
boa->impl_is_ready(CORBA::ImplementationDef::_nil());
PortableServer::ObjectId_var oid = poa->activate_object(server);

/* Write reference to file */
ofstream of ("/tmp/openmodelica.objid");
CORBA::Object_var ref = poa->id_to_reference (oid.in());
CORBA::String_var str = orb->object_to_string (ref.in());
of << str.in() << endl;
of.close ();


mgr->activate();

// Start thread that listens on incomming messages.
pthread_t orb_thr_id;
Expand All @@ -78,17 +89,11 @@ RML_END_LABEL
void* runOrb(void* arg)
{
orb->run();
CORBA::release(server);
poa->destroy(TRUE,TRUE);
delete server;
return NULL;
}

void writeServerId(CORBA::ORB_var orb)
{
ofstream tmpFile ("/tmp/openmodelica.objid"); // Should be different on Windows
CORBA::String_var ref = orb->object_to_string(server);
tmpFile << ref << endl;
tmpFile.close();
}

RML_BEGIN_LABEL(Corba__wait_5ffor_5fcommand)
{
Expand Down Expand Up @@ -124,7 +129,6 @@ RML_END_LABEL

RML_BEGIN_LABEL(Corba__close)
{
boa->deactivate_impl(CORBA::ImplementationDef::_nil());
orb->shutdown(TRUE);
#ifdef HAVE_PTHREAD_YIELD
pthread_yield(); // Allowing other thread to shutdown.
Expand Down
2 changes: 1 addition & 1 deletion modeq/runtime/modeq_communication_impl.h
Expand Up @@ -2,7 +2,7 @@
#define _MODEQ_COMMUNICATION_IMPL_H
#include "modeq_communication.h"

class ModeqCommunication_impl : virtual public ModeqCommunication_skel{
class ModeqCommunication_impl : virtual public POA_ModeqCommunication{
public:
ModeqCommunication_impl();
char* sendExpression( const char* expr );
Expand Down

0 comments on commit 34cc8ba

Please sign in to comment.