LTKCPP-- LLRP Toolkit C Plus Plus Library
|
00001 00002 /* 00003 ***************************************************************************** 00004 * * 00005 * IMPINJ CONFIDENTIAL AND PROPRIETARY * 00006 * * 00007 * This source code is the sole property of Impinj, Inc. Reproduction or * 00008 * utilization of this source code in whole or in part is forbidden without * 00009 * the prior written consent of Impinj, Inc. * 00010 * * 00011 * (c) Copyright Impinj, Inc. 2007,2008. All rights reserved. * 00012 * * 00013 *****************************************************************************/ 00014 00015 00016 #include "ltkcpp_platform.h" 00017 #include "ltkcpp_base.h" 00018 00019 00020 namespace LLRP 00021 { 00022 00023 /* 00024 * u8v 00025 */ 00026 00027 llrp_u8v_t::llrp_u8v_t (void) 00028 { 00029 m_pValue = NULL; 00030 m_nValue = 0; 00031 } 00032 00033 llrp_u8v_t::llrp_u8v_t ( 00034 unsigned int nValue) 00035 { 00036 m_nValue = nValue; 00037 if(0 < m_nValue) 00038 { 00039 m_pValue = new llrp_u8_t[m_nValue]; 00040 memset(m_pValue, 0, sizeof m_pValue[0] * m_nValue); 00041 } 00042 else 00043 { 00044 m_pValue = NULL; 00045 } 00046 } 00047 00048 llrp_u8v_t::llrp_u8v_t ( 00049 const llrp_u8v_t & rOther) 00050 { 00051 copy(rOther); 00052 } 00053 00054 llrp_u8v_t::~llrp_u8v_t (void) 00055 { 00056 reset(); 00057 } 00058 00059 llrp_u8v_t & 00060 llrp_u8v_t::operator= ( 00061 const llrp_u8v_t & rOther) 00062 { 00063 if(this != &rOther) 00064 { 00065 reset(); 00066 copy(rOther); 00067 } 00068 00069 return *this; 00070 } 00071 00072 void 00073 llrp_u8v_t::reset(void) 00074 { 00075 if(NULL != m_pValue) 00076 { 00077 delete[] m_pValue; 00078 m_pValue = NULL; 00079 } 00080 m_nValue = 0; 00081 } 00082 00083 void 00084 llrp_u8v_t::copy ( 00085 const llrp_u8v_t & rOther) 00086 { 00087 m_nValue = rOther.m_nValue; 00088 if(0 < m_nValue) 00089 { 00090 m_pValue = new llrp_u8_t[m_nValue]; 00091 memcpy(m_pValue, rOther.m_pValue, sizeof m_pValue[0] * m_nValue); 00092 } 00093 else 00094 { 00095 m_pValue = NULL; 00096 } 00097 } 00098 00099 00100 00101 00102 00103 /* 00104 * s8v 00105 */ 00106 00107 llrp_s8v_t::llrp_s8v_t (void) 00108 { 00109 m_pValue = NULL; 00110 m_nValue = 0; 00111 } 00112 00113 llrp_s8v_t::llrp_s8v_t ( 00114 unsigned int nValue) 00115 { 00116 m_nValue = nValue; 00117 if(0 < m_nValue) 00118 { 00119 m_pValue = new llrp_s8_t[m_nValue]; 00120 memset(m_pValue, 0, sizeof m_pValue[0] * m_nValue); 00121 } 00122 else 00123 { 00124 m_pValue = NULL; 00125 } 00126 } 00127 00128 llrp_s8v_t::llrp_s8v_t ( 00129 const llrp_s8v_t & rOther) 00130 { 00131 copy(rOther); 00132 } 00133 00134 llrp_s8v_t::~llrp_s8v_t (void) 00135 { 00136 reset(); 00137 } 00138 00139 llrp_s8v_t & 00140 llrp_s8v_t::operator= ( 00141 const llrp_s8v_t & rOther) 00142 { 00143 if(this != &rOther) 00144 { 00145 reset(); 00146 copy(rOther); 00147 } 00148 00149 return *this; 00150 } 00151 00152 void 00153 llrp_s8v_t::reset(void) 00154 { 00155 if(NULL != m_pValue) 00156 { 00157 delete[] m_pValue; 00158 m_pValue = NULL; 00159 } 00160 m_nValue = 0; 00161 } 00162 00163 void 00164 llrp_s8v_t::copy ( 00165 const llrp_s8v_t & rOther) 00166 { 00167 m_nValue = rOther.m_nValue; 00168 if(0 < m_nValue) 00169 { 00170 m_pValue = new llrp_s8_t[m_nValue]; 00171 memcpy(m_pValue, rOther.m_pValue, sizeof m_pValue[0] * m_nValue); 00172 } 00173 else 00174 { 00175 m_pValue = NULL; 00176 } 00177 } 00178 00179 00180 00181 00182 00183 /* 00184 * u16v 00185 */ 00186 00187 llrp_u16v_t::llrp_u16v_t (void) 00188 { 00189 m_pValue = NULL; 00190 m_nValue = 0; 00191 } 00192 00193 llrp_u16v_t::llrp_u16v_t ( 00194 unsigned int nValue) 00195 { 00196 m_nValue = nValue; 00197 if(0 < m_nValue) 00198 { 00199 m_pValue = new llrp_u16_t[m_nValue]; 00200 memset(m_pValue, 0, sizeof m_pValue[0] * m_nValue); 00201 } 00202 else 00203 { 00204 m_pValue = NULL; 00205 } 00206 } 00207 00208 llrp_u16v_t::llrp_u16v_t ( 00209 const llrp_u16v_t & rOther) 00210 { 00211 copy(rOther); 00212 } 00213 00214 llrp_u16v_t::~llrp_u16v_t (void) 00215 { 00216 reset(); 00217 } 00218 00219 llrp_u16v_t & 00220 llrp_u16v_t::operator= ( 00221 const llrp_u16v_t & rOther) 00222 { 00223 if(this != &rOther) 00224 { 00225 reset(); 00226 copy(rOther); 00227 } 00228 00229 return *this; 00230 } 00231 00232 void 00233 llrp_u16v_t::reset(void) 00234 { 00235 if(NULL != m_pValue) 00236 { 00237 delete[] m_pValue; 00238 m_pValue = NULL; 00239 } 00240 m_nValue = 0; 00241 } 00242 00243 void 00244 llrp_u16v_t::copy ( 00245 const llrp_u16v_t & rOther) 00246 { 00247 m_nValue = rOther.m_nValue; 00248 if(0 < m_nValue) 00249 { 00250 m_pValue = new llrp_u16_t[m_nValue]; 00251 memcpy(m_pValue, rOther.m_pValue, sizeof m_pValue[0] * m_nValue); 00252 } 00253 else 00254 { 00255 m_pValue = NULL; 00256 } 00257 } 00258 00259 00260 00261 00262 00263 /* 00264 * s16v 00265 */ 00266 00267 llrp_s16v_t::llrp_s16v_t (void) 00268 { 00269 m_pValue = NULL; 00270 m_nValue = 0; 00271 } 00272 00273 llrp_s16v_t::llrp_s16v_t ( 00274 unsigned int nValue) 00275 { 00276 m_nValue = nValue; 00277 if(0 < m_nValue) 00278 { 00279 m_pValue = new llrp_s16_t[m_nValue]; 00280 memset(m_pValue, 0, sizeof m_pValue[0] * m_nValue); 00281 } 00282 else 00283 { 00284 m_pValue = NULL; 00285 } 00286 } 00287 00288 llrp_s16v_t::llrp_s16v_t ( 00289 const llrp_s16v_t & rOther) 00290 { 00291 copy(rOther); 00292 } 00293 00294 llrp_s16v_t::~llrp_s16v_t (void) 00295 { 00296 reset(); 00297 } 00298 00299 llrp_s16v_t & 00300 llrp_s16v_t::operator= ( 00301 const llrp_s16v_t & rOther) 00302 { 00303 if(this != &rOther) 00304 { 00305 reset(); 00306 copy(rOther); 00307 } 00308 00309 return *this; 00310 } 00311 00312 void 00313 llrp_s16v_t::reset(void) 00314 { 00315 if(NULL != m_pValue) 00316 { 00317 delete[] m_pValue; 00318 m_pValue = NULL; 00319 } 00320 m_nValue = 0; 00321 } 00322 00323 void 00324 llrp_s16v_t::copy ( 00325 const llrp_s16v_t & rOther) 00326 { 00327 m_nValue = rOther.m_nValue; 00328 if(0 < m_nValue) 00329 { 00330 m_pValue = new llrp_s16_t[m_nValue]; 00331 memcpy(m_pValue, rOther.m_pValue, sizeof m_pValue[0] * m_nValue); 00332 } 00333 else 00334 { 00335 m_pValue = NULL; 00336 } 00337 } 00338 00339 00340 00341 00342 00343 /* 00344 * u32v 00345 */ 00346 00347 llrp_u32v_t::llrp_u32v_t (void) 00348 { 00349 m_pValue = NULL; 00350 m_nValue = 0; 00351 } 00352 00353 llrp_u32v_t::llrp_u32v_t ( 00354 unsigned int nValue) 00355 { 00356 m_nValue = nValue; 00357 if(0 < m_nValue) 00358 { 00359 m_pValue = new llrp_u32_t[m_nValue]; 00360 memset(m_pValue, 0, sizeof m_pValue[0] * m_nValue); 00361 } 00362 else 00363 { 00364 m_pValue = NULL; 00365 } 00366 } 00367 00368 llrp_u32v_t::llrp_u32v_t ( 00369 const llrp_u32v_t & rOther) 00370 { 00371 copy(rOther); 00372 } 00373 00374 llrp_u32v_t::~llrp_u32v_t (void) 00375 { 00376 reset(); 00377 } 00378 00379 llrp_u32v_t & 00380 llrp_u32v_t::operator= ( 00381 const llrp_u32v_t & rOther) 00382 { 00383 if(this != &rOther) 00384 { 00385 reset(); 00386 copy(rOther); 00387 } 00388 00389 return *this; 00390 } 00391 00392 void 00393 llrp_u32v_t::reset(void) 00394 { 00395 if(NULL != m_pValue) 00396 { 00397 delete[] m_pValue; 00398 m_pValue = NULL; 00399 } 00400 m_nValue = 0; 00401 } 00402 00403 void 00404 llrp_u32v_t::copy ( 00405 const llrp_u32v_t & rOther) 00406 { 00407 m_nValue = rOther.m_nValue; 00408 if(0 < m_nValue) 00409 { 00410 m_pValue = new llrp_u32_t[m_nValue]; 00411 memcpy(m_pValue, rOther.m_pValue, sizeof m_pValue[0] * m_nValue); 00412 } 00413 else 00414 { 00415 m_pValue = NULL; 00416 } 00417 } 00418 00419 00420 00421 00422 00423 /* 00424 * s32v 00425 */ 00426 00427 llrp_s32v_t::llrp_s32v_t (void) 00428 { 00429 m_pValue = NULL; 00430 m_nValue = 0; 00431 } 00432 00433 llrp_s32v_t::llrp_s32v_t ( 00434 unsigned int nValue) 00435 { 00436 m_nValue = nValue; 00437 if(0 < m_nValue) 00438 { 00439 m_pValue = new llrp_s32_t[m_nValue]; 00440 memset(m_pValue, 0, sizeof m_pValue[0] * m_nValue); 00441 } 00442 else 00443 { 00444 m_pValue = NULL; 00445 } 00446 } 00447 00448 llrp_s32v_t::llrp_s32v_t ( 00449 const llrp_s32v_t & rOther) 00450 { 00451 copy(rOther); 00452 } 00453 00454 llrp_s32v_t::~llrp_s32v_t (void) 00455 { 00456 reset(); 00457 } 00458 00459 llrp_s32v_t & 00460 llrp_s32v_t::operator= ( 00461 const llrp_s32v_t & rOther) 00462 { 00463 if(this != &rOther) 00464 { 00465 reset(); 00466 copy(rOther); 00467 } 00468 00469 return *this; 00470 } 00471 00472 void 00473 llrp_s32v_t::reset(void) 00474 { 00475 if(NULL != m_pValue) 00476 { 00477 delete[] m_pValue; 00478 m_pValue = NULL; 00479 } 00480 m_nValue = 0; 00481 } 00482 00483 void 00484 llrp_s32v_t::copy ( 00485 const llrp_s32v_t & rOther) 00486 { 00487 m_nValue = rOther.m_nValue; 00488 if(0 < m_nValue) 00489 { 00490 m_pValue = new llrp_s32_t[m_nValue]; 00491 memcpy(m_pValue, rOther.m_pValue, sizeof m_pValue[0] * m_nValue); 00492 } 00493 else 00494 { 00495 m_pValue = NULL; 00496 } 00497 } 00498 00499 00500 00501 00502 00503 /* 00504 * u64v 00505 */ 00506 00507 llrp_u64v_t::llrp_u64v_t (void) 00508 { 00509 m_pValue = NULL; 00510 m_nValue = 0; 00511 } 00512 00513 llrp_u64v_t::llrp_u64v_t ( 00514 unsigned int nValue) 00515 { 00516 m_nValue = nValue; 00517 if(0 < m_nValue) 00518 { 00519 m_pValue = new llrp_u64_t[m_nValue]; 00520 memset(m_pValue, 0, sizeof m_pValue[0] * m_nValue); 00521 } 00522 else 00523 { 00524 m_pValue = NULL; 00525 } 00526 } 00527 00528 llrp_u64v_t::llrp_u64v_t ( 00529 const llrp_u64v_t & rOther) 00530 { 00531 copy(rOther); 00532 } 00533 00534 llrp_u64v_t::~llrp_u64v_t (void) 00535 { 00536 reset(); 00537 } 00538 00539 llrp_u64v_t & 00540 llrp_u64v_t::operator= ( 00541 const llrp_u64v_t & rOther) 00542 { 00543 if(this != &rOther) 00544 { 00545 reset(); 00546 copy(rOther); 00547 } 00548 00549 return *this; 00550 } 00551 00552 void 00553 llrp_u64v_t::reset(void) 00554 { 00555 if(NULL != m_pValue) 00556 { 00557 delete[] m_pValue; 00558 m_pValue = NULL; 00559 } 00560 m_nValue = 0; 00561 } 00562 00563 void 00564 llrp_u64v_t::copy ( 00565 const llrp_u64v_t & rOther) 00566 { 00567 m_nValue = rOther.m_nValue; 00568 if(0 < m_nValue) 00569 { 00570 m_pValue = new llrp_u64_t[m_nValue]; 00571 memcpy(m_pValue, rOther.m_pValue, sizeof m_pValue[0] * m_nValue); 00572 } 00573 else 00574 { 00575 m_pValue = NULL; 00576 } 00577 } 00578 00579 00580 00581 00582 00583 /* 00584 * s64v 00585 */ 00586 00587 llrp_s64v_t::llrp_s64v_t (void) 00588 { 00589 m_pValue = NULL; 00590 m_nValue = 0; 00591 } 00592 00593 llrp_s64v_t::llrp_s64v_t ( 00594 unsigned int nValue) 00595 { 00596 m_nValue = nValue; 00597 if(0 < m_nValue) 00598 { 00599 m_pValue = new llrp_s64_t[m_nValue]; 00600 memset(m_pValue, 0, sizeof m_pValue[0] * m_nValue); 00601 } 00602 else 00603 { 00604 m_pValue = NULL; 00605 } 00606 } 00607 00608 llrp_s64v_t::llrp_s64v_t ( 00609 const llrp_s64v_t & rOther) 00610 { 00611 copy(rOther); 00612 } 00613 00614 llrp_s64v_t::~llrp_s64v_t (void) 00615 { 00616 reset(); 00617 } 00618 00619 llrp_s64v_t & 00620 llrp_s64v_t::operator= ( 00621 const llrp_s64v_t & rOther) 00622 { 00623 if(this != &rOther) 00624 { 00625 reset(); 00626 copy(rOther); 00627 } 00628 00629 return *this; 00630 } 00631 00632 void 00633 llrp_s64v_t::reset(void) 00634 { 00635 if(NULL != m_pValue) 00636 { 00637 delete[] m_pValue; 00638 m_pValue = NULL; 00639 } 00640 m_nValue = 0; 00641 } 00642 00643 void 00644 llrp_s64v_t::copy ( 00645 const llrp_s64v_t & rOther) 00646 { 00647 m_nValue = rOther.m_nValue; 00648 if(0 < m_nValue) 00649 { 00650 m_pValue = new llrp_s64_t[m_nValue]; 00651 memcpy(m_pValue, rOther.m_pValue, sizeof m_pValue[0] * m_nValue); 00652 } 00653 else 00654 { 00655 m_pValue = NULL; 00656 } 00657 } 00658 00659 00660 00661 00662 00663 /* 00664 * u1v 00665 */ 00666 00667 llrp_u1v_t::llrp_u1v_t (void) 00668 { 00669 m_pValue = NULL; 00670 m_nBit = 0; 00671 } 00672 00673 llrp_u1v_t::llrp_u1v_t ( 00674 unsigned int nBit) 00675 { 00676 m_nBit = nBit; 00677 if(0 < m_nBit) 00678 { 00679 unsigned int nByte = (m_nBit + 7u) / 8u; 00680 00681 m_pValue = new llrp_byte_t[nByte]; 00682 memset(m_pValue, 0, nByte); 00683 } 00684 else 00685 { 00686 m_pValue = NULL; 00687 } 00688 } 00689 00690 llrp_u1v_t::llrp_u1v_t ( 00691 const llrp_u1v_t & rOther) 00692 { 00693 copy(rOther); 00694 } 00695 00696 llrp_u1v_t::~llrp_u1v_t (void) 00697 { 00698 reset(); 00699 } 00700 00701 llrp_u1v_t & 00702 llrp_u1v_t::operator= ( 00703 const llrp_u1v_t & rOther) 00704 { 00705 if(this != &rOther) 00706 { 00707 reset(); 00708 copy(rOther); 00709 } 00710 00711 return *this; 00712 } 00713 00714 void 00715 llrp_u1v_t::reset(void) 00716 { 00717 if(NULL != m_pValue) 00718 { 00719 delete[] m_pValue; 00720 m_pValue = NULL; 00721 } 00722 m_nBit = 0; 00723 } 00724 00725 void 00726 llrp_u1v_t::copy ( 00727 const llrp_u1v_t & rOther) 00728 { 00729 m_nBit = rOther.m_nBit; 00730 if(0 < m_nBit) 00731 { 00732 unsigned int nByte = (m_nBit + 7u) / 8u; 00733 00734 m_pValue = new llrp_byte_t[nByte]; 00735 memcpy(m_pValue, rOther.m_pValue, nByte); 00736 } 00737 else 00738 { 00739 m_pValue = NULL; 00740 } 00741 } 00742 00743 00744 00745 00746 00747 /* 00748 * utf8v 00749 */ 00750 00751 llrp_utf8v_t::llrp_utf8v_t (void) 00752 { 00753 m_pValue = NULL; 00754 m_nValue = 0; 00755 } 00756 00757 llrp_utf8v_t::llrp_utf8v_t ( 00758 unsigned int nValue) 00759 { 00760 m_nValue = nValue; 00761 if(0 < m_nValue) 00762 { 00763 m_pValue = new llrp_utf8_t[m_nValue]; 00764 memset(m_pValue, 0, sizeof m_pValue[0] * m_nValue); 00765 } 00766 else 00767 { 00768 m_pValue = NULL; 00769 } 00770 } 00771 00772 llrp_utf8v_t::llrp_utf8v_t ( 00773 const llrp_utf8v_t & rOther) 00774 { 00775 copy(rOther); 00776 } 00777 00778 llrp_utf8v_t::~llrp_utf8v_t (void) 00779 { 00780 reset(); 00781 } 00782 00783 llrp_utf8v_t & 00784 llrp_utf8v_t::operator= ( 00785 const llrp_utf8v_t & rOther) 00786 { 00787 if(this != &rOther) 00788 { 00789 reset(); 00790 copy(rOther); 00791 } 00792 00793 return *this; 00794 } 00795 00796 void 00797 llrp_utf8v_t::reset(void) 00798 { 00799 if(NULL != m_pValue) 00800 { 00801 delete[] m_pValue; 00802 m_pValue = NULL; 00803 } 00804 m_nValue = 0; 00805 } 00806 00807 void 00808 llrp_utf8v_t::copy ( 00809 const llrp_utf8v_t & rOther) 00810 { 00811 m_nValue = rOther.m_nValue; 00812 if(0 < m_nValue) 00813 { 00814 m_pValue = new llrp_utf8_t[m_nValue]; 00815 memcpy(m_pValue, rOther.m_pValue, sizeof m_pValue[0] * m_nValue); 00816 } 00817 else 00818 { 00819 m_pValue = NULL; 00820 } 00821 } 00822 00823 00824 00825 00826 00827 /* 00828 * bytesToEnd 00829 */ 00830 00831 llrp_bytesToEnd_t::llrp_bytesToEnd_t (void) 00832 { 00833 m_pValue = NULL; 00834 m_nValue = 0; 00835 } 00836 00837 llrp_bytesToEnd_t::llrp_bytesToEnd_t ( 00838 unsigned int nValue) 00839 { 00840 m_nValue = nValue; 00841 if(0 < m_nValue) 00842 { 00843 m_pValue = new llrp_byte_t[m_nValue]; 00844 memset(m_pValue, 0, sizeof m_pValue[0] * m_nValue); 00845 } 00846 else 00847 { 00848 m_pValue = NULL; 00849 } 00850 } 00851 00852 llrp_bytesToEnd_t::llrp_bytesToEnd_t ( 00853 const llrp_bytesToEnd_t & rOther) 00854 { 00855 copy(rOther); 00856 } 00857 00858 llrp_bytesToEnd_t::~llrp_bytesToEnd_t (void) 00859 { 00860 reset(); 00861 } 00862 00863 llrp_bytesToEnd_t & 00864 llrp_bytesToEnd_t::operator= ( 00865 const llrp_bytesToEnd_t & rOther) 00866 { 00867 if(this != &rOther) 00868 { 00869 reset(); 00870 copy(rOther); 00871 } 00872 00873 return *this; 00874 } 00875 00876 void 00877 llrp_bytesToEnd_t::reset(void) 00878 { 00879 if(NULL != m_pValue) 00880 { 00881 delete[] m_pValue; 00882 m_pValue = NULL; 00883 } 00884 m_nValue = 0; 00885 } 00886 00887 void 00888 llrp_bytesToEnd_t::copy ( 00889 const llrp_bytesToEnd_t & rOther) 00890 { 00891 m_nValue = rOther.m_nValue; 00892 if(0 < m_nValue) 00893 { 00894 m_pValue = new llrp_byte_t[m_nValue]; 00895 memcpy(m_pValue, rOther.m_pValue, sizeof m_pValue[0] * m_nValue); 00896 } 00897 else 00898 { 00899 m_pValue = NULL; 00900 } 00901 } 00902 00903 00904 00905 }; /* namespace LLRP */ 00906