gps_pvt 0.10.1 → 0.10.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dc12b7e4590d91b7afacd099d36852acdde54d11e8418ff0c99386ac17e68ca4
4
- data.tar.gz: f3286d74e35a744a2c451768f8785c259f36f5d6a94d04daaad71857f472429a
3
+ metadata.gz: 0d6b65fbf88b765e83cf8d2341d42e6919c8b79be5e98d2c493ca23ec5445e8e
4
+ data.tar.gz: 11bd177fd1cd8ba4ecf5134b64977f6e9a3b0e08cff3a290d1bca6897958f23b
5
5
  SHA512:
6
- metadata.gz: 0611b095f8e2ccb80baa1dc9ba98291b6a5091dcbb14479b64058541260e5ccfd8ee1589aa40fc73393837b638f23633ac3dcfaa8fe23b396c1edfb960d47d75
7
- data.tar.gz: 90731b787b1a62c718a49da481adc87bdedd26d57c207f29d69b35dffb0859bdaf185a6fe739060be68370cf66587feb26ffd18f01a2ed6037900a6c9527e35b
6
+ metadata.gz: e20cfb1dd15fe7ff0ff7320e6acc32d8966c1ad6d67f3203e27da757fb095e512085bdea4e7a9ac90282df8a4ea92235cb94a3b6210f6d1b8938c17f505f9ee3
7
+ data.tar.gz: 6897b4cdedcfd23edb23bdaf57f6d008f9c2562107dc7ccbf1788e7249637b5a1a7fc79b0af09d68a967aed5d86811947b4f29b2465b4db8835727adf69af4a0
data/README.md CHANGED
@@ -43,7 +43,7 @@ The format of file is automatically determined with its extension, such as .ubx
43
43
  | --antex=file_or_URI | [Antenna Exchange Format](https://igs.org/wg/antenna#files) (supported gps_pvt version >= 0.6.0) |
44
44
  | --rinex_clk=file_or_URI | [RINEX clock](https://files.igs.org/pub/data/format/rinex_clock304.txt) file (supported gps_pvt version >= 0.7.0) |
45
45
  | <a name=opt_rtcm3>--rtcm3=file_or_URI</a> | [RTCM 10403.x](https://rtcm.myshopify.com/collections/differential-global-navigation-satellite-dgnss-standards). (supported gps_pvt version >= 0.9.0) The latest version uses message type Observation(GPS: 1001..1004; GLONASS: 1009..1012), Epehemris(GPS: 1019; GLOANSS: 1020; SBAS: 1043; QZSS: 1044), MSM(GPS: 1071..1077; GLONASS: 1081..1087; SBAS: 1101..1107; QZSS: 1111..1117) |
46
- | <a name=opt_supl>--supl=URI</a> | [SUPL, secure user plane location](https://www.openmobilealliance.org/release/SUPL/). (supported gps_pvt version >= 0.10.0) Both [LPP](https://portal.3gpp.org/desktopmodules/Specifications/SpecificationDetails.aspx?specificationId=3710)(default) and [RRLP](https://portal.3gpp.org/desktopmodules/Specifications/SpecificationDetails.aspx?specificationId=2688) are internally used, which can be manually selected by adding ```?protocol=lpp_or_rrlp``` URI query string. |
46
+ | <a name=opt_supl>--supl=URI</a> | [SUPL, secure user plane location](https://www.openmobilealliance.org/release/SUPL/). (supported gps_pvt version >= 0.10.0) Whether [LPP(default)](https://portal.3gpp.org/desktopmodules/Specifications/SpecificationDetails.aspx?specificationId=3710) or [RRLP](https://portal.3gpp.org/desktopmodules/Specifications/SpecificationDetails.aspx?specificationId=2688) are internally used, which can be manually selected by adding ```?protocol=lpp_or_rrlp``` URI query string. |
47
47
 
48
48
  Since version 0.2.0, SBAS and QZSS are supported in addition to GPS. Since version 0.4.0, GLONASS is also available. QZSS ranging is activated in default, however, SBAS is just utilized for ionospheric correction. GLONASS is also turned off by default. If you want to activate SBAS or GLONASS ranging, "--with=(system or PRN)" options are used with gps_pvt executable like
49
49
 
@@ -172,7 +172,7 @@ Utility to get and dump GPS files. After installation of gps_pvt, to type
172
172
 
173
173
  $ gps_get file_or_URI(s) (options) > output_file
174
174
 
175
- saves data into output_file by using redirection. http(s), ftp, ntrip, and supl can be used as scheme of URI. Serial port is also supported. Note that compressed data is automatically decompressed before output. The following options are available.
175
+ saves data into output_file by using redirection. http(s), ftp, ntrip, and supl can be used as scheme of URI. Serial port is also supported. Note that compressed data is automatically decompressed before output. It is also noted that supl received data are filtered to its LPP/RRLP content, and printed in JSON format. The following options are available.
176
176
 
177
177
  | key | value | comment | since |
178
178
  ----|----|----|----
data/Rakefile CHANGED
@@ -11,6 +11,14 @@ Rake::ExtensionTask.new("gps_pvt") do |ext|
11
11
  ext.lib_dir = "lib/gps_pvt"
12
12
  end
13
13
 
14
+ require "yard"
15
+
16
+ YARD::Rake::YardocTask.new do |t|
17
+ #t.files = ['lib/**/*.rb', 'ext/**/*_wrap.cxx']
18
+ t.options = ['--embed-mixins']
19
+ #t.stats_options = ['--list-undoc']
20
+ end
21
+
14
22
  namespace :git do
15
23
  task :version do
16
24
  @git_version ||= proc{
@@ -83,25 +91,28 @@ end
83
91
 
84
92
  desc "Generate SWIG wrapper codes"
85
93
  task :swig do
86
- swig_dir = File::join(File::dirname(__FILE__), 'ext', 'ninja-scan-light', 'tool', 'swig')
87
94
  out_base_dir = File::join(File::dirname(__FILE__), 'ext', 'gps_pvt')
88
- Dir::chdir(swig_dir){
89
- Dir::glob("*.i"){|src|
90
- mod_name = File::basename(src, '.*')
91
- out_dir = File::join(out_base_dir, mod_name)
92
- sh "mkdir -p #{out_dir}"
93
- wrapper = File::join(out_dir, "#{mod_name}_wrap.cxx")
94
- sh [:make, :clean, wrapper,
95
- "BUILD_DIR=#{out_dir}",
96
- "SWIGFLAGS='-c++ -ruby -prefix \"GPS_PVT::\"#{" -D__MINGW__" if ENV["MSYSTEM"]}'"].join(' ')
97
- open(wrapper, 'r+'){|io|
98
- lines = io.read.lines.collect{|line|
99
- line.sub(/rb_require\(\"([^\"]+)\"\)/){ # from camel to underscore downcase style
100
- "rb_require(\"#{$1.sub('GPS_PVT', 'gps_pvt')}\")"
95
+ [
96
+ File::join(File::dirname(__FILE__), 'ext', 'ninja-scan-light', 'tool', 'swig'),
97
+ ].each{|swig_dir|
98
+ Dir::chdir(swig_dir){
99
+ Dir::glob("*.i"){|src|
100
+ mod_name = File::basename(src, '.*')
101
+ out_dir = File::join(out_base_dir, mod_name)
102
+ sh "mkdir -p #{out_dir}"
103
+ wrapper = File::join(out_dir, "#{mod_name}_wrap.cxx")
104
+ sh [:make, :clean, wrapper,
105
+ "BUILD_DIR=#{out_dir}",
106
+ "SWIGFLAGS='-c++ -ruby -prefix \"GPS_PVT::\"#{" -D__MINGW__" if ENV["MSYSTEM"]}'"].join(' ')
107
+ open(wrapper, 'r+'){|io|
108
+ lines = io.read.lines.collect{|line|
109
+ line.sub(/rb_require\(\"([^\"]+)\"\)/){ # from camel to underscore downcase style
110
+ "rb_require(\"#{$1.sub('GPS_PVT', 'gps_pvt')}\")"
111
+ }
101
112
  }
113
+ io.rewind
114
+ io.write(lines.join)
102
115
  }
103
- io.rewind
104
- io.write(lines.join)
105
116
  }
106
117
  }
107
118
  }
@@ -8495,7 +8495,7 @@ _wrap_Matrix_FrozenD_each__SWIG_0(int argc, VALUE *argv, VALUE self) {
8495
8495
  (&_e)->regenerate();
8496
8496
  SWIG_fail;
8497
8497
  }
8498
- vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Matrix_FrozenT_double_Array2D_DenseT_double_t_MatrixViewBaseT_t_t, 0 | 0 );
8498
+ vresult = self;
8499
8499
  return vresult;
8500
8500
  fail:
8501
8501
  return Qnil;
@@ -8531,7 +8531,7 @@ _wrap_Matrix_FrozenD_each__SWIG_1(int argc, VALUE *argv, VALUE self) {
8531
8531
  (&_e)->regenerate();
8532
8532
  SWIG_fail;
8533
8533
  }
8534
- vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Matrix_FrozenT_double_Array2D_DenseT_double_t_MatrixViewBaseT_t_t, 0 | 0 );
8534
+ vresult = self;
8535
8535
  return vresult;
8536
8536
  fail:
8537
8537
  return Qnil;
@@ -11940,7 +11940,7 @@ _wrap_Matrix_FrozenD_f_each__SWIG_0(int argc, VALUE *argv, VALUE self) {
11940
11940
  (&_e)->regenerate();
11941
11941
  SWIG_fail;
11942
11942
  }
11943
- vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Matrix_FrozenT_double_Array2D_DenseT_double_t_MatrixViewFilterT_MatrixViewBaseT_t_t_t, 0 | 0 );
11943
+ vresult = self;
11944
11944
  return vresult;
11945
11945
  fail:
11946
11946
  return Qnil;
@@ -11976,7 +11976,7 @@ _wrap_Matrix_FrozenD_f_each__SWIG_1(int argc, VALUE *argv, VALUE self) {
11976
11976
  (&_e)->regenerate();
11977
11977
  SWIG_fail;
11978
11978
  }
11979
- vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Matrix_FrozenT_double_Array2D_DenseT_double_t_MatrixViewFilterT_MatrixViewBaseT_t_t_t, 0 | 0 );
11979
+ vresult = self;
11980
11980
  return vresult;
11981
11981
  fail:
11982
11982
  return Qnil;
@@ -13956,7 +13956,7 @@ _wrap_MatrixD_resizeN___(int argc, VALUE *argv, VALUE self) {
13956
13956
  }
13957
13957
  }
13958
13958
  result = (Matrix< double,Array2D_Dense< double > > *) &Matrix_Sl_double_Sc_Array2D_Dense_Sl_double_Sg__Sg__resize(arg1,(unsigned int const *)arg2,(unsigned int const *)arg3);
13959
- vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_MatrixT_double_Array2D_DenseT_double_t_MatrixViewBaseT_t_t, 0 | 0 );
13959
+ vresult = self;
13960
13960
  return vresult;
13961
13961
  fail:
13962
13962
  return Qnil;
@@ -16448,7 +16448,7 @@ _wrap_Matrix_FrozenComplexD_each__SWIG_0(int argc, VALUE *argv, VALUE self) {
16448
16448
  (&_e)->regenerate();
16449
16449
  SWIG_fail;
16450
16450
  }
16451
- vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Matrix_FrozenT_ComplexT_double_t_Array2D_DenseT_ComplexT_double_t_t_MatrixViewBaseT_t_t, 0 | 0 );
16451
+ vresult = self;
16452
16452
  return vresult;
16453
16453
  fail:
16454
16454
  return Qnil;
@@ -16484,7 +16484,7 @@ _wrap_Matrix_FrozenComplexD_each__SWIG_1(int argc, VALUE *argv, VALUE self) {
16484
16484
  (&_e)->regenerate();
16485
16485
  SWIG_fail;
16486
16486
  }
16487
- vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Matrix_FrozenT_ComplexT_double_t_Array2D_DenseT_ComplexT_double_t_t_MatrixViewBaseT_t_t, 0 | 0 );
16487
+ vresult = self;
16488
16488
  return vresult;
16489
16489
  fail:
16490
16490
  return Qnil;
@@ -19891,7 +19891,7 @@ _wrap_Matrix_FrozenComplexD_f_each__SWIG_0(int argc, VALUE *argv, VALUE self) {
19891
19891
  (&_e)->regenerate();
19892
19892
  SWIG_fail;
19893
19893
  }
19894
- vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Matrix_FrozenT_ComplexT_double_t_Array2D_DenseT_ComplexT_double_t_t_MatrixViewFilterT_MatrixViewBaseT_t_t_t, 0 | 0 );
19894
+ vresult = self;
19895
19895
  return vresult;
19896
19896
  fail:
19897
19897
  return Qnil;
@@ -19927,7 +19927,7 @@ _wrap_Matrix_FrozenComplexD_f_each__SWIG_1(int argc, VALUE *argv, VALUE self) {
19927
19927
  (&_e)->regenerate();
19928
19928
  SWIG_fail;
19929
19929
  }
19930
- vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Matrix_FrozenT_ComplexT_double_t_Array2D_DenseT_ComplexT_double_t_t_MatrixViewFilterT_MatrixViewBaseT_t_t_t, 0 | 0 );
19930
+ vresult = self;
19931
19931
  return vresult;
19932
19932
  fail:
19933
19933
  return Qnil;
@@ -21903,7 +21903,7 @@ _wrap_MatrixComplexD_resizeN___(int argc, VALUE *argv, VALUE self) {
21903
21903
  }
21904
21904
  }
21905
21905
  result = (Matrix< Complex< double >,Array2D_Dense< Complex< double > > > *) &Matrix_Sl_Complex_Sl_double_Sg__Sc_Array2D_Dense_Sl_Complex_Sl_double_Sg__Sg__Sg__resize(arg1,(unsigned int const *)arg2,(unsigned int const *)arg3);
21906
- vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_MatrixT_ComplexT_double_t_Array2D_DenseT_ComplexT_double_t_t_MatrixViewBaseT_t_t, 0 | 0 );
21906
+ vresult = self;
21907
21907
  return vresult;
21908
21908
  fail:
21909
21909
  return Qnil;
@@ -95,6 +95,11 @@ class GPS_Signal {
95
95
  PRN::content <<= 1;
96
96
  PRN::content[0] = tmp;
97
97
  }
98
+ void previous(){
99
+ bool tmp(PRN::content[3] ^ PRN::content[0]);
100
+ PRN::content >>= 1;
101
+ PRN::content[9] = tmp;
102
+ }
98
103
  };
