libamxo  4.3.4
Object Definition Language (ODL) parsing
test_valid.odl
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (c) 2020 SoftAtHome
4 **
5 ** Redistribution and use in source and binary forms, with or
6 ** without modification, are permitted provided that the following
7 ** conditions are met:
8 **
9 ** 1. Redistributions of source code must retain the above copyright
10 ** notice, this list of conditions and the following disclaimer.
11 **
12 ** 2. Redistributions in binary form must reproduce the above
13 ** copyright notice, this list of conditions and the following
14 ** disclaimer in the documentation and/or other materials provided
15 ** with the distribution.
16 **
17 ** Subject to the terms and conditions of this license, each
18 ** copyright holder and contributor hereby grants to those receiving
19 ** rights under this license a perpetual, worldwide, non-exclusive,
20 ** no-charge, royalty-free, irrevocable (except for failure to
21 ** satisfy the conditions of this license) patent license to make,
22 ** have made, use, offer to sell, sell, import, and otherwise
23 ** transfer this software, where such license applies only to those
24 ** patent claims, already acquired or hereafter acquired, licensable
25 ** by such copyright holder or contributor that are necessarily
26 ** infringed by:
27 **
28 ** (a) their Contribution(s) (the licensed copyrights of copyright
29 ** holders and non-copyrightable additions of contributors, in
30 ** source or binary form) alone; or
31 **
32 ** (b) combination of their Contribution(s) with the work of
33 ** authorship to which such Contribution(s) was added by such
34 ** copyright holder or contributor, if, at the time the Contribution
35 ** is added, such addition causes such combination to be necessarily
36 ** infringed. The patent license shall not apply to any other
37 ** combinations which include the Contribution.
38 **
39 ** Except as expressly stated above, no rights or licenses from any
40 ** copyright holder or contributor is granted under this license,
41 ** whether expressly, by implication, estoppel or otherwise.
42 **
43 ** DISCLAIMER
44 **
45 ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
46 ** CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
47 ** INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
48 ** MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
49 ** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
50 ** CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
51 ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
52 ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
53 ** USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
54 ** AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
55 ** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
56 ** ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
57 ** POSSIBILITY OF SUCH DAMAGE.
58 **
59 ****************************************************************************/
61  test_option_number = 123;
62  test_option_string = "This is a text";
64 }
65 
66 include "test_include.odl";
67 
68 %define {
69  mib test_mib {
70  string MibText = "test";
71  }
72 
73  /* This is multi line comment and should be passed
74  to the comment hook*/
75  object TestObjectRoot {
76 
77  object TestObjectSingelton;
78  %read-only %persistent %private object TestObjSingletonAttr;
79  object TestObjectTemplate[];
80  %read-only %persistent %private object TestObjTemplateAttr[];
81 
85  object TestObjectParamTypes {
86  // single line comment
87  string Param1;
88  int32 Param2;
89  int64 Param3;
90  uint32 Param4;
91  uint64 Param5;
92  bool Param6;
93  double Param7;
94  }
95 
96  object TestObjectFunctions {
97  void func1();
98  string func2();
99  int32 func3();
100  int64 func4();
101  uint32 func5();
102  uint64 func6();
103  bool func7();
104  double func8();
105  list func9();
106  htable func10();
107  variant func11();
108  void func12(string arg1,
109  int32 arg2,
110  int64 arg3,
111  uint32 arg4,
112  uint64 arg5,
113  bool arg6,
114  double arg7,
115  list arg8,
116  htable arg9,
117  variant arg10);
118  }
119 
120  object TestSingeltonParamAttr {
121  %read-only %persistent %private %template %instance %volatile string Param1;
122  }
123  object TestTemplateParamAttr[] {
124  %read-only %persistent %private %template %instance %volatile string Param1;
125  %template string Param2;
126  %instance string Param3;
127  }
128 
129  object TestSingletonFuncAttr {
130  %private %template %instance void TestFunc1();
131  void TestFunc2(%mandatory %in %out %strict int32 number);
132  }
133  object TestTemplateFuncAttr {
134  %private %template %instance void TestFunc1();
135  %template void TestFunc2();
136  %instance void TestFunc3();
137  void TestFunc4(%mandatory %in %out %strict int32 number);
138  }
139 
140  object TestObjectTemplateWithChild[] {
141  counted with NumberOfChildren;
142  object TemplateChildObject {
143  string Param1;
144  void func1();
145  }
146  }
147 
148  %read-only object TestChangeAttr {
149  %private string Param1;
150  %private void Func1();
151  }
152 
153  }
154 }
155 
156 %populate {
157  object TestObjectRoot.TestObjectTemplateWithChild {
158  instance add(1,"Name") {
159  object TemplateChildObject {
160  parameter Param1 = "Some Text";
161  }
162  }
163  }
164 
165  object TestObjectRoot.TestTemplateParamAttr {
166  parameter Param2 = "This is param 2";
167  parameter Param1 = "This is param 1";
168  instance add(99,"") {
169  parameter Param1 = "This is param 1 in instance";
170  parameter Param3 = "Hello World";
171  }
172  instance add(0, "") {
173  extend using mib "test_mib";
174  }
175  }
176 
177  !read-only %persistent object TestObjectRoot.TestChangeAttr {
178  !private %read-only parameter Param1;
179  }
180 }
test_option_bool
Definition: test_valid.odl:63
test_option_string
Definition: test_valid.odl:62
config
Definition: test_valid.odl:60
define
Definition: main.odl:1
amxd_status_t TestFunc4(amxd_object_t *object, amxd_function_t *func, amxc_var_t *args, amxc_var_t *ret)
Definition: test_plugin.c:182