ltkcpp_base.h

Go to the documentation of this file.
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 
00035 #define LTKCPP_VERSION      0x0A1000F0
00036 #define LTKCPP_VERSION_STR  "10.16.0.240"
00037 
00043 #define BOOL int
00044 
00050 namespace LLRP
00051 {
00052 
00053 /*
00054  * Forward declarations of structs and classes
00055  */
00056 
00057 //enum EResultCode;
00058 class CErrorDetails;
00059 class CVendorDescriptor;
00060 class CNamespaceDescriptor;
00061 class CTypeDescriptor;
00062 class CFieldDescriptor;
00063 struct SEnumTableEntry;
00064 class CTypeRegistry;
00065 class CElement;
00066 class CMessage;
00067 class CParameter;
00068 class CDecoder;
00069 class CDecoderStream;
00070 class CEncoder;
00071 class CEncoderStream;
00072 
00073 
00074 /*
00075  * Simple array (vector) types. There is an array type
00076  * for each of {u,s}{8,16,32,64}v and u1v and utf8v.
00077  *
00078  * The member variables are:
00079  *      m_nValue            The number of array elements
00080  *      m_pValue            Pointer to the first element
00081  *
00082  * The interfaces:
00083  *      llrp_XXv_t(void)    Default constructor, just sets the
00084  *                          member fields to zero.
00085  *      llrp_XXv_t(llrp_XXv_t & rOther)
00086  *                          Constructor that clones an existing object.
00087  *      ~llrp_XXv_t(void)   Destructor, just deletes m_pValue in case
00088  *                          there is something allocated to it.
00089  *      operator=           Assignment operator. Used to copy an
00090  *                          existing instance. It's careful
00091  *                          to delete m_pValue before overwriting it.
00092  *
00093  * Private subroutines
00094  *      copy()              Makes a copy, supports operator=
00095  *      reset()             Clears the variable much like the
00096  *                          destructor does.
00097  */
00098 
00106 class llrp_u8v_t
00107 {
00108   public:
00110     llrp_u16_t                  m_nValue;
00112     llrp_u8_t *                 m_pValue;
00113 
00115     llrp_u8v_t(void);
00116 
00118     llrp_u8v_t (
00119       unsigned int              nValue);
00120 
00122     llrp_u8v_t (
00123       const llrp_u8v_t &        rOther);
00124 
00126     ~llrp_u8v_t(void);
00127 
00129     llrp_u8v_t &
00130     operator= (
00131       const llrp_u8v_t &        rValue);
00132 
00133   private:
00134     void
00135     copy (
00136       const llrp_u8v_t &        rOther);
00137 
00138     void
00139     reset (void);
00140 };
00141 
00149 class llrp_s8v_t
00150 {
00151   public:
00153     llrp_u16_t                  m_nValue;
00155     llrp_s8_t *                 m_pValue;
00156 
00158     llrp_s8v_t(void);
00159 
00161     llrp_s8v_t (
00162       unsigned int              nValue);
00163 
00165     llrp_s8v_t (
00166       const llrp_s8v_t &        rOther);
00167 
00169     ~llrp_s8v_t(void);
00170 
00172     llrp_s8v_t &
00173     operator= (
00174       const llrp_s8v_t &        rValue);
00175 
00176   private:
00177     void
00178     copy (
00179       const llrp_s8v_t &        rOther);
00180 
00181     void
00182     reset (void);
00183 };
00184 
00192 class llrp_u16v_t
00193 {
00194   public:
00196     llrp_u16_t                  m_nValue;
00198     llrp_u16_t *                m_pValue;
00199 
00201     llrp_u16v_t(void);
00202 
00204     llrp_u16v_t (
00205       unsigned int              nValue);
00206 
00208     llrp_u16v_t (
00209       const llrp_u16v_t &       rOther);
00210 
00212     ~llrp_u16v_t(void);
00213 
00215     llrp_u16v_t &
00216     operator= (
00217       const llrp_u16v_t &       rValue);
00218 
00219   private:
00220     void
00221     copy (
00222       const llrp_u16v_t &       rOther);
00223 
00224     void
00225     reset (void);
00226 };
00227 
00235 class llrp_s16v_t
00236 {
00237   public:
00239     llrp_u16_t                  m_nValue;
00241     llrp_s16_t *                m_pValue;
00242 
00244     llrp_s16v_t(void);
00245 
00247     llrp_s16v_t (
00248       unsigned int              nValue);
00249 
00251     llrp_s16v_t (
00252       const llrp_s16v_t &       rOther);
00253 
00255     ~llrp_s16v_t(void);
00256 
00258     llrp_s16v_t &
00259     operator= (
00260       const llrp_s16v_t &       rValue);
00261 
00262   private:
00263     void
00264     copy (
00265       const llrp_s16v_t &       rOther);
00266 
00267     void
00268     reset (void);
00269 };
00270 
00278 class llrp_u32v_t
00279 {
00280   public:
00282     llrp_u16_t                  m_nValue;
00284     llrp_u32_t *                m_pValue;
00285 
00287     llrp_u32v_t(void);
00288 
00290     llrp_u32v_t (
00291       unsigned int              nValue);
00292 
00294     llrp_u32v_t (
00295       const llrp_u32v_t &       rOther);
00296 
00298     ~llrp_u32v_t(void);
00299 
00301     llrp_u32v_t &
00302     operator= (
00303       const llrp_u32v_t &       rValue);
00304 
00305   private:
00306     void
00307     copy (
00308       const llrp_u32v_t &       rOther);
00309 
00310     void
00311     reset (void);
00312 };
00313 
00321 class llrp_s32v_t
00322 {
00323   public:
00325     llrp_u16_t                  m_nValue;
00327     llrp_s32_t *                m_pValue;
00328 
00330     llrp_s32v_t(void);
00331 
00333     llrp_s32v_t (
00334       unsigned int              nValue);
00335 
00337     llrp_s32v_t (
00338       const llrp_s32v_t &       rOther);
00339 
00341     ~llrp_s32v_t(void);
00342 
00344     llrp_s32v_t &
00345     operator= (
00346       const llrp_s32v_t &       rValue);
00347 
00348   private:
00349     void
00350     copy (
00351       const llrp_s32v_t &       rOther);
00352 
00353     void
00354     reset (void);
00355 };
00356 
00364 class llrp_u64v_t
00365 {
00366   public:
00368     llrp_u16_t                  m_nValue;
00370     llrp_u64_t *                m_pValue;
00371 
00373     llrp_u64v_t(void);
00374 
00376     llrp_u64v_t (
00377       unsigned int              nValue);
00378 
00380     llrp_u64v_t (
00381       const llrp_u64v_t &       rOther);
00382 
00384     ~llrp_u64v_t(void);
00385 
00387     llrp_u64v_t &
00388     operator= (
00389       const llrp_u64v_t &       rValue);
00390 
00391   private:
00392     void
00393     copy (
00394       const llrp_u64v_t &       rOther);
00395 
00396     void
00397     reset (void);
00398 };
00399 
00407 class llrp_s64v_t
00408 {
00409   public:
00411     llrp_u16_t                  m_nValue;
00413     llrp_s64_t *                m_pValue;
00414 
00416     llrp_s64v_t(void);
00417 
00419     llrp_s64v_t (
00420       unsigned int              nValue);
00421 
00423     llrp_s64v_t (
00424       const llrp_s64v_t &       rOther);
00425 
00427     ~llrp_s64v_t(void);
00428 
00430     llrp_s64v_t &
00431     operator= (
00432       const llrp_s64v_t &       rValue);
00433 
00434   private:
00435     void
00436     copy (
00437       const llrp_s64v_t &       rOther);
00438 
00439     void
00440     reset (void);
00441 };
00442 
00450 class llrp_u1v_t
00451 {
00452   public:
00454     llrp_u16_t                  m_nBit;
00456     llrp_u8_t *                 m_pValue;
00457 
00459     llrp_u1v_t(void);
00460 
00462     llrp_u1v_t (
00463       unsigned int              nBit);
00464 
00466     llrp_u1v_t (
00467       const llrp_u1v_t &        rOther);
00468 
00470     ~llrp_u1v_t(void);
00471 
00473     llrp_u1v_t &
00474     operator= (
00475       const llrp_u1v_t &        rValue);
00476 
00477   private:
00478     void
00479     copy (
00480       const llrp_u1v_t &        rOther);
00481 
00482     void
00483     reset (void);
00484 };
00485 
00493 class llrp_utf8v_t
00494 {
00495   public:
00497     llrp_u16_t                  m_nValue;
00499     llrp_utf8_t *               m_pValue;
00500 
00502     llrp_utf8v_t(void);
00503 
00505     llrp_utf8v_t (
00506       unsigned int              nValue);
00507 
00509     llrp_utf8v_t (
00510       const llrp_utf8v_t &      rOther);
00511 
00513     ~llrp_utf8v_t(void);
00514 
00516     llrp_utf8v_t &
00517     operator= (
00518       const llrp_utf8v_t &      rValue);
00519 
00520   private:
00521     void
00522     copy (
00523       const llrp_utf8v_t &      rOther);
00524 
00525     void
00526     reset (void);
00527 };
00528 
00536 class llrp_bytesToEnd_t
00537 {
00538   public:
00540     llrp_u16_t                  m_nValue;
00542     llrp_byte_t *               m_pValue;
00543 
00545     llrp_bytesToEnd_t(void);
00546 
00548     llrp_bytesToEnd_t (
00549       unsigned int              nValue);
00550 
00552     llrp_bytesToEnd_t (
00553       const llrp_bytesToEnd_t & rOther);
00554 
00556     ~llrp_bytesToEnd_t(void);
00557 
00559     llrp_bytesToEnd_t &
00560     operator= (
00561       const llrp_bytesToEnd_t & rValue);
00562 
00563   private:
00564     void
00565     copy (
00566       const llrp_bytesToEnd_t & rOther);
00567 
00568     void
00569     reset (void);
00570 };
00571 
00579 class llrp_u96_t
00580 {
00581   public:
00583     llrp_u8_t                   m_aValue[12];
00584 };
00585 
00586 
00596 enum EResultCode
00597 {
00598     RC_OK                       = 0,   
00599     RC_MiscError                = 100, 
00600     RC_Botch,                          
00601     RC_SendIOError,                    
00602     RC_RecvIOError,                    
00603     RC_RecvEOF,                        
00604     RC_RecvTimeout,                    
00605     RC_RecvFramingError,               
00606     RC_RecvBufferOverflow,             
00607     RC_BadVersion,                     
00608     RC_MissingResponseType,            
00609     RC_UnknownMessageType,             
00610     RC_UnknownParameterType,           
00611     RC_ExcessiveLength,                
00612     RC_InvalidLength,                  
00613     RC_FieldUnderrun,                  
00614     RC_ReservedBitsUnderrun,           
00615     RC_FieldOverrun,                   
00616     RC_ReservedBitsOverrun,            
00617     RC_UnalignedBitField,              
00618     RC_UnalignedReservedBits,          
00619     RC_MessageAllocationFailed,        
00620     RC_ParameterAllocationFailed,      
00621     RC_FieldAllocationFailed,          
00622     RC_ExtraBytes,                     
00623     RC_MissingParameter,               
00624     RC_UnexpectedParameter,            
00625     RC_InvalidChoiceMember,            
00626     RC_EnrollBadTypeNumber,            
00627     RC_NotAllowedAtExtensionPoint,     
00628     RC_XMLInvalidNodeType,             
00629     RC_XMLMissingField,                
00630     RC_XMLExtraNode,                   
00631     RC_XMLInvalidFieldCharacters,      
00632     RC_XMLOutOfRange,                  
00633 };
00634 
00644 class CErrorDetails
00645 {
00646   public:
00648     EResultCode                 m_eResultCode;
00650     const char *                m_pWhatStr;
00652     const CTypeDescriptor *     m_pRefType;
00654     const CFieldDescriptor *    m_pRefField;
00655 
00656     int                         m_OtherDetail;
00657 
00659     CErrorDetails (void);
00660 
00662     void
00663     clear (void);
00664 
00669     void
00670     missingParameter (
00671       const CTypeDescriptor *   pRefType);
00672 
00677     void
00678     unexpectedParameter (
00679       const CParameter *        pParameter);
00680 
00685     void
00686     resultCodeAndWhatStr (
00687       EResultCode               eResultCode,
00688       const char *              pWhatStr);
00689 };
00690 
00698 class CVendorDescriptor
00699 {
00700   public:
00702     const char *                m_pName;
00703 
00705     llrp_u32_t                  m_VendorID;
00706 };
00707 
00713 class CNamespaceDescriptor
00714 {
00715   public:
00717     const char *                m_pPrefix;
00718 
00720     const char *                m_pURI;
00721 
00724     const char *                m_pSchemaLocation;
00725 };
00726 
00727 
00728 
00768 class CTypeDescriptor
00769 {
00770   public:
00772     llrp_bool_t                 m_bIsMessage;
00773 
00775     char *                      m_pName;
00776 
00779     const CVendorDescriptor *   m_pVendorDescriptor;
00780 
00782     const CNamespaceDescriptor *m_pNamespaceDescriptor;
00783 
00785     llrp_u32_t                  m_TypeNum;
00786 
00789     const CTypeDescriptor *     m_pResponseType;
00790 
00792     const CFieldDescriptor * const * const m_ppFieldDescriptorTable;
00793 
00795     CElement *
00796     (*m_pfConstruct)(void);
00797 
00799     void
00800     (*m_pfDecodeFields) (
00801       CDecoderStream *          pDecoderStream,
00802       CElement *                pTargetElement);
00803 
00804   public:
00806     inline CElement *
00807     constructElement(void) const
00808     {
00809        return (*m_pfConstruct)();
00810     }
00811 };
00812 
00820 class CFieldDescriptor
00821 {
00822   public:
00824     enum FieldType {
00825         FT_U8,  FT_S8,  FT_U8V,  FT_S8V,
00826         FT_U16, FT_S16, FT_U16V, FT_S16V,
00827         FT_U32, FT_S32, FT_U32V, FT_S32V,
00828         FT_U64, FT_S64, FT_U64V, FT_S64V,
00829 
00830         FT_U1,  FT_U1V, FT_U2,   FT_U96,
00831         FT_UTF8V,
00832 
00833         FT_E1, FT_E2, FT_E8, FT_E16, FT_E32,
00834         FT_E8V,
00835 
00836         FT_BYTESTOEND,
00837     };
00838 
00840     enum FieldFormat {
00841         FMT_NORMAL,
00842         FMT_DEC,
00843         FMT_HEX,
00844         FMT_UTF8,
00845         FMT_DATETIME,
00846     };
00847 
00849     FieldType                   m_eFieldType;
00851     FieldFormat                 m_eFieldFormat;
00853     char *                      m_pName;
00855     const SEnumTableEntry *     m_pEnumTable;
00856 };
00857 
00858 /*
00859  * ltkcpp_hdrfd.c
00860  */
00861 extern CFieldDescriptor     g_fdMessageHeader_Type;
00862 extern CFieldDescriptor     g_fdMessageHeader_Length;
00863 extern CFieldDescriptor     g_fdMessageHeader_MessageID;
00864 extern CFieldDescriptor     g_fdMessageHeader_VendorPEN;
00865 extern CFieldDescriptor     g_fdMessageHeader_Subtype;
00866 extern CFieldDescriptor     g_fdParameterHeader_TVType;
00867 extern CFieldDescriptor     g_fdParameterHeader_TLVType;
00868 extern CFieldDescriptor     g_fdParameterHeader_TLVLength;
00869 extern CFieldDescriptor     g_fdParameterHeader_VendorPEN;
00870 extern CFieldDescriptor     g_fdParameterHeader_Subtype;
00871 
00872 
00873 /*
00874  * SEnumTableEntry
00875  *
00876  * @brief Simple table of enumerations. Table is terminated
00877  * by an entry with pName==NULL.
00878  */
00879 struct SEnumTableEntry
00880 {
00881     /* String name, (e.g. "Immediate") */
00882     char *                      pName;
00883     int                         Value;
00884 };
00885 
00898 class CTypeRegistry
00899 {
00900   public:
00902     const CTypeDescriptor *     m_apStdMessageTypeDescriptors[1024u];
00904     const CTypeDescriptor *     m_apStdParameterTypeDescriptors[1024u];
00906     std::list<const CTypeDescriptor *> m_listCustomMessageTypeDescriptors;
00908     std::list<const CTypeDescriptor *> m_listCustomParameterTypeDescriptors;
00909 
00910     CTypeRegistry(void);
00911     ~CTypeRegistry(void);
00912 
00914     EResultCode
00915     enroll (
00916       const CTypeDescriptor *   pTypeDescriptor);
00917 
00919     const CTypeDescriptor *
00920     lookupMessage (
00921       unsigned int              MessageTypeNum) const;
00922 
00924     const CTypeDescriptor *
00925     lookupParameter (
00926       unsigned int              ParameterTypeNum) const;
00927 
00929     const CTypeDescriptor *
00930     lookupCustomMessage (
00931       unsigned int              VendorID,
00932       unsigned int              MessageSubTypeNum) const;
00933 
00935     const CTypeDescriptor *
00936     lookupCustomParameter (
00937       unsigned int              VendorID,
00938       unsigned int              ParameterSubTypeNum) const;
00939 
00940    /* look up the type descriptor*/
00941     const CTypeDescriptor *
00942     lookupByName (
00943       char *                    pName) const;
00944 
00945 };
00946 
00947 
00948 
00949 typedef std::list<CParameter *> tListOfParameters;
00950 
00981 class CElement
00982 {
00983   public:
00985     const CTypeDescriptor *     m_pType;
00986 
00988     CElement *                  m_pParent;
00989 
00991     tListOfParameters           m_listAllSubParameters;
00992 
00993   public:
00994     CElement(void);
00995 
00996     virtual
00997     ~CElement(void);
00998 
01006     void
01007     addSubParameterToAllList (
01008       CParameter *              pParameter);
01009 
01018     void
01019     removeSubParameterFromAllList (
01020       CParameter *              pParameter);
01021 
01029     void
01030     clearSubParameterList (
01031       tListOfParameters *       pParameterList);
01032 
01034     int
01035     walk (
01036       int                       (*pFunc)(
01037                                   const CElement *  pElement,
01038                                   void *            pArg),
01039       void *                    pArg,
01040       int                       iDepth,
01041       int                       nMaxDepth) const;
01042 
01043 
01050     EResultCode
01051     toXMLString (
01052       char *                    pBuffer,
01053       int                       nBuffer);
01054 
01055 
01064     virtual void
01065     decodeFields (
01066       CDecoderStream *          pDecoderStream) = 0;
01067 
01078     virtual void
01079     assimilateSubParameters (
01080       CErrorDetails *           pError) = 0;
01081 
01087     virtual void
01088     encode (
01089       CEncoderStream *          pEncoderStream) const = 0;
01090 };
01091 
01092 
01101 class CMessage : public CElement
01102 {
01103   public:
01104     CMessage(void);
01105 
01109     inline void
01110     setMessageID (
01111       llrp_u32_t                MessageID)
01112     {
01113         m_MessageID = MessageID;
01114     }
01115 
01119     inline llrp_u32_t
01120     getMessageID (void) const
01121     {
01122         return m_MessageID;
01123     }
01124 
01125   protected:
01126     llrp_u32_t                  m_MessageID;
01127 
01128 };
01129 
01138 class CParameter : public CElement
01139 {
01140   public:
01148     virtual llrp_bool_t
01149     isAllowedIn (
01150       const CTypeDescriptor *   pEnclosingTypeDescriptor) const;
01151 
01159     llrp_bool_t
01160     isAllowedExtension (
01161       const CTypeDescriptor *   pEnclosingTypeDescriptor);
01162 };
01163 
01218 class CDecoder
01219 {
01220   public:
01222     CErrorDetails               m_ErrorDetails;
01223 
01224     CDecoder (void);
01225 
01227     CDecoder (
01228       const CTypeRegistry *     pTypeRegistry);
01229 
01230     virtual
01231     ~CDecoder (void) = 0;
01232 
01234     virtual CMessage *
01235     decodeMessage (void) = 0;
01236 
01237   protected:
01238     const CTypeRegistry *       m_pRegistry;
01239 };
01240 
01248 class CDecoderStream
01249 {
01250   public:
01251     virtual
01252     ~CDecoderStream(void) = 0;
01253 
01254     /*
01255      * 8-bit types
01256      */
01257 
01259     virtual llrp_u8_t
01260     get_u8 (
01261       const CFieldDescriptor *  pFieldDesc) = 0;
01262 
01264     virtual llrp_s8_t
01265     get_s8 (
01266       const CFieldDescriptor *  pFieldDesc) = 0;
01267 
01269     virtual llrp_u8v_t
01270     get_u8v (
01271       const CFieldDescriptor *  pFieldDesc) = 0;
01272 
01274     virtual llrp_s8v_t
01275     get_s8v (
01276       const CFieldDescriptor *  pFieldDesc) = 0;
01277 
01278     /*
01279      * 16-bit types
01280      */
01281 
01283     virtual llrp_u16_t
01284     get_u16 (
01285       const CFieldDescriptor *  pFieldDesc) = 0;
01286 
01288     virtual llrp_s16_t
01289     get_s16 (
01290       const CFieldDescriptor *  pFieldDesc) = 0;
01291 
01293     virtual llrp_u16v_t
01294     get_u16v (
01295       const CFieldDescriptor *  pFieldDesc) = 0;
01296 
01298     virtual llrp_s16v_t
01299     get_s16v (
01300       const CFieldDescriptor *  pFieldDesc) = 0;
01301 
01302     /*
01303      * 32-bit types
01304      */
01305 
01307     virtual llrp_u32_t
01308     get_u32 (
01309       const CFieldDescriptor *  pFieldDesc) = 0;
01310 
01312     virtual llrp_s32_t
01313     get_s32 (
01314       const CFieldDescriptor *  pFieldDesc) = 0;
01315 
01317     virtual llrp_u32v_t
01318     get_u32v (
01319       const CFieldDescriptor *  pFieldDesc) = 0;
01320 
01322     virtual llrp_s32v_t
01323     get_s32v (
01324       const CFieldDescriptor *  pFieldDesc) = 0;
01325 
01326     /*
01327      * 64-bit types
01328      */
01329 
01331     virtual llrp_u64_t
01332     get_u64 (
01333       const CFieldDescriptor *  pFieldDesc) = 0;
01334 
01336     virtual llrp_s64_t
01337     get_s64 (
01338       const CFieldDescriptor *  pFieldDesc) = 0;
01339 
01341     virtual llrp_u64v_t
01342     get_u64v (
01343       const CFieldDescriptor *  pFieldDesc) = 0;
01344 
01346     virtual llrp_s64v_t
01347     get_s64v (
01348       const CFieldDescriptor *  pFieldDesc) = 0;
01349 
01350     /*
01351      * Special types
01352      */
01353 
01355     virtual llrp_u1_t
01356     get_u1 (
01357       const CFieldDescriptor *  pFieldDesc) = 0;
01358 
01360     virtual llrp_u1v_t
01361     get_u1v (
01362       const CFieldDescriptor *  pFieldDesc) = 0;
01363 
01365     virtual llrp_u2_t
01366     get_u2 (
01367       const CFieldDescriptor *  pFieldDesc) = 0;
01368 
01370     virtual llrp_u96_t
01371     get_u96 (
01372       const CFieldDescriptor *  pFieldDesc) = 0;
01373 
01375     virtual llrp_utf8v_t
01376     get_utf8v (
01377       const CFieldDescriptor *  pFieldDesc) = 0;
01378 
01380     virtual llrp_bytesToEnd_t
01381     get_bytesToEnd (
01382       const CFieldDescriptor *  pFieldDesc) = 0;
01383 
01384     /*
01385      * Enumerated types of various sizes
01386      */
01387 
01389     virtual int
01390     get_e1 (
01391       const CFieldDescriptor *  pFieldDesc) = 0;
01392 
01394     virtual int
01395     get_e2 (
01396       const CFieldDescriptor *  pFieldDesc) = 0;
01397 
01399     virtual int
01400     get_e8 (
01401       const CFieldDescriptor *  pFieldDesc) = 0;
01402 
01404     virtual int
01405     get_e16 (
01406       const CFieldDescriptor *  pFieldDesc) = 0;
01407 
01409     virtual int
01410     get_e32 (
01411       const CFieldDescriptor *  pFieldDesc) = 0;
01412 
01414     virtual llrp_u8v_t
01415     get_e8v (
01416       const CFieldDescriptor *  pFieldDesc) = 0;
01417 
01418     /*
01419      * Reserved means some number of bits
01420      */
01421     /* @brief skips a number of reserved bits and discards during the encode/decode process */
01422     virtual void
01423     get_reserved (
01424       unsigned int          nBits) = 0;
01425 };
01426 
01434 class CEncoder
01435 {
01436   public:
01438     CErrorDetails               m_ErrorDetails;
01439 
01441     CEncoder (void);
01442 
01444     virtual
01445     ~CEncoder (void) = 0;
01446 
01448     virtual void
01449     encodeElement (
01450       const CElement *          pElement) = 0;
01451 };
01452 
01460 class CEncoderStream
01461 {
01462   public:
01463     virtual
01464     ~CEncoderStream(void) = 0;
01465 
01470     virtual void
01471     putRequiredSubParameter (
01472       const CParameter *        pParameter,
01473       const CTypeDescriptor *   pRefType) = 0;
01474 
01479     virtual void
01480     putOptionalSubParameter (
01481       const CParameter *        pParameter,
01482       const CTypeDescriptor *   pRefType) = 0;
01483 
01488     virtual void
01489     putRequiredSubParameterList (
01490       const tListOfParameters * pParameterList,
01491       const CTypeDescriptor *   pRefType) = 0;
01492 
01497     virtual void
01498     putOptionalSubParameterList (
01499       const tListOfParameters * pParameterList,
01500       const CTypeDescriptor *   pRefType) = 0;
01501 
01502     /*
01503      * 8-bit types
01504      */
01505 
01510     virtual void
01511     put_u8 (
01512       llrp_u8_t                 Value,
01513       const CFieldDescriptor *  pFieldDesc) = 0;
01514 
01519     virtual void
01520     put_s8 (
01521       llrp_s8_t                 Value,
01522       const CFieldDescriptor *  pFieldDesc) = 0;
01523 
01528     virtual void
01529     put_u8v (
01530       llrp_u8v_t                Value,
01531       const CFieldDescriptor *  pFieldDesc) = 0;
01532 
01537     virtual void
01538     put_s8v (
01539       llrp_s8v_t                Value,
01540       const CFieldDescriptor *  pFieldDesc) = 0;
01541 
01542     /*
01543      * 16-bit types
01544      */
01545 
01550     virtual void
01551     put_u16 (
01552       llrp_u16_t                Value,
01553       const CFieldDescriptor *  pFieldDesc) = 0;
01554 
01559     virtual void
01560     put_s16 (
01561       llrp_s16_t                Value,
01562       const CFieldDescriptor *  pFieldDesc) = 0;
01563 
01568     virtual void
01569     put_u16v (
01570       llrp_u16v_t               Value,
01571       const CFieldDescriptor *  pFieldDesc) = 0;
01572 
01577     virtual void
01578     put_s16v (
01579       llrp_s16v_t               Value,
01580       const CFieldDescriptor *  pFieldDesc) = 0;
01581 
01582     /*
01583      * 32-bit types
01584      */
01585 
01590     virtual void
01591     put_u32 (
01592       llrp_u32_t                Value,
01593       const CFieldDescriptor *  pFieldDesc) = 0;
01594 
01599     virtual void
01600     put_s32 (
01601       llrp_s32_t                Value,
01602       const CFieldDescriptor *  pFieldDesc) = 0;
01603 
01608     virtual void
01609     put_u32v (
01610       llrp_u32v_t               Value,
01611       const CFieldDescriptor *  pFieldDesc) = 0;
01612 
01617     virtual void
01618     put_s32v (
01619       llrp_s32v_t               Value,
01620       const CFieldDescriptor *  pFieldDesc) = 0;
01621 
01622     /*
01623      * 64-bit types
01624      */
01625 
01630     virtual void
01631     put_u64 (
01632       llrp_u64_t                Value,
01633       const CFieldDescriptor *  pFieldDesc) = 0;
01634 
01639     virtual void
01640     put_s64 (
01641       llrp_s64_t                Value,
01642       const CFieldDescriptor *  pFieldDesc) = 0;
01643 
01648     virtual void
01649     put_u64v (
01650       llrp_u64v_t               Value,
01651       const CFieldDescriptor *  pFieldDesc) = 0;
01652 
01657     virtual void
01658     put_s64v (
01659       llrp_s64v_t               Value,
01660       const CFieldDescriptor *  pFieldDesc) = 0;
01661 
01662     /*
01663      * Special types
01664      */
01665 
01670     virtual void
01671     put_u1 (
01672       llrp_u1_t                 Value,
01673       const CFieldDescriptor *  pFieldDesc) = 0;
01674 
01679     virtual void
01680     put_u1v (
01681       llrp_u1v_t                Value,
01682       const CFieldDescriptor *  pFieldDesc) = 0;
01683 
01688     virtual void
01689     put_u2 (
01690       llrp_u2_t                 Value,
01691       const CFieldDescriptor *  pFieldDesc) = 0;
01692 
01697     virtual void
01698     put_u96 (
01699       llrp_u96_t                Value,
01700       const CFieldDescriptor *  pFieldDesc) = 0;
01701 
01706     virtual void
01707     put_utf8v (
01708       llrp_utf8v_t              Value,
01709       const CFieldDescriptor *  pFieldDesc) = 0;
01710 
01715     virtual void
01716     put_bytesToEnd (
01717       llrp_bytesToEnd_t         Value,
01718       const CFieldDescriptor *  pFieldDesc) = 0;
01719 
01720     /*
01721      * Enumerated types of various sizes
01722      */
01723 
01728     virtual void
01729     put_e1 (
01730       int                       eValue,
01731       const CFieldDescriptor *  pFieldDesc) = 0;
01732 
01737     virtual void
01738     put_e2 (
01739       int                       eValue,
01740       const CFieldDescriptor *  pFieldDesc) = 0;
01741 
01746     virtual void
01747     put_e8 (
01748       int                       eValue,
01749       const CFieldDescriptor *  pFieldDesc) = 0;
01750 
01755     virtual void
01756     put_e16 (
01757       int                       eValue,
01758       const CFieldDescriptor *  pFieldDesc) = 0;
01759 
01764     virtual void
01765     put_e32 (
01766       int                       eValue,
01767       const CFieldDescriptor *  pFieldDesc) = 0;
01768 
01773     virtual void
01774     put_e8v (
01775       llrp_u8v_t                Value,
01776       const CFieldDescriptor *  pFieldDesc) = 0;
01777 
01778     /*
01779      * Reserved types are some number of bits
01780      */
01781 
01782     /* @brief skips a number of reserved bits and discards during the encode/decode process */
01783     virtual void
01784     put_reserved (
01785       unsigned int              nBits) = 0;
01786 };
01787 
01788 
01789 /*
01790 ** @brief Encodes a CElement into an XML string
01791 **
01792 ** @param[in]  pElement      The CElement to encode to XML
01793 ** @param[out] pBuffer       The pointer to the buffer in which to place the XML result
01794 ** @param[in]  nBuffer       The size of the buffer available to hold the XML
01795 **
01796 ** @return EResultCode Result code from the operation
01797 */
01798 extern EResultCode
01799 toXMLString (
01800   const CElement *              pElement,
01801   char *                        pBuffer,
01802   int                           nBuffer);
01803 
01804 }; /* namespace LLRP */

Generated on Wed Jun 6 11:55:49 2012 for LTKCPP-- LLRP Toolkit C Plus Plus Library by  doxygen 1.5.9