99
104
 
100
105
  class G2 : public PRN {
@@ -114,6 +119,16 @@ class GPS_Signal {
114
119
  PRN::content <<= 1;
115
120
  PRN::content[0] = tmp;
116
121
  }
122
+ void previous(){
123
+ bool tmp(PRN::content[2]
124
+ ^ PRN::content[3]
125
+ ^ PRN::content[6]
126
+ ^ PRN::content[8]
127
+ ^ PRN::content[9]
128
+ ^ PRN::content[0]);
129
+ PRN::content >>= 1;
130
+ PRN::content[9] = tmp;
131
+ }
117
132
  static G2 get_G2(const int &prn){
118
133
  switch(prn){
119
134
  case 1: return G2(1, 5);
@@ -160,9 +175,9 @@ class GPS_Signal {
160
175
  class CA_Code {
161
176
  public:
162
177
  typedef FloatT float_t;
163
- static const float_t FREQENCY;
178
+ static const float_t FREQUENCY;
164
179
  static const float_t length_1chip() {
165
- static const float_t res(1. / FREQENCY);
180
+ static const float_t res(1. / FREQUENCY);
166
181
  return res;
167
182
  }
168
183
  protected:
@@ -177,11 +192,15 @@ class GPS_Signal {
177
192
  g1.next();
178
193
  g2.next();
179
194
  }
195
+ void previous(){
196
+ g1.previous();
197
+ g2.previous();
198
+ }
180
199
  };
181
200
  };
182
201
 
183
202
  template <class FloatT>
184
- const typename GPS_Signal<FloatT>::float_t GPS_Signal<FloatT>::CA_Code::FREQENCY = 1.023E6;
203
+ const typename GPS_Signal<FloatT>::float_t GPS_Signal<FloatT>::CA_Code::FREQUENCY = 1.023E6;
185
204
 
186
205
  template <class FloatT = double>
187
206
  struct GPS_Time {
@@ -73,6 +73,8 @@ struct native_exception : public std::exception {
73
73
  values[i] = (*self)[i];
74
74
  }
75
75
  }
76
+ %typemap(in) FloatT values[3];
77
+ %typemap(argout) FloatT values[3];
76
78
  #endif
77
79
  %typemap(in,numinputs=0) const void *check_block {
78
80
  #ifdef SWIGRUBY
@@ -98,6 +100,7 @@ struct native_exception : public std::exception {
98
100
  #endif
99
101
  }
100
102
  }
103
+ %clear const void *check_block;
101
104
  };
102
105
  #ifdef SWIGRUBY
103
106
  %mixin System_3D "Enumerable";
@@ -170,6 +173,9 @@ struct native_exception : public std::exception {
170
173
  %template(XYZ) System_XYZ<type, WGS84>;
171
174
  %template(LLH) System_LLH<type, WGS84>;
172
175
  %template(ENU) System_ENU<type, WGS84>;
176
+ %typemap(out) FloatT &;
177
+ %typemap(in) (type (&res)[3][3]);
178
+ %typemap(argout) (type (&res)[3][3]);
173
179
  %enddef
174
180
 
175
181
  CONCRETIZE(double);
@@ -960,6 +960,7 @@ struct MatrixUtil {
960
960
  std::string("Unknown enumerate direction: ").append(inspect_str($1)).c_str());
961
961
  }
962
962
  }
963
+ %typemap(out) const Matrix_Frozen<T, Array2D_Type, ViewType> & "$result = self;"
963
964
  %catches(native_exception) each;
964
965
  const Matrix_Frozen<T, Array2D_Type, ViewType> &each(
965
966
  void (*each_func)(
@@ -970,6 +971,7 @@ struct MatrixUtil {
970
971
  return *$self;
971
972
  }
972
973
  %alias each "each_with_index";
974
+ %typemap(out) const Matrix_Frozen<T, Array2D_Type, ViewType> &;
973
975
 
974
976
  %catches(native_exception, std::invalid_argument) map;
975
977
  Matrix<T, Array2D_Dense<T> > map(
@@ -1005,6 +1007,7 @@ struct MatrixUtil {
1005
1007
  (RTEST(idx_selector) ? 1 : 0), &idx_selector,
1006
1008
  (rb_block_call_func_t)rb_equal, value);
1007
1009
  }
1010
+ %typemap(check) VALUE idx_selector;
1008
1011
  %alias index "find_index";
1009
1012
 
1010
1013
  SWIG_Object to_a() const {
@@ -1020,6 +1023,20 @@ struct MatrixUtil {
1020
1023
  return res;
1021
1024
  }
1022
1025
  #endif
1026
+ %typemap(in)
1027
+ Matrix<T, Array2D_Dense<T> > &output_L,
1028
+ Matrix<T, Array2D_Dense<T> > &output_U,
1029
+ Matrix<T, Array2D_Dense<T> > &output_P,
1030
+ Matrix<T, Array2D_Dense<T> > &output_D,
1031
+ Matrix<T, Array2D_Dense<T> > &output_Q,
1032
+ Matrix<T, Array2D_Dense<T> > &output_R;
1033
+ %typemap(argout)
1034
+ Matrix<T, Array2D_Dense<T> > &output_L,
1035
+ Matrix<T, Array2D_Dense<T> > &output_U,
1036
+ Matrix<T, Array2D_Dense<T> > &output_P,
1037
+ Matrix<T, Array2D_Dense<T> > &output_D,
1038
+ Matrix<T, Array2D_Dense<T> > &output_Q,
1039
+ Matrix<T, Array2D_Dense<T> > &output_R;
1023
1040
  };
1024
1041
 
1025
1042
  #if defined(SWIGRUBY)
@@ -1171,6 +1188,15 @@ MAKE_TO_S(Matrix_Frozen)
1171
1188
  %rename("map!") map_bang;
1172
1189
  %alias map_bang "collect!,map_with_index!,collect_with_index!";
1173
1190
  #endif
1191
+
1192
+ %typemap(in)
1193
+ void (*each_func)(const T &src, T *dst, const unsigned int &i, const unsigned int &j);
1194
+ %typemap(typecheck) const typename MatrixUtil::each_which_t each_which;
1195
+ %typemap(in) const typename MatrixUtil::each_which_t each_which;
1196
+ %typemap(typecheck) const void *replacer;
1197
+ %typemap(in) const void *replacer;
1198
+ %typemap(in) self_t *self_p;
1199
+ %typemap(argout) self_t *self_p;
1174
1200
  };
1175
1201
 
1176
1202
  %define INSTANTIATE_MATRIX_TRANSPOSE(type, storage, view_from, view_to)
@@ -1251,6 +1277,12 @@ MAKE_TO_S(Matrix_Frozen)
1251
1277
  }
1252
1278
  output_D = D;
1253
1279
  }
