RuCodeGen 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. data/LICENSE +25 -0
  2. data/README +34 -0
  3. data/Rakefile +32 -0
  4. data/docs/Principle +152 -0
  5. data/docs/ValueIncapsulator +195 -0
  6. data/docs/examples/cpp/custom/submit_deliver +909 -0
  7. data/docs/examples/cpp/value_incapsulator/cfg +127 -0
  8. data/docs/examples/cpp/value_incapsulator/host_config +51 -0
  9. data/examples/cpp/custom/submit_deliver/submit_deliver.rb +43 -0
  10. data/examples/cpp/custom/submit_deliver/submit_deliver_gen.rb +326 -0
  11. data/examples/cpp/value_incapsulator/cfg.decl.hpp +51 -0
  12. data/examples/cpp/value_incapsulator/cfg.impl.cpp +63 -0
  13. data/examples/cpp/value_incapsulator/cg-cfg.rb +19 -0
  14. data/examples/cpp/value_incapsulator/cg-cfg.test.cpp +15 -0
  15. data/examples/cpp/value_incapsulator/cg-host_config.rb +12 -0
  16. data/examples/cpp/value_incapsulator/cout.log +4 -0
  17. data/examples/cpp/value_incapsulator/host_config.impl.cpp +21 -0
  18. data/examples/cpp/value_incapsulator/host_config.impl.hpp +21 -0
  19. data/lib/rucodegen/begin_end.rb +26 -0
  20. data/lib/rucodegen/codegen.rb +4 -0
  21. data/lib/rucodegen/filename_producer.rb +57 -0
  22. data/lib/rucodegen/generation_initiator.rb +92 -0
  23. data/lib/rucodegen/generators.rb +36 -0
  24. data/lib/rucodegen/run_mode.rb +89 -0
  25. data/lib/rucodegen/value_incapsulator.rb +331 -0
  26. data/lib/rucodegen.rb +4 -0
  27. data/tests/generators_test_extension.rb +23 -0
  28. data/tests/tc_class_attribute.rb +87 -0
  29. data/tests/tc_codegen_initiator.rb +164 -0
  30. data/tests/tc_filename_producer.rb +54 -0
  31. data/tests/tc_generators.rb +55 -0
  32. data/tests/tc_run_mode.rb +72 -0
  33. data/tests/tc_value_incapsulator.rb +193 -0
  34. data/tests/tc_value_incapsulator_gen.rb +479 -0
  35. data/tests/ts_rucodegen.rb +11 -0
  36. metadata +98 -0
