freesecs::secstwo::xml_deserializer_t Class Reference

Deserialiser from FREESECS-defined XML format into FREESECS data item or message internal format XML is parsed with the help of libxml2 library. More...

#include <secstwo_serialize.h>

List of all members.

Public Types

typedef std::vector< pmsg_t > msg_container_t
 Type define for a message container.

Public Member Functions

 xml_deserializer_t (xmlNode *pnode)
 XML Deserialiser default ctor. Deserializes a given libxml2 node into a data item or into a message, depending on the contents. If things go wrong, the ctor throws an empty exception. Sample code is as follows:.
 operator const pdata_item_t & ()
 Data item cast operator to get deserialized data item.
 operator const pmsg_t & ()
 Message cast operator to get deserialized message.

Static Public Member Functions

static int from_file (int fd, int schema_fd, msg_container_t &msg_container)
 Deserialize xml file with validation against XML schema.
static int from_mem (void *buf, size_t buflen, void *schema_buf, size_t schema_buflen, msg_container_t &msg_container)
 Parse XML data stored in memory. Logics is the same as in.


Detailed Description

Deserialiser from FREESECS-defined XML format into FREESECS data item or message internal format XML is parsed with the help of libxml2 library.

See also:
data_item_t

msg_t

Definition at line 169 of file secstwo_serialize.h.


Constructor & Destructor Documentation

xml_deserializer_t::xml_deserializer_t ( xmlNode *  pnode  ) 

XML Deserialiser default ctor. Deserializes a given libxml2 node into a data item or into a message, depending on the contents. If things go wrong, the ctor throws an empty exception. Sample code is as follows:.

xmlDocPtr pdoc = xmlParseMemory(xml_string, xml_string_len) xml_deserializer_t deserialiser(xmlDocGetRootElement(pdoc)) pdata_item_t pitem = deserializer;

Parameters:
pnode libxml2 node that shold contain either data item or the message.

Definition at line 814 of file secstwo_serialize.cpp.

References freesecs::secstwo::list_item_t::_data, freesecs::secstwo::string_data_item_t< _type >::_data, freesecs::secstwo::msg_item_impl_t< _type >::_data, freesecs::secstwo::list_item_t::size(), and freesecs::secstwo::list_item_t::variable().

Here is the call graph for this function:


Member Function Documentation

xml_deserializer_t::operator const pdata_item_t & (  ) 

Data item cast operator to get deserialized data item.

Returns:
Shared ptr with deserialized data item.
Return values:
NULL == pitem.get() means deserialization was not OK or deserialised was a message.
See also:
operator const pmsg_t&()

Definition at line 1055 of file secstwo_serialize.cpp.

xml_deserializer_t::operator const pmsg_t & (  ) 

Message cast operator to get deserialized message.

Returns:
Shared ptr with deserialized message.
Return values:
NULL == pmsg.get() means deserialization was not OK or deserialised was a data item.
See also:
operator const pdata_item_t&()

Definition at line 1060 of file secstwo_serialize.cpp.

int xml_deserializer_t::from_file ( int  fd,
int  schema_fd,
msg_container_t msg_container 
) [static]

Deserialize xml file with validation against XML schema.

Parameters:
fd XML file descriptor
schema_fd FREESECS secstwo.xsd file descriptor
msg_container Message container where deserialized messages are to be stored. It is assumed the file contains message descriptions. Data items will not be stored anywhere. If the schema file is not provided, validation is not performed and this may be the subject to later deserialization errors. It is recommentded to do validation to check for the XML file consistency.
Returns:
Operation status.
Return values:
0 Deserialization successful. Need to check the size of message container however.
-1 Failed to read schema file
-2 Schema file parse error
-3 Schema file parse error
-4 Schema file parse error
-5 Schema file parse error
-6 XML file parse error

Definition at line 1138 of file secstwo_serialize.cpp.

int xml_deserializer_t::from_mem ( void *  buf,
size_t  buflen,
void *  schema_buf,
size_t  schema_buflen,
msg_container_t msg_container 
) [static]

Parse XML data stored in memory. Logics is the same as in.

See also:
from_file

Definition at line 1160 of file secstwo_serialize.cpp.


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

Generated on Sun Jun 20 08:10:08 2010 for FREESECS secstwo by  doxygen 1.5.6