Commit | Line | Data |
---|---|---|
970ed795 EL |
1 | /////////////////////////////////////////////////////////////////////////////// |
2 | // Copyright (c) 2000-2014 Ericsson Telecom AB | |
3 | // All rights reserved. This program and the accompanying materials | |
4 | // are made available under the terms of the Eclipse Public License v1.0 | |
5 | // which accompanies this distribution, and is available at | |
6 | // http://www.eclipse.org/legal/epl-v10.html | |
7 | /////////////////////////////////////////////////////////////////////////////// | |
8 | #ifndef _Asn_Constraint_HH | |
9 | #define _Asn_Constraint_HH | |
10 | ||
11 | #include "../Constraint.hh" | |
12 | ||
13 | namespace Asn { | |
14 | ||
15 | /** | |
16 | * \addtogroup Constraint | |
17 | * | |
18 | * @{ | |
19 | */ | |
20 | ||
21 | using namespace Common; | |
22 | ||
23 | class AtNotation; | |
24 | class AtNotations; | |
25 | class TableConstraint; | |
26 | ||
27 | // not defined here | |
28 | //class Identifier; | |
29 | class Block; | |
30 | class ObjectSet; | |
31 | class FieldName; | |
32 | ||
33 | ||
34 | /** | |
35 | * This class represents an ASN AtNotation. | |
36 | */ | |
37 | class AtNotation : public Node { | |
38 | private: | |
39 | int levels; /**< number of "."s in \@...compid.compid */ | |
40 | FieldName *cids; /**< ComponentIds */ | |
41 | ||
42 | Identifier *oc_fieldname; /**< ObjectClass fieldname */ | |
43 | Type *firstcomp; /**< link to it */ | |
44 | Type *lastcomp; /**< link to it */ | |
45 | ||
46 | AtNotation(const AtNotation& p); | |
47 | public: | |
48 | AtNotation(int p_levels, FieldName *p_cids); | |
49 | virtual ~AtNotation(); | |
50 | virtual AtNotation* clone() const {return new AtNotation(*this);} | |
51 | int get_levels() {return levels;} | |
52 | FieldName* get_cids() {return cids;} | |
53 | void set_oc_fieldname(const Identifier& p_oc_fieldname); | |
54 | Identifier *get_oc_fieldname() {return oc_fieldname;} | |
55 | void set_firstcomp(Type *p_t) {firstcomp=p_t;} | |
56 | void set_lastcomp(Type *p_t) {lastcomp=p_t;} | |
57 | Type* get_firstcomp() {return firstcomp;} | |
58 | Type* get_lastcomp() {return lastcomp;} | |
59 | string get_dispname() const; | |
60 | }; | |
61 | ||
62 | class AtNotations : public Node { | |
63 | private: | |
64 | vector<AtNotation> ans; /**< AtNotations */ | |
65 | ||
66 | AtNotations(const AtNotations& p); | |
67 | public: | |
68 | AtNotations() : Node() {} | |
69 | virtual ~AtNotations(); | |
70 | virtual AtNotations* clone() const {return new AtNotations(*this);} | |
71 | void add_an(AtNotation *p_an); | |
72 | size_t get_nof_ans() const {return ans.size();} | |
73 | AtNotation* get_an_byIndex(size_t p_i) const {return ans[p_i];} | |
74 | }; | |
75 | ||
76 | /** | |
77 | * This class represents TableConstraint (SimpleTableConstraint and | |
78 | * ComponentRelationConstraint). | |
79 | */ | |
80 | class TableConstraint : public Constraint { | |
81 | private: | |
82 | Block *block_os; | |
83 | Block *block_ans; | |
84 | ObjectSet *os; | |
85 | AtNotations *ans; | |
86 | Type *consdtype; /**< link to the constrained type */ | |
87 | const Identifier* oc_fieldname; /**< link to... */ | |
88 | ||
89 | TableConstraint(const TableConstraint& p); | |
90 | public: | |
91 | TableConstraint(Block *p_block_os, Block *p_block_ans); | |
92 | virtual ~TableConstraint(); | |
93 | virtual TableConstraint* clone() const | |
94 | {return new TableConstraint(*this);} | |
95 | virtual void chk(); | |
96 | const AtNotations* get_ans() const {return ans;} | |
97 | ObjectSet* get_os() const {return os;} | |
98 | const Identifier* get_oc_fieldname() const {return oc_fieldname;} | |
99 | const char* get_name() const { return "table constraint"; } | |
100 | private: | |
101 | void parse_blocks(); | |
102 | }; | |
103 | ||
104 | /** @} end of Constraint group */ | |
105 | ||
106 | } // namespace Asn | |
107 | ||
108 | #endif // _Asn_Constraint_HH |