@@ -0,0 +1,127 @@
1
+ = [RuCodeGen::ValueIncapsulator] cfg
2
+
3
+ == ���������������� ������
4
+
5
+ :include: examples/cpp/value_incapsulator/cg-cfg.rb
6
+
7
+ == ���� ��� ������������� ����������� �������������
8
+
9
+ :include: examples/cpp/value_incapsulator/cg-cfg.test.cpp
10
+
11
+ == ��������� �������������
12
+
13
+ === ���� cfg.decl.hpp
14
+
15
+ class cfg_t
16
+ {
17
+ private :
18
+ std::string listening_mbox_;
19
+ std::string self_mbox_;
20
+ int interception_priority_;
21
+ unsigned int low_watermark_;
22
+ unsigned int high_watermark_;
23
+ unsigned int cprov_high_watermark_;
24
+ unsigned int max_life_time_;
25
+ unsigned int check_life_time_period_;
26
+
27
+ public :
28
+ cfg_t();
29
+
30
+ const std::string &
31
+ listening_mbox() const;
32
+ void
33
+ listening_mbox( const std::string & v__ );
34
+ const std::string &
35
+ self_mbox() const;
36
+ void
37
+ self_mbox( const std::string & v__ );
38
+ int
39
+ interception_priority() const;
40
+ void
41
+ interception_priority( int v__ );
42
+ unsigned int
43
+ low_watermark() const;
44
+ void
45
+ low_watermark( unsigned int v__ );
46
+ unsigned int
47
+ high_watermark() const;
48
+ void
49
+ high_watermark( unsigned int v__ );
50
+ unsigned int
51
+ cprov_high_watermark() const;
52
+ void
53
+ cprov_high_watermark( unsigned int v__ );
54
+ unsigned int
55
+ max_life_time() const;
56
+ void
57
+ max_life_time( unsigned int v__ );
58
+ unsigned int
59
+ check_life_time_period() const;
60
+ void
61
+ check_life_time_period( unsigned int v__ );
62
+
63
+ };
64
+
65
+ === ���� cfg.impl.cpp
66
+
67
+ cfg_t::cfg_t()
68
+ : listening_mbox_()
69
+ , self_mbox_(default_self_mbox())
70
+ , interception_priority_(2)
71
+ , low_watermark_(default_low_watermark)
72
+ , high_watermark_(0)
73
+ , cprov_high_watermark_(0)
74
+ , max_life_time_(60)
75
+ , check_life_time_period_(5)
76
+
77
+ {}
78
+
79
+ const std::string &
80
+ cfg_t::listening_mbox() const
81
+ { return listening_mbox_; }
82
+ void
83
+ cfg_t::listening_mbox( const std::string & v__ )
84
+ { listening_mbox_ = v__; }
85
+ const std::string &
86
+ cfg_t::self_mbox() const
87
+ { return self_mbox_; }
88
+ void
89
+ cfg_t::self_mbox( const std::string & v__ )
90
+ { self_mbox_ = v__; }
91
+ int
92
+ cfg_t::interception_priority() const
93
+ { return interception_priority_; }
94
+ void
95
+ cfg_t::interception_priority( int v__ )
96
+ { interception_priority_ = v__; }
97
+ unsigned int
98
+ cfg_t::low_watermark() const
99
+ { return low_watermark_; }
100
+ void
101
+ cfg_t::low_watermark( unsigned int v__ )
102
+ { low_watermark_ = v__; }
103
+ unsigned int
104
+ cfg_t::high_watermark() const
105
+ { return high_watermark_; }
106
+ void
107
+ cfg_t::high_watermark( unsigned int v__ )
108
+ { high_watermark_ = v__; }
109
+ unsigned int
110
+ cfg_t::cprov_high_watermark() const
111
+ { return cprov_high_watermark_; }
112
+ void
113
+ cfg_t::cprov_high_watermark( unsigned int v__ )
114
+ { cprov_high_watermark_ = v__; }
115
+ unsigned int
116
+ cfg_t::max_life_time() const
117
+ { return max_life_time_; }
118
+ void
119
+ cfg_t::max_life_time( unsigned int v__ )
120
+ { max_life_time_ = v__; }
121
+ unsigned int
122
+ cfg_t::check_life_time_period() const
123
+ { return check_life_time_period_; }
124
+ void
125
+ cfg_t::check_life_time_period( unsigned int v__ )
126
+ { check_life_time_period_ = v__; }
127
+
@@ -0,0 +1,51 @@
1
+ = [RuCodeGen::ValueIncapsulator] host_config
2
+
3
+ == ���������������� ������
4
+
5
+ :include: examples/cpp/value_incapsulator/cg-host_config.rb
6
+
7
+ == ��������� �������������
8
+
9
+ === ���� host_config.impl.hpp
10
+
11
+ class host_config_t
12
+ {
13
+ private :
14
+ std::string m_host;
15
+ short m_post;
16
+
17
+ public :
18
+ host_config_t();
19
+
20
+ const std::string &
21
+ host() const;
22
+ void
23
+ host( const std::string & v__ );
24
+ short
25
+ post() const;
26
+ void
27
+ post( short v__ );
28
+
29
+ };
30
+
31
+ === ���� host_config.impl.cpp
32
+
33
+ host_config_t::host_config_t()
34
+ : m_host("localhost")
35
+ , m_post(8080)
36
+
37
+ {}
38
+
39
+ const std::string &
40
+ host_config_t::host() const
41
+ { return m_host; }
42
+ void
43
+ host_config_t::host( const std::string & v__ )
44
+ { m_host = v__; }
45
+ short
46
+ host_config_t::post() const
47
+ { return m_post; }
48
+ void
49
+ host_config_t::post( short v__ )
50
+ { m_post = v__; }
51
+
@@ -0,0 +1,43 @@
1
+ require 'submit_deliver_gen'
2
+
3
+ submit_deliver do |c|
4
+
5
+ c.decl_file :script_relative => "submit_deliver.detail.hpp"
6
+ c.impl_file :script_relative => "submit_deliver.detail.cpp"
7
+
8
+ c.field :name => :source_addr_ton,
9
+ :type => "oess_1::uchar_t",
10
+ :bit_mask => 0x1,
11
+ :default => 0
12
+
13
+ c.field :name => :source_addr_npi,
14
+ :type => "oess_1::uchar_t",
15
+ :bit_mask => 0x2,
16
+ :default => 0
17
+
18
+ c.field :name => :dest_addr_ton,
19
+ :type => "oess_1::uchar_t",
20
+ :bit_mask => 0x4,
21
+ :default => 0
22
+
23
+ c.field :name => :dest_addr_npi,
24
+ :type => "oess_1::uchar_t",
25
+ :bit_mask => 0x8,
26
+ :default => 0
27
+
28
+ c.field :name => :esm_class,
29
+ :type => "oess_1::uchar_t",
30
+ :bit_mask => 0x10,
31
+ :default => 0
32
+
33
+ c.field :name => :protocol_id,
34
+ :type => "oess_1::uchar_t",
35
+ :bit_mask => 0x20,
36
+ :default => 0
37
+
38
+ c.field :name => :data_coding,
39
+ :type => "oess_1::uchar_t",
40
+ :bit_mask => 0x40,
41
+ :default => 0
42
+ end
43
+
@@ -0,0 +1,326 @@
1
+ require 'rubygems'
2
+ require_gem 'RuCodeGen'
3
+
4
+ module Submit_Deliver
5
+
6
+ # ����� ��� �������� �������� ������ ����.
7
+ # ��� �� �������� �� ��������� ����, ���������� � ����� �����.
8
+ class Field
9
+
10
+ # ���������������� �����������.
11
+ #
12
+ # _a_field_params_ Hash � ����������� ���������� ����.
13
+ # ������ ��������� �������� ��� ������:
14
+ # [:name] �������� ���� (��������, source_addr_ton);
15
+ # [:type] ��� C++ ���� ��� ������������� ���� (��������, oess_1::uchar_t);
16
+ # [:default] �������� ������� ���� �� ���������;
17
+ # [:bit_mask] �������� ������� �����, ������� ����� ���������
18
+ # ������� ������� ����.
19
+ # ���� ������-�� �� ������������ ������ ���, �� �����������
20
+ # ���������� ArgumentError.
21
+ def initialize( a_field_params )
22
+ check_mandatory_key( a_field_params, :name )
23
+ check_mandatory_key( a_field_params, :type )
24
+ check_mandatory_key( a_field_params, :default )
25
+ check_mandatory_key( a_field_params, :bit_mask )
26
+
27
+ @params = a_field_params
28
+ end
29
+
30
+ # ������������� ���������� ����������� ������� ��� ���� � �������� ������.
31
+ def gen_method_decl
32
+ <<-EOF
33
+ /*!
34
+ \\return true, ���� �������� ��� ���� #{name} ������.
35
+ */
36
+ bool
37
+ is_#{name}_present() const;
38
+ /*!
39
+ \\return �������� ���� #{name}.
40
+ \\throw std::exception ��� ������� �������� �������� ��������������
41
+ ����.
42
+ */
43
+ #{type}
44
+ #{name}() const;
45
+ /*!
46
+ ���������� �������� ���� #{name}.
47
+
48
+ ������������ ������������ ������� ����, ��� ���� ������.
49
+ */
50
+ void
51
+ set_#{name}( #{type} v );
52
+ /*!
53
+ �������� ������� ����, ��� ���� #{name} ������.
54
+ */
55
+ void
56
+ drop_#{name}();
57
+
58
+ EOF
59
+ end
60
+
61
+ # ������������� ���������� ������ ���� � �������� ������.
62
+ def gen_field_decl
63
+ <<-EOF
64
+ /*!
65
+ �������� ���� #{name}. ���������� ������, ���� � m_fields_bit_mask
66
+ ����������� ���� #{bit_mask}.
67
+ */
68
+ #{type} #{attr_name};
69
+
70
+ EOF
71
+ end
72
+
73
+ # ������������� ������������� ��������� �� ��������� � ������������.
74
+ def gen_default_init
75
+ <<-EOF
76
+ , m_#{name}( #{default} )
77
+ EOF
78
+ end
79
+
80
+ # ������������� ���������� ������� �� ������ � ����� � ���������� ������.
81
+ #
82
+ # _a_class_name_ ��� C++ ������, ��� �������� ������������ ������.
83
+ def gen_method_impl( a_class_name )
84
+ <<EOF
85
+ bool
86
+ #{a_class_name}::is_#{name}_present() const
87
+ {
88
+ return ( #{bit_mask} == ( m_fields_bit_mask & #{bit_mask} ) );
89
+ }
90
+ #{type}
91
+ #{a_class_name}::#{name}() const
92
+ {
93
+ if( !is_#{name}_present() )
94
+ throw std::runtime_error( "#{name}: no actual value" );
95
+ return #{attr_name};
96
+ }
97
+ void
98
+ #{a_class_name}::set_#{name}( #{type} v )
99
+ {
100
+ #{attr_name} = v;
101
+ m_fields_bit_mask |= #{bit_mask};
102
+ }
103
+ void
104
+ #{a_class_name}::drop_#{name}()
105
+ {
106
+ m_fields_bit_mask &= ~#{bit_mask};
107
+ }
108
+ EOF
109
+ end
110
+
111
+ protected
112
+ # �������� ������� ���������� ����� � ��������� HashMap-�.
113
+ # ��������� ���������� ArgumentError, ���� ����� � HashMap-� ���.
114
+ def check_mandatory_key( a_hash, a_key )
115
+ raise ArgumentError.new( "key '#{a_key}' missed" ) unless a_hash.has_key?( a_key )
116
+ end
117
+
118
+ # Getter ��� �������� ����� ����.
119
+ def name() @params[ :name ] end
120
+ # Getter ��� �������� �������� � C++ ������.
121
+ def attr_name() "m_" + name.to_s end
122
+ # Getter ��� �������� ���� ����.
123
+ def type() @params[ :type ] end
124
+ # Getter ��� �������� �� ��������� ��� ����.
125
+ def default() @params[ :default ] end
126
+ # Getter ��� ������� ����� ����.
127
+ def bit_mask() @params[ :bit_mask ] end
128
+
129
+ end # class Field
130
+
131
+ # ����� ��� �������� �������� ���� �����.
132
+ # ��� �� �������� �� ��������� ����, ���������� �� ���� �������.
133
+ class Data
134
+
135
+ def initialize
136
+ @fields = []
137
+ @decl_file = nil
138
+ @impl_file = nil
139
+ end
140
+
141
+ # ���������� ��� ������ ����.
142
+ #
143
+ # _a_field_params_ ���������, ������� ���������� ����� � �����������
144
+ # ������ Field.
145
+ def field( a_field_params )
146
+ f = Field.new( a_field_params )
147
+ @fields << f
148
+ end
149
+
150
+ # ����������, ������� �������� �������� getter-�� � setter-��
151
+ # ��� ��������� ValueIncapsulator.
152
+ def self.getter_setter_for( a_attribute )
153
+ class_eval %Q{
154
+ def get_#{a_attribute}
155
+ @#{a_attribute}
156
+ end
157
+ def #{a_attribute}( a_value )
158
+ @#{a_attribute} = a_value
159
+ end
160
+ }
161
+ end
162
+
163
+ getter_setter_for :decl_file
164
+ getter_setter_for :impl_file
165
+
166
+ # ��������� �������� C++ ������.
167
+ def gen_class_decl
168
+ <<EOF
169
+ /*!
170
+ ����� ��� �������� ������������ �������� SMPP-����� ���
171
+ submit_sm/deliver_sm/data_sm PDU.
172
+
173
+ ���� ��������� ������� ���������� ��������, ���� ���������������
174
+ ����� is_*_present ���������� true. � ��������� ������ ���� ���������
175
+ �� �������� � ��������� � ���� ����� ��������� � �������������
176
+ ���������� std::exception.
177
+ */
178
+ class MBSMS_2_TYPE submit_deliver_t
179
+ : public oess_1::stdsn::serializable_t
180
+ {
181
+ OESS_SERIALIZER_EX( submit_deliver_t, MBSMS_2_TYPE )
182
+ public :
183
+ /*!
184
+ ����������� �� ���������.
185
+
186
+ ��� ���� ��������� �� �������� ����������� ��������.
187
+ */
188
+ submit_deliver_t();
189
+ virtual ~submit_deliver_t();
190
+
191
+ //! ��� ���� � TLV ����.
192
+ typedef oess_1::ushort_t tag_t;
193
+
194
+ //! ��� ����� �������������� TLV �����.
195
+ typedef std::map< tag_t, std::string > tlv_map_t;
196
+
197
+ #{@fields.inject( "" ) do |decls, f| decls += f.gen_method_decl end}
198
+
199
+ //! ��������� ����� �������������� TLV ����� ��� ���������.
200
+ tlv_map_t &
201
+ tlv_fields();
202
+
203
+ //! ��������� ����� �������������� TLV ����� ��� ������.
204
+ const tlv_map_t &
205
+ tlv_fields() const;
206
+
207
+ //! ����� ����� �������������� TLV �����.
208
+ void
209
+ drop_tlv_fields();
210
+
211
+ private :
212
+ /*!
213
+ ������� �����, ������� ����������, ����� ������ ���� �����
214
+ ���������� ��������.
215
+ */
216
+ oess_1::uint_t m_fields_bit_mask;
217
+
218
+ #{@fields.inject( "" ) do |decls, f| decls += f.gen_field_decl end}
219
+
220
+ //! ����� �������������� TLV �����.
221
+ tlv_map_t m_tlv_fields;
222
+ };
223
+ EOF
224
+ end
225
+
226
+ # ��������� ���������� C++ ������.
227
+ def gen_class_impl
228
+ <<EOF
229
+ submit_deliver_t::submit_deliver_t()
230
+ : m_fields_bit_mask( 0 )
231
+ #{@fields.inject( "" ) do |decls, f| decls += f.gen_default_init end}
232
+ {}
233
+
234
+ submit_deliver_t::~submit_deliver_t()
235
+ {}
236
+
237
+ #{@fields.inject( "" ) do |decls, f|
238
+ decls += f.gen_method_impl( 'submit_deliver_t' ) end}
239
+
240
+ submit_deliver_t::tlv_map_t &
241
+ submit_deliver_t::tlv_fields()
242
+ {
243
+ return m_tlv_fields;
244
+ }
245
+
246
+ const submit_deliver_t::tlv_map_t &
247
+ submit_deliver_t::tlv_fields() const
248
+ {
249
+ return m_tlv_fields;
250
+ }
251
+
252
+ void
253
+ submit_deliver_t::drop_tlv_fields()
254
+ {
255
+ tlv_map_t empty;
256
+ empty.swap( m_tlv_fields );
257
+ }
258
+ EOF
259
+ end
260
+
261
+ # �����, ������� ����� ��������� ��������� �������� ���� submit_deliver_t.
262
+ class DeclGenerator
263
+
264
+ def initialize( d )
265
+ @data = d
266
+ end
267
+
268
+ def generate( to )
269
+ to << @data.gen_class_decl
270
+ end
271
+ end
272
+
273
+ # �����, ������� ����� ��������� ��������� ����������� ���� submit_deliver_t.
274
+ class ImplGenerator
275
+
276
+ def initialize( d )
277
+ @data = d
278
+ end
279
+
280
+ def generate( to )
281
+ to << @data.gen_class_impl
282
+ end
283
+ end
284
+
285
+ end # class Data
286
+
287
+ end # module Submit_Deliver
288
+
289
+ # �������, ��������������� ��� ��������� C++ ���� �� ����������.
290
+ #
291
+ # _block_ ���� ���� � ������������ ����������.
292
+ def submit_deliver( &block )
293
+ d = Submit_Deliver::Data.new
294
+ block.call( d )
295
+
296
+ fail "decl_file not specified" if nil == d.get_decl_file
297
+ fail "impl_file not specified" if nil == d.get_impl_file
298
+
299
+ RuCodeGen::Generators.add(
300
+ RuCodeGen::FilenameProducer.produce(
301
+ $0, d.get_decl_file ),
302
+ Submit_Deliver::Data::DeclGenerator.new( d ) )
303
+ RuCodeGen::Generators.add(
304
+ RuCodeGen::FilenameProducer.produce(
305
+ $0, d.get_impl_file ),
306
+ Submit_Deliver::Data::ImplGenerator.new( d ) )
307
+ end
308
+
309
+ if $0 == __FILE__
310
+
311
+ submit_deliver do |c|
312
+ c.decl_file :script_relative => "test.hpp"
313
+ c.impl_file :script_relative => "test.cpp"
314
+
315
+ c.field :name => :source_addr_ton,
316
+ :type => "oess_1::uchar_t",
317
+ :bit_mask => 0x1,
318
+ :default => 0
319
+
320
+ c.field :name => :source_addr_npi,
321
+ :type => "oess_1::uchar_t",
322
+ :bit_mask => 0x2,
323
+ :default => 0
324
+ end
325
+ end
326
+
@@ -0,0 +1,51 @@
1
+
2
+ class cfg_t
3
+ {
4
+ private :
5
+ std::string listening_mbox_;
6
+ std::string self_mbox_;
7
+ int interception_priority_;
8
+ unsigned int low_watermark_;
9
+ unsigned int high_watermark_;
10
+ unsigned int cprov_high_watermark_;
11
+ unsigned int max_life_time_;
12
+ unsigned int check_life_time_period_;
13
+
14
+ public :
15
+ cfg_t();
16
+
17
+ const std::string &
18
+ listening_mbox() const;
19
+ void
20
+ listening_mbox( const std::string & v__ );
21
+ const std::string &
22
+ self_mbox() const;
23
+ void
24
+ self_mbox( const std::string & v__ );
25
+ int
26
+ interception_priority() const;
27
+ void
28
+ interception_priority( int v__ );
29
+ unsigned int
30
+ low_watermark() const;
31
+ void
32
+ low_watermark( unsigned int v__ );
33
+ unsigned int
34
+ high_watermark() const;
35
+ void
36
+ high_watermark( unsigned int v__ );
37
+ unsigned int
38
+ cprov_high_watermark() const;
39
+ void
40
+ cprov_high_watermark( unsigned int v__ );
41
+ unsigned int
42
+ max_life_time() const;
43
+ void
44
+ max_life_time( unsigned int v__ );
45
+ unsigned int
46
+ check_life_time_period() const;
47
+ void
48
+ check_life_time_period( unsigned int v__ );
49
+
50
+ };
51
+
@@ -0,0 +1,63 @@
1
+
2
+ cfg_t::cfg_t()
3
+ : listening_mbox_()
4
+ , self_mbox_(default_self_mbox())
5
+ , interception_priority_(2)
6
+ , low_watermark_(default_low_watermark)
7
+ , high_watermark_(0)
8
+ , cprov_high_watermark_(0)
9
+ , max_life_time_(60)
10
+ , check_life_time_period_(5)
11
+
12
+ {}
13
+
14
+ const std::string &
15
+ cfg_t::listening_mbox() const
16
+ { return listening_mbox_; }
17
+ void
18
+ cfg_t::listening_mbox( const std::string & v__ )
19
+ { listening_mbox_ = v__; }
20
+ const std::string &
21
+ cfg_t::self_mbox() const
22
+ { return self_mbox_; }
23
+ void
24
+ cfg_t::self_mbox( const std::string & v__ )
25
+ { self_mbox_ = v__; }
26
+ int
27
+ cfg_t::interception_priority() const
28
+ { return interception_priority_; }
29
+ void
30
+ cfg_t::interception_priority( int v__ )
31
+ { interception_priority_ = v__; }
32
+ unsigned int
33
+ cfg_t::low_watermark() const
34
+ { return low_watermark_; }
35
+ void
36
+ cfg_t::low_watermark( unsigned int v__ )
37
+ { low_watermark_ = v__; }
38
+ unsigned int
39
+ cfg_t::high_watermark() const
40
+ { return high_watermark_; }
41
+ void
42
+ cfg_t::high_watermark( unsigned int v__ )
43
+ { high_watermark_ = v__; }
44
+ unsigned int
45
+ cfg_t::cprov_high_watermark() const
46
+ { return cprov_high_watermark_; }
47
+ void
48
+ cfg_t::cprov_high_watermark( unsigned int v__ )
49
+ { cprov_high_watermark_ = v__; }
50
+ unsigned int
51
+ cfg_t::max_life_time() const
52
+ { return max_life_time_; }
53
+ void
54
+ cfg_t::max_life_time( unsigned int v__ )
55
+ { max_life_time_ = v__; }
56
+ unsigned int
57
+ cfg_t::check_life_time_period() const
58
+ { return check_life_time_period_; }
59
+ void
60
+ cfg_t::check_life_time_period( unsigned int v__ )
61
+ { check_life_time_period_ = v__; }
62
+
63
+
@@ -0,0 +1,19 @@
1
+ require 'rubygems'
2
+ require_gem 'RuCodeGen'
3
+
4
+ cpp_value_incapsulator :cfg_t do |c|
5
+ c.decl_file :script_relative => "cfg.decl.hpp"
6
+ c.impl_file :script_relative => "cfg.impl.cpp"
7
+
8
+ c.attr_suffix "_"
9
+
10
+ c.attr :listening_mbox, "std::string"
11
+ c.attr :self_mbox, "std::string", :default => :"default_self_mbox()"
12
+ c.attr :interception_priority, "int", :default => 2
13
+ c.attr :low_watermark, "unsigned int", :default => :default_low_watermark
14
+ c.attr :high_watermark, "unsigned int"
15
+ c.attr :cprov_high_watermark, "unsigned int"
16
+ c.attr :max_life_time, "unsigned int", :default => 60
17
+ c.attr :check_life_time_period, "unsigned int", :default => 5
18
+
19
+ end
@@ -0,0 +1,15 @@
1
+ #include <string>
2
+
3
+ std::string
4
+ default_self_mbox() { return "default"; }
5
+
6
+ const unsigned int default_low_watermark = 30;
7
+
8
+ #include "cfg.decl.hpp"
9
+ #include "cfg.impl.cpp"
10
+
11
+ int
12
+ main()
13
+ {
14
+ cfg_t cfg;
15
+ }