23 #define private public
24 #define protected public
25 #include <omniORB4/CORBA.h>
26 #include <omniORB4/internal/typecode.h>
37 #include "SALOME_GenericObj.hh"
50 CORBA::Object_var obj;
51 if(data >>= CORBA::Any::to_object(obj))
53 SALOME::GenericObj_var gobj;
56 gobj=SALOME::GenericObj::_narrow(obj);
58 catch(
const CORBA::SystemException& )
62 if(!CORBA::is_nil(gobj))
64 DEBTRACE(
"It's a SALOME::GenericObj");
68 DEBTRACE(
"It's a CORBA::Object but not a SALOME::GenericObj");
71 DEBTRACE(
"It's not a CORBA::Object");
76 CORBA::Object_var obj;
77 if(data >>= CORBA::Any::to_object(obj))
79 SALOME::GenericObj_var gobj;
82 gobj=SALOME::GenericObj::_narrow(obj);
84 catch(
const CORBA::SystemException& )
88 if(!CORBA::is_nil(gobj))
90 DEBTRACE(
"It's a SALOME::GenericObj");
94 DEBTRACE(
"It's a CORBA::Object but not a SALOME::GenericObj");
97 DEBTRACE(
"It's not a CORBA::Object");
141 put((CORBA::Any *)data);
146 CORBA::TypeCode_var tc=data->type();
149 case CORBA::tk_double:
171 DEBTRACE(
"refcount CORBA : " << ((omni::TypeCode_base*)data->pd_tc.in())->pd_ref_count);
187 DEBTRACE(
"refcount CORBA : " << ((omni::TypeCode_base*)
_data.pd_tc.in())->pd_ref_count);
198 return (
void *)&
_data;
203 CORBA::TypeCode_var tc=
_data.type();
204 return tc->equivalent(CORBA::_tc_null);
216 CORBA::TypeCode_var tc=
getAny()->type();
217 if (!tc->equivalent(CORBA::_tc_null))
260 CORBA::TypeCode_var tc=
_data.type();
261 if (tc->equivalent(CORBA::_tc_null))
262 return "<value>nil</value>";
279 int isString = PyBytes_Check(
getPyObj());
280 PyObject *strPyObj = PyObject_Str(
getPyObj());
281 string val = PyBytes_AsString(strPyObj);
283 val =
"\"" + val +
"\"";
311 DEBTRACE(
"refcount CORBA : " << ((omni::TypeCode_base*)
_data.pd_tc.in())->pd_ref_count);
312 DEBTRACE(
"refcount CORBA tc_double: " << ((omni::TypeCode_base*)CORBA::_tc_double)->pd_ref_count);
318 put((CORBA::Any *)data);
328 DEBTRACE(
"refcount CORBA : " << ((omni::TypeCode_base*)data->pd_tc.in())->pd_ref_count);
331 DEBTRACE(
"refcount CORBA : " << ((omni::TypeCode_base*)
_data.pd_tc.in())->pd_ref_count);
342 DEBTRACE(
"refcount CORBA : " << ((omni::TypeCode_base*)
_data.pd_tc.in())->pd_ref_count);
346 DEBTRACE(
"refcount CORBA : " << ((omni::TypeCode_base*)data->pd_tc.in())->pd_ref_count);
349 DEBTRACE(
"refcount CORBA : " << ((omni::TypeCode_base*)
_data.pd_tc.in())->pd_ref_count);
366 CORBA::Any*
a=
new CORBA::Any;
368 CORBA::TypeCode_var
t;
372 a->replace(CORBA::_tc_long, (
void*) 0);
376 a->replace(CORBA::_tc_string, (
void*) 0);
380 a->replace(CORBA::_tc_double, (
void*) 0);
385 a->replace(
t, (
void*) 0);
390 a->replace(
t, (
void*) 0);
396 DEBTRACE(
"refcount CORBA : " << ((omni::TypeCode_base*)
t.in())->pd_ref_count);
398 a->replace(
t, (
void*) 0);
400 DEBTRACE(
"refcount CORBA : " << ((omni::TypeCode_base*)
t.in())->pd_ref_count);
403 else if(kind ==
Bool)
405 a->replace(CORBA::_tc_boolean, (
void*) 0);
407 else if(kind ==
NONE)
410 msg <<
"Cannot set Any Out for None" << __FILE__ <<
":" << __LINE__;
416 msg <<
"Cannot set Any Out for unknown type" << __FILE__
423 DEBTRACE(
"refcount CORBA : " << ((omni::TypeCode_base*)
a->pd_tc.in())->pd_ref_count);
431 CORBA::TypeCode_var tc=
getAny()->type();
432 if (!tc->equivalent(CORBA::_tc_null))
452 CORBA::TypeCode_var tc=
_data.type();
453 if (tc->equivalent(CORBA::_tc_null))
454 return "<value>nil</value>";
472 PyObject *strPyObj = PyObject_Str(
getPyObj());
473 string val = PyBytes_AsString(strPyObj);
void display(CORBA::Any *data)
void registerObj(CORBA::Any &data)
void releaseObj(CORBA::Any &data)
TypeCode * edGetType() const
std::string getName() const
Base class for all nodes.
virtual std::string dump()
OutputCorbaPort(const std::string &name, Node *node, TypeCode *type)
virtual std::string getAsString()
returns port value as a string that can be used in a GUI for example
virtual void valFromStr(std::string valstr)
Allows to set data from a string representation used in user interface.
virtual std::string valToStr()
Gives a string representation of the data, for user interfaces.
virtual void put(const void *data)
virtual CORBA::Any * getAnyOut()
virtual ~OutputCorbaPort()
YACS::BASES::Mutex _mutex
OutputPort * clone(Node *newHelder) const
virtual CORBA::Any * getAny()
virtual PyObject * getPyObj()
virtual void put(const void *data)
Base class for all ports.
CORBA::ORB_ptr getOrb() const
Base class for all type objects.
std::string convertPyObjectToString(PyObject *ob)
YACSRUNTIMESALOME_EXPORT RuntimeSALOME * getSALOMERuntime()
ostream & operator<<(ostream &os, const OutputCorbaPort &p)
CORBA::TypeCode_ptr getCorbaTC(const TypeCode *t)
PyObject * convertCorbaPyObject(const TypeCode *t, CORBA::Any *data)
std::string convertCorbaXml(const TypeCode *t, CORBA::Any *data)