PRepr.h 4.15 KB
Newer Older
Pierre Aubert's avatar
Pierre Aubert committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
/***************************************
	Auteur : Pierre Aubert
	Mail : aubertp7@gmail.com
	Licence : CeCILL-C
****************************************/

#ifndef __PREPR_H__
#define __PREPR_H__

#include <string>
#include <vector>

///@brief Dimention of a tensor configuration
class PDimention{
	public:
		PDimention();
		PDimention(const PDimention & other);
		virtual ~PDimention();
		PDimention & operator = (const PDimention & other);
		void setName(const std::string & name);
		void setValue(const size_t & value);
		void setIsValue(bool isValue);
		const std::string & getName() const;
		std::string & getName();
		const size_t & getValue() const;
		size_t & getValue();
		bool getIsValue() const;
		bool & getIsValue();
	protected:
		void copyPDimention(const PDimention & other);
	private:
		///Name of the variable associated to this dimention
		std::string p_name;
		///Fixed value of the dimention
		size_t p_value;
		///True if the Dimention is a fixed value
		bool p_isValue;
};

///@brief Attribute of a generated class
class PAttribute{
	public:
		PAttribute();
		PAttribute(const PAttribute & other);
		virtual ~PAttribute();
		PAttribute & operator = (const PAttribute & other);
		void setName(const std::string & name);
		void setColName(const std::string & colName);
		void setType(const std::string & type);
		void setDocString(const std::string & docString);
Pierre Aubert's avatar
Pierre Aubert committed
51
		void setVecDim(const std::vector<PDimention> & vecDim);
Pierre Aubert's avatar
Pierre Aubert committed
52 53 54 55 56 57 58 59
		const std::string & getName() const;
		std::string & getName();
		const std::string & getColName() const;
		std::string & getColName();
		const std::string & getType() const;
		std::string & getType();
		const std::string & getDocString() const;
		std::string & getDocString();
Pierre Aubert's avatar
Pierre Aubert committed
60 61
		const std::vector<PDimention> & getVecDim() const;
		std::vector<PDimention> & getVecDim();
Pierre Aubert's avatar
Pierre Aubert committed
62 63 64 65 66 67 68 69 70 71 72 73
	protected:
		void copyPAttribute(const PAttribute & other);
	private:
		///Name of the attribute
		std::string p_name;
		///Name of the associated column
		std::string p_colName;
		///Type of the column
		std::string p_type;
		///Documentation string
		std::string p_docString;
		///Vector of all dimention if the attribute is a tensor
Pierre Aubert's avatar
Pierre Aubert committed
74
		std::vector<PDimention> p_vecDim;
Pierre Aubert's avatar
Pierre Aubert committed
75 76 77 78 79 80 81 82 83 84 85 86
};

///@brief Generated DataSet class
class PTable{
	public:
		PTable();
		PTable(const PTable & other);
		virtual ~PTable();
		PTable & operator = (const PTable & other);
		void setName(const std::string & name);
		void setDataSetName(const std::string & dataSetName);
		void setVarNbEntry(const std::string & varNbEntry);
Pierre Aubert's avatar
Pierre Aubert committed
87
		void setDocString(const std::string & docString);
Pierre Aubert's avatar
Pierre Aubert committed
88 89 90 91 92 93 94
		void setVecAttribute(const std::vector<PAttribute> & vecAttribute);
		const std::string & getName() const;
		std::string & getName();
		const std::string & getDataSetName() const;
		std::string & getDataSetName();
		const std::string & getVarNbEntry() const;
		std::string & getVarNbEntry();
Pierre Aubert's avatar
Pierre Aubert committed
95 96
		const std::string & getDocString() const;
		std::string & getDocString();
Pierre Aubert's avatar
Pierre Aubert committed
97 98 99 100 101 102 103 104 105 106 107
		const std::vector<PAttribute> & getVecAttribute() const;
		std::vector<PAttribute> & getVecAttribute();
	protected:
		void copyPTable(const PTable & other);
	private:
		///Name of the generated class
		std::string p_name;
		///Name of the corresponding DataSet
		std::string p_dataSetName;
		///Name of the variable which describes the number of entries (or row) of the current PTable (or DataSet)
		std::string p_varNbEntry;
Pierre Aubert's avatar
Pierre Aubert committed
108 109
		///Documentation string of the current PTable
		std::string p_docString;
Pierre Aubert's avatar
Pierre Aubert committed
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139
		///Vector of all the attributes of the PTable
		std::vector<PAttribute> p_vecAttribute;
};

///@brief Configuration file which will produce a source and header in C++
class PSource{
	public:
		PSource();
		PSource(const PSource & other);
		virtual ~PSource();
		PSource & operator = (const PSource & other);
		void setName(const std::string & name);
		void setVecTable(const std::vector<PTable> & vecTable);
		const std::string & getName() const;
		std::string & getName();
		const std::vector<PTable> & getVecTable() const;
		std::vector<PTable> & getVecTable();
	protected:
		void copyPSource(const PSource & other);
	private:
		///Name of the source file (without extention)
		std::string p_name;
		///Vector of all tables describes in the current PSource
		std::vector<PTable> p_vecTable;
};



#endif