1280
+ %typemap(in)
1281
+ Matrix<ctype, Array2D_Dense<ctype > > &output_D,
1282
+ Matrix<ctype, Array2D_Dense<ctype > > &output_V;
1283
+ %typemap(argout)
1284
+ Matrix<ctype, Array2D_Dense<ctype > > &output_D,
1285
+ Matrix<ctype, Array2D_Dense<ctype > > &output_V;
1254
1286
  };
1255
1287
  %enddef
1256
1288
  %define INSTANTIATE_MATRIX_EIGEN(type, ctype)
@@ -1366,6 +1398,7 @@ INSTANTIATE_MATRIX_PARTIAL(type, Array2D_Dense<type >, MatView_pt, MatView_pt);
1366
1398
  #endif
1367
1399
  else{SWIG_exception(SWIG_TypeError, "$*1_ltype is expected");}
1368
1400
  }
1401
+ %typemap(out) Matrix<type, Array2D_Dense<type > > & "$result = self;"
1369
1402
  Matrix<type, Array2D_Dense<type > > &resize(
1370
1403
  const unsigned int *r_p, const unsigned int *c_p){
1371
1404
  unsigned int r(r_p ? *r_p : $self->rows()), c(c_p ? *c_p : $self->columns());
@@ -1376,6 +1409,10 @@ INSTANTIATE_MATRIX_PARTIAL(type, Array2D_Dense<type >, MatView_pt, MatView_pt);
1376
1409
  mat_new.partial(r_min, c_min).replace($self->partial(r_min, c_min), false);
1377
1410
  return (*($self) = mat_new);
1378
1411
  }
1412
+ %clear Matrix<type, Array2D_Dense<type > > &;
1413
+
1414
+ //%typemap(in) unsigned int *r_p, unsigned int *c_p; // NG; remove custom typemap before Matrix::resize! generation
1415
+ %clear unsigned int *r_p, unsigned int *c_p; // OK, work around version
1379
1416
  };
1380
1417
 
1381
1418
  %template(Matrix ## suffix) Matrix<type, Array2D_Dense<type > >;
@@ -286,7 +286,7 @@ shared_examples 'Matrix' do
286
286
  ].each{|arg|
287
287
  mat_orig = mat[0].copy
288
288
  mat_replaced = arg.kind_of?(Proc) ? mat_orig.send(:replace!, &arg) : mat_orig.send(:replace!, arg)
289
- expect(mat_replaced).to equal(mat_orig)
289
+ expect(mat_replaced).to be(mat_orig)
290
290
  expect(mat_replaced).not_to equal(mat[1])
291
291
  expect(mat_replaced.to_a).to eq(mat[1].to_a)
292
292
  }
@@ -306,7 +306,7 @@ shared_examples 'Matrix' do
306
306
  idxs[a], idxs[b] = [b, a]
307
307
  mat_builtin = Matrix::columns(mat_builtin.column_vectors.values_at(*idxs))
308
308
  end
309
- expect(mat_mod).to equal(mat[0])
309
+ expect(mat_mod).to be(mat[0])
310
310
  expect(mat[0].to_a).to eq(mat_builtin.to_a)
311
311
  }
312
312
  }
@@ -391,11 +391,12 @@ shared_examples 'Matrix' do
391
391
  candidates = (func.to_s =~ /with_index$/) \
392
392
  ? indices.collect{|i, j| [compare_with[i][j], i, j]} \
393
393
  : indices.collect{|i, j| [compare_with[i][j]]}
394
- mat.send(*[func, k].compact){|*v|
394
+ mat2 = mat.send(*[func, k].compact){|*v|
395
395
  i = candidates.find_index(v)
396
396
  expect(i).not_to be(nil)
397
397
  candidates.delete_at(i)
398
398
  }
399
+ expect(mat2).to be(mat)
399
400
  expect(candidates.empty?).to be(true)
400
401
  }
401
402
  }
@@ -449,7 +450,7 @@ shared_examples 'Matrix' do
449
450
  v[0] * 2
450
451
  }
451
452
  expect(candidates.empty?).to be(true)
452
- expect(mat2.to_a).to eq(mat.to_a)
453
+ expect(mat2).to be(mat)
453
454
  expect(mat2.to_a).to eq(compare_with.collect.with_index{|values, i|
454
455
  values.collect.with_index{|v, j|
455
456
  indices.include?([i, j]) ? (v * 2) : v
@@ -541,6 +542,7 @@ shared_examples 'Matrix' do
541
542
  }
542
543
  mat_orig = mat[0].to_a
543
544
  r, c = [:rows, :columns].collect{|f| mat[0].send(f)}
545
+ expect(mat[0].resize!(r, c)).to be(mat[0])
544
546
  expect(mat[0].resize!(r, c).to_a).to eq(mat_orig)
545
547
  expect(mat[0].resize!(r, nil).to_a).to eq(mat_orig)
546
548
  expect(mat[0].resize!(nil, c).to_a).to eq(mat_orig)
data/gps_pvt.gemspec CHANGED
@@ -64,6 +64,7 @@ Gem::Specification.new do |spec|
64
64
  spec.add_development_dependency "rspec", "~> 3.0"
65
65
  spec.add_development_dependency "matrix" if GPS_PVT::version_compare(RUBY_VERSION, "3.1") >= 0
66
66
  spec.add_development_dependency "racc"
67
+ spec.add_development_dependency "yard"
67
68
  spec.add_development_dependency "github_changelog_generator" unless ((Gem::Platform.local.os =~ /mingw/) && (GPS_PVT::version_compare(RUBY_VERSION, "3.1") >= 0))
68
69
 
69
70
  # For more information and examples about making a new gem, checkout our
@@ -1,3 +1,5 @@
1
+ require 'set'
2
+
1
3
  module GPS_PVT
2
4
  end
3
5
 
@@ -261,10 +263,10 @@ resolve_tree = proc{|root|
261
263
  res
262
264
  }
263
265
 
264
- # This proc is useless because assumed automatic tagging
265
- # does not require to re-order based on manual tags or class numbers
266
+ # This proc is used to re-order for non-automatic tagging transformation
266
267
  # @see https://stackoverflow.com/a/31450137
267
268
  get_universal_class_number = proc{|type|
269
+ # TODO where is CHOICE class number definition?
268
270
  next get_universal_class_number.call(type[1][:root][0][:type]) if type[0] == :CHOICE
269
271
  { # @see Table.1 unless any comment
270
272
  :BOOLEAN => 1,
@@ -274,6 +276,9 @@ resolve_tree = proc{|root|
274
276
  :NULL => 5,
275
277
  :ENUMERATED => 10,
276
278
  :SEQUENCE => 16,
279
+ :SEQUENCE_OF => 16,
280
+ :SET => 17,
281
+ :SET_OF => 17,
277
282
  :NumericString => 18, # @see Table.6
278
283
  :PrintableString => 19, # @see Table.6
279
284
  :IA5String => 22, # @see Table.6
@@ -281,6 +286,23 @@ resolve_tree = proc{|root|
281
286
  :UTCTime => 23, # @see 43.3
282
287
  }[type[0]]
283
288
  }
289
+
290
+ reorder_children = proc{|type_opts|
291
+ # reordering when automatic tagging transformation is not selected
292
+ tags = Set[]
293
+ [type_opts[:root], type_opts[:extension]].compact.each{|items|
294
+ items.collect!{|v|
295
+ tag = v[:type][1][:tag]
296
+ tag_class_num = case tag
297
+ when Array; [{"APPLICATION" => 1, "PRIVATE" => 3}[tag[0]], tag[1]]
298
+ when Integer; [2, tag] # (Context-specific)
299
+ else; [0, get_universal_class_number.call(v[:type])] # UNIVERSAL
300
+ end
301
+ raise unless tags.add?(tag_class_num) # Identical tag is already existed!
302
+ [v, tag_class_num]
303
+ }.sort!{|a, b| a[1] <=> b[1]}.collect!{|v| v[0]}
304
+ }
305
+ }
284
306
 
285
307
  prepare_coding = proc{|tree|
286
308
  next tree.each{|k, v|
@@ -313,7 +335,8 @@ resolve_tree = proc{|root|
313
335
  }
314
336
  when :BIT_STRING, :OCTET_STRING
315
337
  opts[:size_range] = find_range.call(opts, :size)
316
- when :SEQUENCE
338
+ when :SEQUENCE, :SET
339
+ reorder_children.call(opts) if (opts[:automatic_tagging] == false) # only for SET
317
340
  (opts[:root] + (opts[:extension] || [])).each.with_index{|v, i|
318
341
  v[:name] = v[:name] ? v[:name].to_sym : i
319
342
  v[:type][1][:typename] ||= v[:name] if v[:name].kind_of?(Symbol) && v[:type] # for debugger
@@ -325,11 +348,11 @@ resolve_tree = proc{|root|
325
348
  v2[:name]
326
349
  } if v[:group]
327
350
  }
328
- when :SEQUENCE_OF
351
+ when :SEQUENCE_OF, :SET_OF
329
352
  opts[:size_range] = find_range.call(opts, :size)
330
353
  prepare_coding.call(opts)
331
354
  when :CHOICE
332
- # Skip reordering based on automatic tagging assumption
355
+ reorder_children.call(opts) if (opts[:automatic_tagging] == false)
333
356
  opts[:extension] = opts[:extension].collect{|v|
334
357
  v[:group] || [v] # 22. Note says "Version brackets have no effect"
335
358
  }.flatten(1) if opts[:extension]
@@ -372,7 +395,7 @@ generate_skeleton = proc{|tree, data|
372
395
  when :BIT_STRING, :OCTET_STRING
373
396
  data || ({:BIT_STRING => [0], :OCTET_STRING => [0xFF]}[type] \
374
397
  * (opts[:size_range][:root].first rescue 0))
375
- when :SEQUENCE
398
+ when :SEQUENCE, :SET
376
399
  data ||= {}
377
400
  Hash[*((opts[:root] + (opts[:extension] || [])).collect{|v|
378
401
  if v[:group] then
@@ -386,7 +409,7 @@ generate_skeleton = proc{|tree, data|
386
409
  end
387
410
  end
388
411
  }.compact.flatten(2))]
389
- when :SEQUENCE_OF
412
+ when :SEQUENCE_OF, :SET_OF
390
413
  next data.collect{|v| generate_skeleton.call(opts, v)} if data
391
414
  v = Marshal::dump(generate_skeleton.call(opts))
392
415
  (opts[:size_range][:root].first rescue 0).times.collect{
@@ -488,7 +511,7 @@ encode = proc{|tree, data|
488
511
  end
489
512
  end
490
513
  res += data.collect{|v| "%0#{bits}b"%[v]}.join
491
- when :SEQUENCE
514
+ when :SEQUENCE, :SET
492
515
  opt_def_flags, root_encoded = opts[:root].collect{|v| # 18.2
493
516
  has_elm = data.include?(v[:name])
494
517
  elm = data[v[:name]]
@@ -532,7 +555,7 @@ encode = proc{|tree, data|
532
555
  end
533
556
 
534
557
  "#{ext_bit}#{opt_def_flags.join}#{root_encoded.join}#{ext_encoded}"
535
- when :SEQUENCE_OF
558
+ when :SEQUENCE_OF, :SET_OF
536
559
  ext_bit, len_enc = case (cat = opts[:size_range].belong_to(data.size))
537
560
  when :additional
538
561
  # 19.4 -> 10.9.4.2(semi_constrained_whole_number)
@@ -691,7 +714,7 @@ decode = proc{|tree, str|
691
714
  end
692
715
  end
693
716
  str.slice!(0, bits * len).scan(/.{#{bits}}/).collect{|chunk| chunk.to_i(2)}
694
- when :SEQUENCE
717
+ when :SEQUENCE, :SET
695
718
  has_extension = (opts[:extension] && (str.slice!(0) == '1'))
696
719
  data = Hash[*(
697
720
  opts[:root].collect{|v| [v[:name], v[:default]] if v[:default]}.compact.flatten(1)
@@ -709,7 +732,7 @@ decode = proc{|tree, str|
709
732
  v[:group] ? decoded.to_a : [[v[:name], decoded]]
710
733
  }.compact.flatten(2))]) if has_extension
711
734
  data
712
- when :SEQUENCE_OF
735
+ when :SEQUENCE_OF, :SET_OF
713
736
  len_dec = if opts[:size_range][:additional] && (str.slice!(0) == '1') then
714
737
  # 19.4 -> 10.9.4.2(semi_constrained_whole_number)
715
738
  :length_otherwise