00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef _NPT_INTERFACES_H_
00011 #define _NPT_INTERFACES_H_
00012
00013
00014
00015
00016 #include "NptTypes.h"
00017 #include "NptCommon.h"
00018 #include "NptResults.h"
00019
00020
00021
00022
00023 const int NPT_ERROR_NO_SUCH_INTERFACE = NPT_ERROR_BASE_INTERFACES - 0;
00024
00025 #if 0 // disabled, use NPT_Reference instead
00026
00027
00028
00029 #define NPT_RELEASE(o) do { if (o) (o)->Release(); (o) = NULL; } while (0)
00030 #define NPT_ADD_REFERENCE(o) do { if (o) (o)->AddReference(); } while (0)
00031
00032
00033
00034
00035 class NPT_Referenceable
00036 {
00037 public:
00038
00039 virtual void AddReference() = 0;
00040 virtual void Release() = 0;
00041
00042 protected:
00043
00044 NPT_Referenceable() {}
00045 virtual ~NPT_Referenceable() {}
00046 };
00047 #endif
00048
00049
00050
00051
00052 class NPT_InterfaceId
00053 {
00054 public:
00055
00056 bool operator==(const NPT_InterfaceId& id) const {
00057 return ((id.m_Id == m_Id) && (id.m_Version == m_Version));
00058 }
00059
00060
00061 unsigned long m_Id;
00062 unsigned long m_Version;
00063 };
00064
00065
00066
00067
00068 class NPT_Polymorphic
00069 {
00070 public:
00071
00072 virtual ~NPT_Polymorphic() {}
00073
00074
00075 virtual NPT_Result GetInterface(const NPT_InterfaceId& id,
00076 NPT_Interface*& iface) = 0;
00077 };
00078
00079
00080
00081
00082 class NPT_Interruptible
00083 {
00084 public:
00085
00086 virtual ~NPT_Interruptible() {}
00087
00088
00089 virtual NPT_Result Interrupt() = 0;
00090 };
00091
00092
00093
00094
00095 class NPT_Configurable
00096 {
00097 public:
00098
00099 virtual ~NPT_Configurable() {}
00100
00101
00102 virtual NPT_Result SetProperty(const char* ,
00103 const char* ) {
00104 return NPT_ERROR_NO_SUCH_PROPERTY;
00105 }
00106 virtual NPT_Result SetProperty(const char* ,
00107 NPT_Integer ) {
00108 return NPT_ERROR_NO_SUCH_PROPERTY;
00109 }
00110 virtual NPT_Result GetProperty(const char* ,
00111 NPT_PropertyValue& ) {
00112 return NPT_ERROR_NO_SUCH_PROPERTY;
00113 }
00114 };
00115
00116 #endif // _NPT_INTERFACES_H_