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