Main Page Modules Class Hierarchy Data Structures File List Data Fields Globals Related Pages

# oscl_uuid.h

Go to the documentation of this file.

    00001
    00007 #ifndef OSCL_UUID_H_INCLUDED
    00008 #define OSCL_UUID_H_INCLUDED
    00009
    00010 #ifndef OSCL_BASE_MACROS_H_INCLUDED
    00011 #include "oscl_base_macros.h"
    00012 #endif
    00013
    00014 #ifndef OSCL_MEM_BASIC_FUNCTIONS_H
    00015 #include "oscl_mem_basic_functions.h"
    00016 #endif
    00017
    00018 // __cplusplus
    00019
    00020 #define EMPTY_UUID PVUuid(0,0,0,0,0,0,0,0,0,0,0)
    00021
    00022 typedef uint32 OsclUid32;
    00026 struct OsclUuid
    00027 {
    00028 #define BYTES_IN_UUID_ARRAY 8
    00029
    00030     OsclUuid()
    00031     {
    00032         oscl_memset(this, 0, sizeof(OsclUuid));
    00033     }
    00034
    00035     OsclUuid(uint32 l, uint16 w1, uint16 w2, uint8 b1, uint8 b2, uint8 b3,
    00036              uint8 b4, uint8 b5, uint8 b6, uint8 b7, uint8 b8)
    00037     {
    00038         data1 = l;
    00039         data2 = w1;
    00040         data3 = w2;
    00041         data4[0] = b1;
    00042         data4[1] = b2;
    00043         data4[2] = b3;
    00044         data4[3] = b4;
    00045         data4[4] = b5;
    00046         data4[5] = b6;
    00047         data4[6] = b7;
    00048         data4[7] = b8;
    00049     }
    00050
    00051     OsclUuid(const OsclUuid &uuid)
    00052     {
    00053         oscl_memcpy(this, &uuid, sizeof(OsclUuid));
    00054     }
    00055
    00056     OsclUuid &operator=(const OsclUuid& src)
    00057     {
    00058         oscl_memcpy(this, &src, sizeof(OsclUuid));
    00059         return *this;
    00060     }
    00061
    00062     bool operator==(const OsclUuid& src) const
    00063     {
    00064         if (data1 != src.data1 || data2 != src.data2 || data3 != src.data3)
    00065         {
    00066             return false;
    00067         }
    00068
    00069         for (int ii = 0; ii < 8; ++ii)
    00070         {
    00071             if (data4[ii] != src.data4[ii])
    00072             {
    00073                 return false;
    00074             }
    00075         }
    00076
    00077         return true;
    00078     }
    00079
    00080     bool operator!=(const OsclUuid &src) const
    00081     {
    00082         return !(*this == src);
    00083     }
    00084
    00085     uint32  data1;
    00086     uint16  data2;
    00087     uint16  data3;
    00088     uint8   data4[BYTES_IN_UUID_ARRAY];
    00089 };
    00090
    00091 #endif
    00092