Version: 8.3.0
YACS::ENGINE::XmlCorba Class Reference

#include <XMLCORBAConv.hxx>

Inheritance diagram for YACS::ENGINE::XmlCorba:
Collaboration diagram for YACS::ENGINE::XmlCorba:

Public Member Functions

 XmlCorba (InputCorbaPort *p)
 
virtual void put (const void *data) throw (ConversionException)
 
void put (const char *data) throw (ConversionException)
 Convert a XML (char *) to CORBA::Any and push it in the proxy port. More...
 
- Public Member Functions inherited from YACS::ENGINE::ProxyPort
 ProxyPort (InputPort *p)
 
 ~ProxyPort ()
 
void edRemoveAllLinksLinkedWithMe () throw (Exception)
 
InputPortclone (Node *newHelder) const
 
void edNotifyReferencedBy (OutPort *fromPort)
 
void edNotifyDereferencedBy (OutPort *fromPort)
 
std::set< OutPort * > edSetOutPort () const
 Returns physical backlinks NOT user backlinks. More...
 
InputPortgetPublicRepresentant ()
 returns the final physical port behind 'this'. More...
 
void * get () const
 
int edGetNumberOfLinks () const
 Returns number of physical backlinks NOT number of user backlinks. More...
 
bool isIntermediate () const
 
void exRestoreInit ()
 
void exSaveInit ()
 
void getAllRepresentants (std::set< InPort * > &repr) const
 
virtual std::string typeName ()
 
- Public Member Functions inherited from YACS::ENGINE::InputPort
virtual ~InputPort ()
 
std::string getNameOfTypeOfCurrentInstance () const
 
virtual bool edIsManuallyInitialized () const
 Specifies if this port has been manually set by the call of InputPort::edInit. More...
 
bool edIsInitialized () const
 soon deprecated More...
 
template<class T >
void edInit (T value)
 
void edInit (Any *value)
 
void edInit (const std::string &impl, const void *value)
 Initialize the port with an object (value) coming from a world with implementation impl. More...
 
virtual void edRemoveManInit ()
 Removes eventually previous manual initialisation. More...
 
virtual void checkBasicConsistency () const throw (Exception)
 Check basically that this port has one chance to be specified on time. It's a necessary condition not sufficient at all. More...
 
virtual void exInit (bool start)
 
virtual bool isEmpty ()
 
virtual std::string dump ()
 
virtual std::string getHumanRepr ()
 
virtual void setStringRef (std::string strRef)
 
bool canBeNull () const
 
- Public Member Functions inherited from YACS::ENGINE::DataFlowPort
TypeOfChannel getTypeOfChannel () const
 returns type of channel the port will use for data exchange on runtime : DATAFLOW or DATASTREAM. More...
 
virtual ~DataFlowPort ()
 
virtual std::string valToStr ()
 Gives a string representation of the data, for user interfaces. More...
 
virtual void valFromStr (std::string valstr)
 Allows to set data from a string representation used in user interface. More...
 
- Public Member Functions inherited from YACS::ENGINE::DataPort
TypeCodeedGetType () const
 
void edSetType (TypeCode *type)
 
std::string getName () const
 
void setName (std::string theName)
 
bool isDifferentTypeOf (const DataPort *other) const
 
virtual std::string getAsString ()
 returns port value as a string that can be used in a GUI for example More...
 
- Public Member Functions inherited from YACS::ENGINE::Port
virtual ~Port ()
 
NodegetNode () const
 
int getNumId () const
 
void modified ()
 
- Public Member Functions inherited from YACS::ENGINE::InPort
virtual ~InPort ()
 

Additional Inherited Members

- Static Public Member Functions inherited from YACS::ENGINE::DataPort
static DataPortisCrossingType (const std::vector< DataPort * > &historyOfLink)
 
- Static Public Attributes inherited from YACS::ENGINE::InputPort
static const char NAME [] ="InputPort"
 
- Protected Member Functions inherited from YACS::ENGINE::InputPort
 InputPort (const InputPort &other, Node *newHelder)
 
 InputPort (const std::string &name, Node *node, TypeCode *type, bool canBeNull=false)
 
- Protected Attributes inherited from YACS::ENGINE::ProxyPort
InputPort_port
 
- Static Protected Attributes inherited from YACS::ENGINE::Port
static int _total = 0
 
static const char NAME [] ="Port"
 

Detailed Description

Definition at line 33 of file XMLCORBAConv.hxx.

Constructor & Destructor Documentation

XmlCorba::XmlCorba ( InputCorbaPort p)

Definition at line 36 of file XMLCORBAConv.cxx.

37  : ProxyPort(p), DataPort(p->getName(), p->getNode(), p->edGetType()), Port(p->getNode())
38 {
39 }

Member Function Documentation

void XmlCorba::put ( const void *  data) throw (ConversionException)
virtual

Reimplemented from YACS::ENGINE::ProxyPort.

Definition at line 41 of file XMLCORBAConv.cxx.

References DEBTRACE.

42 {
43  DEBTRACE((const char *)data);
44  put((const char *)data);
45 }
void XmlCorba::put ( const char *  data) throw (ConversionException)

Convert a XML (char *) to CORBA::Any and push it in the proxy port.

Parameters
data: Xml::char *

Definition at line 51 of file XMLCORBAConv.cxx.

References gui.CONNECTOR::a, YACS::ENGINE::convertXmlCorba(), DEBTRACE, and doc.

52 {
53  DEBTRACE(data);
54  xmlDocPtr doc;
55  xmlNodePtr cur;
56  CORBA::Any *a=NULL;
57 
58  doc = xmlParseMemory(data, strlen(data));
59  if (doc == NULL )
60  {
61  stringstream msg;
62  msg << "Problem in conversion: XML Document not parsed successfully ";
63  msg << " (" << __FILE__ << ":" << __LINE__ << ")";
64  throw ConversionException(msg.str());
65  }
66  cur = xmlDocGetRootElement(doc);
67  if (cur == NULL)
68  {
69  xmlFreeDoc(doc);
70  stringstream msg;
71  msg << "Problem in conversion: empty XML Document";
72  msg << " (" << __FILE__ << ":" << __LINE__ << ")";
73  throw ConversionException(msg.str());
74  }
75  while (cur != NULL)
76  {
77  if ((!xmlStrcmp(cur->name, (const xmlChar *)"value")))
78  {
79  try
80  {
81  a=convertXmlCorba(edGetType(),doc,cur);
82  }
83  catch(ConversionException)
84  {
85  throw;
86  }
87  catch(...)
88  {
89  stringstream msg;
90  msg << "Problem in conversion: kind= " << edGetType()->kind() ;
91  msg << " (" << __FILE__ << ":" << __LINE__ << ")";
92  throw ConversionException(msg.str());
93  }
94  break;
95  }
96  cur = cur->next;
97  }
98  xmlFreeDoc(doc);
99  if(a==NULL)
100  {
101  stringstream msg;
102  msg << "Problem in conversion: incorrect XML value";
103  msg << " (" << __FILE__ << ":" << __LINE__ << ")";
104  throw ConversionException(msg.str());
105  }
106 
107  //xmlCleanupParser();
108  _port->put(a);
109  _port->setStringRef(data);
110  //delete Any that has been allocated by convertXmlCorba
111  delete a;
112 }

The documentation for this class was generated from the following files: