LTKCPP-- LLRP Toolkit C Plus Plus Library
ltkcpp_array.cpp
1 
2 /*
3  *****************************************************************************
4  * *
5  * IMPINJ CONFIDENTIAL AND PROPRIETARY *
6  * *
7  * This source code is the sole property of Impinj, Inc. Reproduction or *
8  * utilization of this source code in whole or in part is forbidden without *
9  * the prior written consent of Impinj, Inc. *
10  * *
11  * (c) Copyright Impinj, Inc. 2007,2008. All rights reserved. *
12  * *
13  *****************************************************************************/
14 
15 
16 #include "ltkcpp_platform.h"
17 #include "ltkcpp_base.h"
18 
19 
20 namespace LLRP
21 {
22 
23 /*
24  * u8v
25  */
26 
28 {
29  m_pValue = NULL;
30  m_nValue = 0;
31 }
32 
34  unsigned int nValue)
35 {
36  m_nValue = nValue;
37  if(0 < m_nValue)
38  {
39  m_pValue = new llrp_u8_t[m_nValue];
40  memset(m_pValue, 0, sizeof m_pValue[0] * m_nValue);
41  }
42  else
43  {
44  m_pValue = NULL;
45  }
46 }
47 
49  const llrp_u8v_t & rOther)
50 {
51  copy(rOther);
52 }
53 
55 {
56  reset();
57 }
58 
59 llrp_u8v_t &
61  const llrp_u8v_t & rOther)
62 {
63  if(this != &rOther)
64  {
65  reset();
66  copy(rOther);
67  }
68 
69  return *this;
70 }
71 
72 void
73 llrp_u8v_t::reset(void)
74 {
75  if(NULL != m_pValue)
76  {
77  delete[] m_pValue;
78  m_pValue = NULL;
79  }
80  m_nValue = 0;
81 }
82 
83 void
84 llrp_u8v_t::copy (
85  const llrp_u8v_t & rOther)
86 {
87  m_nValue = rOther.m_nValue;
88  if(0 < m_nValue)
89  {
90  m_pValue = new llrp_u8_t[m_nValue];
91  memcpy(m_pValue, rOther.m_pValue, sizeof m_pValue[0] * m_nValue);
92  }
93  else
94  {
95  m_pValue = NULL;
96  }
97 }
98 
99 
100 
101 
102 
103 /*
104  * s8v
105  */
106 
108 {
109  m_pValue = NULL;
110  m_nValue = 0;
111 }
112 
114  unsigned int nValue)
115 {
116  m_nValue = nValue;
117  if(0 < m_nValue)
118  {
119  m_pValue = new llrp_s8_t[m_nValue];
120  memset(m_pValue, 0, sizeof m_pValue[0] * m_nValue);
121  }
122  else
123  {
124  m_pValue = NULL;
125  }
126 }
127 
129  const llrp_s8v_t & rOther)
130 {
131  copy(rOther);
132 }
133 
135 {
136  reset();
137 }
138 
139 llrp_s8v_t &
141  const llrp_s8v_t & rOther)
142 {
143  if(this != &rOther)
144  {
145  reset();
146  copy(rOther);
147  }
148 
149  return *this;
150 }
151 
152 void
153 llrp_s8v_t::reset(void)
154 {
155  if(NULL != m_pValue)
156  {
157  delete[] m_pValue;
158  m_pValue = NULL;
159  }
160  m_nValue = 0;
161 }
162 
163 void
164 llrp_s8v_t::copy (
165  const llrp_s8v_t & rOther)
166 {
167  m_nValue = rOther.m_nValue;
168  if(0 < m_nValue)
169  {
170  m_pValue = new llrp_s8_t[m_nValue];
171  memcpy(m_pValue, rOther.m_pValue, sizeof m_pValue[0] * m_nValue);
172  }
173  else
174  {
175  m_pValue = NULL;
176  }
177 }
178 
179 
180 
181 
182 
183 /*
184  * u16v
185  */
186 
188 {
189  m_pValue = NULL;
190  m_nValue = 0;
191 }
192 
194  unsigned int nValue)
195 {
196  m_nValue = nValue;
197  if(0 < m_nValue)
198  {
199  m_pValue = new llrp_u16_t[m_nValue];
200  memset(m_pValue, 0, sizeof m_pValue[0] * m_nValue);
201  }
202  else
203  {
204  m_pValue = NULL;
205  }
206 }
207 
209  const llrp_u16v_t & rOther)
210 {
211  copy(rOther);
212 }
213 
215 {
216  reset();
217 }
218 
219 llrp_u16v_t &
221  const llrp_u16v_t & rOther)
222 {
223  if(this != &rOther)
224  {
225  reset();
226  copy(rOther);
227  }
228 
229  return *this;
230 }
231 
232 void
233 llrp_u16v_t::reset(void)
234 {
235  if(NULL != m_pValue)
236  {
237  delete[] m_pValue;
238  m_pValue = NULL;
239  }
240  m_nValue = 0;
241 }
242 
243 void
244 llrp_u16v_t::copy (
245  const llrp_u16v_t & rOther)
246 {
247  m_nValue = rOther.m_nValue;
248  if(0 < m_nValue)
249  {
250  m_pValue = new llrp_u16_t[m_nValue];
251  memcpy(m_pValue, rOther.m_pValue, sizeof m_pValue[0] * m_nValue);
252  }
253  else
254  {
255  m_pValue = NULL;
256  }
257 }
258 
259 
260 
261 
262 
263 /*
264  * s16v
265  */
266 
268 {
269  m_pValue = NULL;
270  m_nValue = 0;
271 }
272 
274  unsigned int nValue)
275 {
276  m_nValue = nValue;
277  if(0 < m_nValue)
278  {
279  m_pValue = new llrp_s16_t[m_nValue];
280  memset(m_pValue, 0, sizeof m_pValue[0] * m_nValue);
281  }
282  else
283  {
284  m_pValue = NULL;
285  }
286 }
287 
289  const llrp_s16v_t & rOther)
290 {
291  copy(rOther);
292 }
293 
295 {
296  reset();
297 }
298 
299 llrp_s16v_t &
301  const llrp_s16v_t & rOther)
302 {
303  if(this != &rOther)
304  {
305  reset();
306  copy(rOther);
307  }
308 
309  return *this;
310 }
311 
312 void
313 llrp_s16v_t::reset(void)
314 {
315  if(NULL != m_pValue)
316  {
317  delete[] m_pValue;
318  m_pValue = NULL;
319  }
320  m_nValue = 0;
321 }
322 
323 void
324 llrp_s16v_t::copy (
325  const llrp_s16v_t & rOther)
326 {
327  m_nValue = rOther.m_nValue;
328  if(0 < m_nValue)
329  {
330  m_pValue = new llrp_s16_t[m_nValue];
331  memcpy(m_pValue, rOther.m_pValue, sizeof m_pValue[0] * m_nValue);
332  }
333  else
334  {
335  m_pValue = NULL;
336  }
337 }
338 
339 
340 
341 
342 
343 /*
344  * u32v
345  */
346 
348 {
349  m_pValue = NULL;
350  m_nValue = 0;
351 }
352 
354  unsigned int nValue)
355 {
356  m_nValue = nValue;
357  if(0 < m_nValue)
358  {
359  m_pValue = new llrp_u32_t[m_nValue];
360  memset(m_pValue, 0, sizeof m_pValue[0] * m_nValue);
361  }
362  else
363  {
364  m_pValue = NULL;
365  }
366 }
367 
369  const llrp_u32v_t & rOther)
370 {
371  copy(rOther);
372 }
373 
375 {
376  reset();
377 }
378 
379 llrp_u32v_t &
381  const llrp_u32v_t & rOther)
382 {
383  if(this != &rOther)
384  {
385  reset();
386  copy(rOther);
387  }
388 
389  return *this;
390 }
391 
392 void
393 llrp_u32v_t::reset(void)
394 {
395  if(NULL != m_pValue)
396  {
397  delete[] m_pValue;
398  m_pValue = NULL;
399  }
400  m_nValue = 0;
401 }
402 
403 void
404 llrp_u32v_t::copy (
405  const llrp_u32v_t & rOther)
406 {
407  m_nValue = rOther.m_nValue;
408  if(0 < m_nValue)
409  {
410  m_pValue = new llrp_u32_t[m_nValue];
411  memcpy(m_pValue, rOther.m_pValue, sizeof m_pValue[0] * m_nValue);
412  }
413  else
414  {
415  m_pValue = NULL;
416  }
417 }
418 
419 
420 
421 
422 
423 /*
424  * s32v
425  */
426 
428 {
429  m_pValue = NULL;
430  m_nValue = 0;
431 }
432 
434  unsigned int nValue)
435 {
436  m_nValue = nValue;
437  if(0 < m_nValue)
438  {
439  m_pValue = new llrp_s32_t[m_nValue];
440  memset(m_pValue, 0, sizeof m_pValue[0] * m_nValue);
441  }
442  else
443  {
444  m_pValue = NULL;
445  }
446 }
447 
449  const llrp_s32v_t & rOther)
450 {
451  copy(rOther);
452 }
453 
455 {
456  reset();
457 }
458 
459 llrp_s32v_t &
461  const llrp_s32v_t & rOther)
462 {
463  if(this != &rOther)
464  {
465  reset();
466  copy(rOther);
467  }
468 
469  return *this;
470 }
471 
472 void
473 llrp_s32v_t::reset(void)
474 {
475  if(NULL != m_pValue)
476  {
477  delete[] m_pValue;
478  m_pValue = NULL;
479  }
480  m_nValue = 0;
481 }
482 
483 void
484 llrp_s32v_t::copy (
485  const llrp_s32v_t & rOther)
486 {
487  m_nValue = rOther.m_nValue;
488  if(0 < m_nValue)
489  {
490  m_pValue = new llrp_s32_t[m_nValue];
491  memcpy(m_pValue, rOther.m_pValue, sizeof m_pValue[0] * m_nValue);
492  }
493  else
494  {
495  m_pValue = NULL;
496  }
497 }
498 
499 
500 
501 
502 
503 /*
504  * u64v
505  */
506 
508 {
509  m_pValue = NULL;
510  m_nValue = 0;
511 }
512 
514  unsigned int nValue)
515 {
516  m_nValue = nValue;
517  if(0 < m_nValue)
518  {
519  m_pValue = new llrp_u64_t[m_nValue];
520  memset(m_pValue, 0, sizeof m_pValue[0] * m_nValue);
521  }
522  else
523  {
524  m_pValue = NULL;
525  }
526 }
527 
529  const llrp_u64v_t & rOther)
530 {
531  copy(rOther);
532 }
533 
535 {
536  reset();
537 }
538 
539 llrp_u64v_t &
541  const llrp_u64v_t & rOther)
542 {
543  if(this != &rOther)
544  {
545  reset();
546  copy(rOther);
547  }
548 
549  return *this;
550 }
551 
552 void
553 llrp_u64v_t::reset(void)
554 {
555  if(NULL != m_pValue)
556  {
557  delete[] m_pValue;
558  m_pValue = NULL;
559  }
560  m_nValue = 0;
561 }
562 
563 void
564 llrp_u64v_t::copy (
565  const llrp_u64v_t & rOther)
566 {
567  m_nValue = rOther.m_nValue;
568  if(0 < m_nValue)
569  {
570  m_pValue = new llrp_u64_t[m_nValue];
571  memcpy(m_pValue, rOther.m_pValue, sizeof m_pValue[0] * m_nValue);
572  }
573  else
574  {
575  m_pValue = NULL;
576  }
577 }
578 
579 
580 
581 
582 
583 /*
584  * s64v
585  */
586 
588 {
589  m_pValue = NULL;
590  m_nValue = 0;
591 }
592 
594  unsigned int nValue)
595 {
596  m_nValue = nValue;
597  if(0 < m_nValue)
598  {
599  m_pValue = new llrp_s64_t[m_nValue];
600  memset(m_pValue, 0, sizeof m_pValue[0] * m_nValue);
601  }
602  else
603  {
604  m_pValue = NULL;
605  }
606 }
607 
609  const llrp_s64v_t & rOther)
610 {
611  copy(rOther);
612 }
613 
615 {
616  reset();
617 }
618 
619 llrp_s64v_t &
621  const llrp_s64v_t & rOther)
622 {
623  if(this != &rOther)
624  {
625  reset();
626  copy(rOther);
627  }
628 
629  return *this;
630 }
631 
632 void
633 llrp_s64v_t::reset(void)
634 {
635  if(NULL != m_pValue)
636  {
637  delete[] m_pValue;
638  m_pValue = NULL;
639  }
640  m_nValue = 0;
641 }
642 
643 void
644 llrp_s64v_t::copy (
645  const llrp_s64v_t & rOther)
646 {
647  m_nValue = rOther.m_nValue;
648  if(0 < m_nValue)
649  {
650  m_pValue = new llrp_s64_t[m_nValue];
651  memcpy(m_pValue, rOther.m_pValue, sizeof m_pValue[0] * m_nValue);
652  }
653  else
654  {
655  m_pValue = NULL;
656  }
657 }
658 
659 
660 
661 
662 
663 /*
664  * u1v
665  */
666 
668 {
669  m_pValue = NULL;
670  m_nBit = 0;
671 }
672 
674  unsigned int nBit)
675 {
676  m_nBit = nBit;
677  if(0 < m_nBit)
678  {
679  unsigned int nByte = (m_nBit + 7u) / 8u;
680 
681  m_pValue = new llrp_byte_t[nByte];
682  memset(m_pValue, 0, nByte);
683  }
684  else
685  {
686  m_pValue = NULL;
687  }
688 }
689 
691  const llrp_u1v_t & rOther)
692 {
693  copy(rOther);
694 }
695 
697 {
698  reset();
699 }
700 
701 llrp_u1v_t &
703  const llrp_u1v_t & rOther)
704 {
705  if(this != &rOther)
706  {
707  reset();
708  copy(rOther);
709  }
710 
711  return *this;
712 }
713 
714 void
715 llrp_u1v_t::reset(void)
716 {
717  if(NULL != m_pValue)
718  {
719  delete[] m_pValue;
720  m_pValue = NULL;
721  }
722  m_nBit = 0;
723 }
724 
725 void
726 llrp_u1v_t::copy (
727  const llrp_u1v_t & rOther)
728 {
729  m_nBit = rOther.m_nBit;
730  if(0 < m_nBit)
731  {
732  unsigned int nByte = (m_nBit + 7u) / 8u;
733 
734  m_pValue = new llrp_byte_t[nByte];
735  memcpy(m_pValue, rOther.m_pValue, nByte);
736  }
737  else
738  {
739  m_pValue = NULL;
740  }
741 }
742 
743 
744 
745 
746 
747 /*
748  * utf8v
749  */
750 
752 {
753  m_pValue = NULL;
754  m_nValue = 0;
755 }
756 
758  unsigned int nValue)
759 {
760  m_nValue = nValue;
761  if(0 < m_nValue)
762  {
763  m_pValue = new llrp_utf8_t[m_nValue];
764  memset(m_pValue, 0, sizeof m_pValue[0] * m_nValue);
765  }
766  else
767  {
768  m_pValue = NULL;
769  }
770 }
771 
773  const llrp_utf8v_t & rOther)
774 {
775  copy(rOther);
776 }
777 
779 {
780  reset();
781 }
782 
783 llrp_utf8v_t &
785  const llrp_utf8v_t & rOther)
786 {
787  if(this != &rOther)
788  {
789  reset();
790  copy(rOther);
791  }
792 
793  return *this;
794 }
795 
796 void
797 llrp_utf8v_t::reset(void)
798 {
799  if(NULL != m_pValue)
800  {
801  delete[] m_pValue;
802  m_pValue = NULL;
803  }
804  m_nValue = 0;
805 }
806 
807 void
808 llrp_utf8v_t::copy (
809  const llrp_utf8v_t & rOther)
810 {
811  m_nValue = rOther.m_nValue;
812  if(0 < m_nValue)
813  {
814  m_pValue = new llrp_utf8_t[m_nValue];
815  memcpy(m_pValue, rOther.m_pValue, sizeof m_pValue[0] * m_nValue);
816  }
817  else
818  {
819  m_pValue = NULL;
820  }
821 }
822 
823 
824 
825 
826 
827 /*
828  * bytesToEnd
829  */
830 
832 {
833  m_pValue = NULL;
834  m_nValue = 0;
835 }
836 
838  unsigned int nValue)
839 {
840  m_nValue = nValue;
841  if(0 < m_nValue)
842  {
843  m_pValue = new llrp_byte_t[m_nValue];
844  memset(m_pValue, 0, sizeof m_pValue[0] * m_nValue);
845  }
846  else
847  {
848  m_pValue = NULL;
849  }
850 }
851 
853  const llrp_bytesToEnd_t & rOther)
854 {
855  copy(rOther);
856 }
857 
859 {
860  reset();
861 }
862 
865  const llrp_bytesToEnd_t & rOther)
866 {
867  if(this != &rOther)
868  {
869  reset();
870  copy(rOther);
871  }
872 
873  return *this;
874 }
875 
876 void
877 llrp_bytesToEnd_t::reset(void)
878 {
879  if(NULL != m_pValue)
880  {
881  delete[] m_pValue;
882  m_pValue = NULL;
883  }
884  m_nValue = 0;
885 }
886 
887 void
888 llrp_bytesToEnd_t::copy (
889  const llrp_bytesToEnd_t & rOther)
890 {
891  m_nValue = rOther.m_nValue;
892  if(0 < m_nValue)
893  {
894  m_pValue = new llrp_byte_t[m_nValue];
895  memcpy(m_pValue, rOther.m_pValue, sizeof m_pValue[0] * m_nValue);
896  }
897  else
898  {
899  m_pValue = NULL;
900  }
901 }
902 
903 
904 
905 }; /* namespace LLRP */
906 
llrp_bytesToEnd_t & operator=(const llrp_bytesToEnd_t &rValue)
Assignement operator. Used to copy an existing instance.
llrp_u16v_t & operator=(const llrp_u16v_t &rValue)
Assignement operator. Used to copy an existing instance.
llrp_s64_t * m_pValue
Pointer to the first array element.
Definition: ltkcpp_base.h:400
llrp_u16_t m_nValue
The number of arrray elements.
Definition: ltkcpp_base.h:140
Class for LLRP basic type bytesToEnd (vector of unsigned bytes)
Definition: ltkcpp_base.h:523
llrp_u8_t * m_pValue
Pointer to the first array element.
Definition: ltkcpp_base.h:443
~llrp_s16v_t(void)
Destructor. Deletes m_pValue in cases where it is allocated.
Class for LLRP basic type s8v (List of signed 8-bit values)
Definition: ltkcpp_base.h:136
Class for LLRP basic type u16v (List of unsigned 16-bit values)
Definition: ltkcpp_base.h:179
llrp_s32_t * m_pValue
Pointer to the first array element.
Definition: ltkcpp_base.h:314
llrp_u8_t * m_pValue
Pointer to the first array element.
Definition: ltkcpp_base.h:99
llrp_s32v_t(void)
Default Constructer. Sets members fields to zero.
Based type descriptions for the LTKCPP library.
llrp_s8v_t(void)
Default Constructer. Sets members fields to zero.
llrp_utf8v_t & operator=(const llrp_utf8v_t &rValue)
Assignement operator. Used to copy an existing instance.
Class for LLRP basic type s32v (vector of signed 32-bit values)
Definition: ltkcpp_base.h:308
llrp_u16v_t(void)
Default Constructer. Sets members fields to zero.
Class for LLRP basic type s64v (vector of signed 64-bit values)
Definition: ltkcpp_base.h:394
llrp_s16v_t & operator=(const llrp_s16v_t &rValue)
Assignement operator. Used to copy an existing instance.
llrp_u16_t m_nValue
The number of arrray elements.
Definition: ltkcpp_base.h:398
llrp_u16_t m_nValue
The number of arrray elements.
Definition: ltkcpp_base.h:484
llrp_u16_t m_nValue
The number of arrray elements.
Definition: ltkcpp_base.h:355
llrp_s64v_t & operator=(const llrp_s64v_t &rValue)
Assignement operator. Used to copy an existing instance.
llrp_s16_t * m_pValue
Pointer to the first array element.
Definition: ltkcpp_base.h:228
llrp_utf8v_t(void)
Default Constructer. Sets members fields to zero.
Based types for the LKTCPP library.
~llrp_s32v_t(void)
Destructor. Deletes m_pValue in cases where it is allocated.
llrp_u32v_t & operator=(const llrp_u32v_t &rValue)
Assignement operator. Used to copy an existing instance.
llrp_u8v_t & operator=(const llrp_u8v_t &rValue)
Assignement operator. Used to copy an existing instance.
~llrp_u32v_t(void)
Destructor. Deletes m_pValue in cases where it is allocated.
~llrp_u8v_t(void)
Destructor. Deletes m_pValue in cases where it is allocated.
~llrp_utf8v_t(void)
Destructor. Deletes m_pValue in cases where it is allocated.
llrp_u16_t m_nValue
The number of arrray elements.
Definition: ltkcpp_base.h:312
llrp_u32v_t(void)
Default Constructer. Sets members fields to zero.
llrp_u16_t m_nValue
The number of arrray elements.
Definition: ltkcpp_base.h:183
llrp_u64_t * m_pValue
Pointer to the first array element.
Definition: ltkcpp_base.h:357
llrp_s32v_t & operator=(const llrp_s32v_t &rValue)
Assignement operator. Used to copy an existing instance.
~llrp_u16v_t(void)
Destructor. Deletes m_pValue in cases where it is allocated.
llrp_u64v_t & operator=(const llrp_u64v_t &rValue)
Assignement operator. Used to copy an existing instance.
Class for LLRP basic type s16v (List of signed 16-bit values)
Definition: ltkcpp_base.h:222
llrp_u16_t m_nValue
The number of arrray elements.
Definition: ltkcpp_base.h:226
Class for LLRP basic type utf8v (vector of utf-8 encoded characters)
Definition: ltkcpp_base.h:480
llrp_u16_t m_nBit
The number of arrray elements.
Definition: ltkcpp_base.h:441
Class for LLRP basic type u1v (vector of unsigned 1-bit values)
Definition: ltkcpp_base.h:437
llrp_s16v_t(void)
Default Constructer. Sets members fields to zero.
llrp_u16_t m_nValue
The number of arrray elements.
Definition: ltkcpp_base.h:269
llrp_u16_t m_nValue
The number of arrray elements.
Definition: ltkcpp_base.h:527
llrp_s64v_t(void)
Default Constructer. Sets members fields to zero.
llrp_u1v_t & operator=(const llrp_u1v_t &rValue)
Assignement operator. Used to copy an existing instance.
~llrp_s8v_t(void)
Destructor. Deletes m_pValue in cases where it is allocated.
~llrp_s64v_t(void)
Destructor. Deletes m_pValue in cases where it is allocated.
~llrp_u64v_t(void)
Destructor. Deletes m_pValue in cases where it is allocated.
llrp_u1v_t(void)
Default Constructer. Sets members fields to zero.
llrp_u16_t m_nValue
The number of arrray elements.
Definition: ltkcpp_base.h:97
llrp_u16_t * m_pValue
Pointer to the first array element.
Definition: ltkcpp_base.h:185
~llrp_bytesToEnd_t(void)
Destructor. Deletes m_pValue in cases where it is allocated.
llrp_s8v_t & operator=(const llrp_s8v_t &rValue)
Assignement operator. Used to copy an existing instance.
llrp_byte_t * m_pValue
Pointer to the first array element.
Definition: ltkcpp_base.h:529
Class for LLRP basic type u8v (List of unsigned 8-bit values)
Definition: ltkcpp_base.h:93
Definition: ltkcpp.h:45
Class for LLRP basic type u32v (vector of unsigned 32-bit values)
Definition: ltkcpp_base.h:265
llrp_u32_t * m_pValue
Pointer to the first array element.
Definition: ltkcpp_base.h:271
llrp_u8v_t(void)
Default Constructer. Sets members fields to zero.
llrp_s8_t * m_pValue
Pointer to the first array element.
Definition: ltkcpp_base.h:142
Class for LLRP basic type u64v (vector of unsigned 64-bit values)
Definition: ltkcpp_base.h:351
~llrp_u1v_t(void)
Destructor. Deletes m_pValue in cases where it is allocated.
llrp_utf8_t * m_pValue
Pointer to the first array element.
Definition: ltkcpp_base.h:486
llrp_bytesToEnd_t(void)
Default Constructer. Sets members fields to zero.
llrp_u64v_t(void)
Default Constructer. Sets members fields to zero.