Main Page   Class Hierarchy   Data Structures   File List   Data Fields   Globals  

pv_interface_cmd_message.h

Go to the documentation of this file.
00001 #ifndef PV_INTERFACE_CMD_MESSAGE_H_INCLUDED
00002 #define PV_INTERFACE_CMD_MESSAGE_H_INCLUDED
00003 
00004 #ifndef PV_COMMON_TYPES_H_INCLUDED
00005 #include "pv_common_types.h"
00006 #endif
00007 
00008 #ifndef PV_ENGINE_TYPES_H_INCLUDED
00009 #include "pv_engine_types.h"
00010 #endif
00011 
00022 class CPVCmnInterfaceCmdMessage
00023 {
00024     public:
00025         CPVCmnInterfaceCmdMessage(int aType,
00026                                   OsclAny* aContextData) : iId(0),
00027                 iType(aType),
00028                 iPriority(0),
00029                 iContextData(aContextData) {};
00030 
00031         CPVCmnInterfaceCmdMessage() {};
00032 
00033         virtual ~CPVCmnInterfaceCmdMessage() {};
00034 
00035         PVCommandId GetCommandId()
00036         {
00037             return iId;
00038         }
00039         int GetType()
00040         {
00041             return iType;
00042         }
00043         OsclAny *GetContextData()
00044         {
00045             return iContextData;
00046         }
00047 
00053         int compare(CPVCmnInterfaceCmdMessage* a, CPVCmnInterfaceCmdMessage* b) const
00054         {
00055             if (a->GetPriority() < b->GetPriority())
00056                 return 1;
00057             else //if no priority, use fifo order.
00058                 return (a->GetCommandId() > b->GetCommandId());
00059         }
00060 
00061         int32 GetPriority()const
00062         {
00063             return iPriority;
00064         }
00065 
00066         friend int32 operator<(const CPVCmnInterfaceCmdMessage& a, const CPVCmnInterfaceCmdMessage& b);
00067 
00068         void SetId(PVCommandId aId)
00069         {
00070             iId = aId;
00071         }
00072 
00073     protected:
00074         PVCommandId iId;
00075         int iType;
00076         int32 iPriority;
00077         OsclAny* iContextData;
00078 
00079         friend class PVInterfaceProxy;
00080 };
00081 
00082 inline int32 operator<(const CPVCmnInterfaceCmdMessage& a, const CPVCmnInterfaceCmdMessage& b)
00083 {
00084     //Use priority
00085     if (a.iPriority < b.iPriority)
00086     {
00087         return true;
00088     }
00089     //If priority is the same, use id.
00090     else if (a.iPriority == b.iPriority)
00091     {
00092         //Smaller id means an older message so process older message first.
00093         return (a.iId > b.iId);
00094     }
00095     else
00096     {
00097         return false;
00098     }
00099 }
00100 #endif
00101 
00102 

PV Author Engine
Posting Version: CORE_8.000.1.1_RC4