Commit ef858038 authored by Andrea Zoli's avatar Andrea Zoli
Browse files

Parsing directly XML without conversions.

parent 33b85ebe
Loading
Loading
Loading
Loading
+11 −4
Original line number Original line Diff line number Diff line
@@ -19,6 +19,7 @@
#define _FIELD_H_H
#define _FIELD_H_H


#include "PacketLibDefinition.h"
#include "PacketLibDefinition.h"
#include <string>


namespace PacketLib
namespace PacketLib
{
{
@@ -42,7 +43,7 @@ public:
    int predefinedValue;
    int predefinedValue;


    /// Name of the field.
    /// Name of the field.
    char* name;
	std::string name;
	
	
	/// Logical type - NOT USED FOR NOW
	/// Logical type - NOT USED FOR NOW
	enum LogicalFieldDataType type;
	enum LogicalFieldDataType type;
@@ -56,7 +57,7 @@ class Field
public:
public:


    /// Constructor of class.
    /// Constructor of class.
    Field(char* name, char* dimension, char* predefinedValue, int progressiv);
    Field(std::string name, std::string dimension, std::string predefinedValue, int progressiv);


    /// Destructor of class.
    /// Destructor of class.
    ~Field();
    ~Field();
@@ -83,11 +84,17 @@ public:
    };
    };


    /// Name of the field.
    /// Name of the field.
    inline char* getName()
    std::string getName()
    {
    {
        return type->name;
        return type->name.c_str();
    };
    };


	/// Return the logical field data type.
	LogicalFieldDataType getType()
	{
		return type->type;
	}

    inline int getProgressiv()
    inline int getProgressiv()
    {
    {
        return progressiv;
        return progressiv;
+8 −6
Original line number Original line Diff line number Diff line
@@ -55,6 +55,8 @@ public:
    /// Distruttore
    /// Distruttore
    virtual ~Packet();
    virtual ~Packet();


	void createPacketType(pugi::xml_document& doc, pugi::xml_node hNode, int plPhysicalIndex, int plSize, pugi::xml_node pNode, bool isprefix, word dimprefix, std::map<pugi::xml_node, int>& physicalIndex);

    virtual bool createPacketType(char* fileName, bool prefix, word dimprefix) throw (PacketException*);
    virtual bool createPacketType(char* fileName, bool prefix, word dimprefix) throw (PacketException*);
	
	
	/// Decode the packet
	/// Decode the packet
@@ -174,16 +176,16 @@ public:
    ByteStreamPtr getOutputStream();
    ByteStreamPtr getOutputStream();
	
	
    /// Gets the name of packet.
    /// Gets the name of packet.
    virtual char* getName()
    virtual const char* getName()
    {
    {
        return name;
        return (char*) name.c_str();
    }
    }


    
    
    /// The name of the file .packet that contains the structure of the packet
    /// The name of the file .packet that contains the structure of the packet
    virtual char* getFileName()
    virtual const char* getFileName()
    {
    {
        return filename;
        return filename.c_str();
    }
    }


    
    
@@ -289,7 +291,7 @@ protected:
    byte packetID;
    byte packetID;
    
    
    /// The name of the packet
    /// The name of the packet
    char* name;
    std::string name;
    
    
    /// List of identifiers. This identifiers permits to identify if the stream contains
    /// List of identifiers. This identifiers permits to identify if the stream contains
    /// a particular type of packet
    /// a particular type of packet
@@ -319,7 +321,7 @@ protected:
    bool thereisprefix;
    bool thereisprefix;


    /// The name of the file .packet that contains the structure of the packet
    /// The name of the file .packet that contains the structure of the packet
    char* filename;
	std::string filename;


private:
private:


+1 −1
Original line number Original line Diff line number Diff line
@@ -28,7 +28,7 @@ namespace PacketLib {
class PacketBufferQ {
class PacketBufferQ {


public:
public:
	PacketBufferQ(const string& configFile, const string& inputFile);
	PacketBufferQ(string configFile, string inputFile);


	~PacketBufferQ();
	~PacketBufferQ();


+1 −1
Original line number Original line Diff line number Diff line
@@ -30,7 +30,7 @@ class PacketBufferV {


public:
public:


	PacketBufferV(const string& configFile, const string& inputFile);
	PacketBufferV(string configFile, string inputFile);


	~PacketBufferV();
	~PacketBufferV();


+2 −0
Original line number Original line Diff line number Diff line
@@ -39,6 +39,8 @@ public:
        name = n;
        name = n;
    };
    };


	void loadHeader(pugi::xml_node hNode, int plPhysicalIndex, int plSize);

    /// Loads data header from configuration file.
    /// Loads data header from configuration file.
    bool loadHeader(char* fileName) throw(PacketException*);
    bool loadHeader(char* fileName) throw(PacketException*);


Loading