Main Page | Modules | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members

ltkcpp_array.cpp

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

Generated on Wed Nov 26 12:27:44 2008 for LTKCPP-- LLRP Toolkit C Plus Plus Library by  doxygen 1.3.9.1