]> SALOME platform Git repositories - modules/gde.git/blob - projects/GDE_API_CPP/api/src/Attribute.hpp
Salome HOME
FileService
[modules/gde.git] / projects / GDE_API_CPP / api / src / Attribute.hpp
1 #ifndef GDE_ATTRIBUTE_HPP
2 #define GDE_ATTRIBUTE_HPP
3
4 #include <string>
5
6 namespace gde {
7
8   class Attribute {
9     friend class AttributesService;
10     friend class GDESession;
11
12   public:
13     Attribute(const std::string& name, const std::string& type, const std::string& value, bool mandatory)
14       : _id(0), _name(name), _type(type), _value(value), _groupId(0), _mandatory(mandatory)
15     {}
16     ~Attribute() {}
17
18     inline int getId() const { return _id; }
19     inline void setId(int id) { this->_id = id; }
20
21     inline std::string getName() const { return _name; }
22     inline void setName(const std::string& name) { this->_name = name; }
23
24     inline std::string getType() const { return _type; }
25     inline void setType(const std::string& type) { this->_type = type; }
26
27     inline std::string getValue() const { return _value; }
28     inline void setValue(const std::string& value) { this->_value = value; }
29
30     inline int getGroupId() const { return _groupId; }
31     inline void setGroupId(int groupId) { this->_groupId = groupId; }
32
33     inline bool getMandatory() const { return _mandatory; }
34     inline void setMandatory(bool mandatory) { this->_mandatory = mandatory; }
35
36     const std::string toJson() const;
37     static Attribute fromJson(const std::string& json);
38
39   private:
40     Attribute(int id=0, const std::string& name="", const std::string& type="", const std::string& value="", int groupId=0, bool mandatory=false)
41       : _id(id), _name(name), _type(type), _value(value), _groupId(groupId), _mandatory(mandatory)
42     {}
43     //Attribute(const Attribute&); // non copyable
44     //Attribute& operator=(const Attribute&); // non copyable
45
46   private:
47     int _id;
48     std::string _name;
49     std::string _type;
50     std::string _value;
51     int _groupId;
52     bool _mandatory;
53   };
54
55 };
56
57 #endif