XMP Toolkit SDK  6.0.0
IVersionable.h
Go to the documentation of this file.
1 #ifndef IVersionable_h__
2 #define IVersionable_h__ 1
3 
4 // =================================================================================================
5 // Copyright Adobe
6 // Copyright 2015 Adobe
7 // All Rights Reserved
8 //
9 // NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the terms
10 // of the Adobe license agreement accompanying it. If you have received this file from a source other
11 // than Adobe, then your use, modification, or distribution of it requires the prior written permission
12 // of Adobe.
13 // =================================================================================================
14 
16 
17 namespace AdobeXMPCommon {
18 
29 
31  public:
32 
39  template< typename requestedInterface >
40  XMP_PRIVATE requestedInterface * GetInterfacePointer() {
41  pvoid ptr = GetInterfacePointer( requestedInterface::GetInterfaceID(),
42  requestedInterface::GetInterfaceVersion() );
43  return static_cast< requestedInterface * >( ptr );
44  }
45 
52  template< typename requestedInterface >
53  XMP_PRIVATE const requestedInterface * GetInterfacePointer() const {
54  return const_cast< IVersionable * >( this )->GetInterfacePointer< requestedInterface >();
55  }
56 
57  protected:
58  virtual ~IVersionable() {}
60  virtual pvoid APICALL GetInterfacePointer( uint64 interfaceID, uint32 interfaceVersion ) = 0;
61  // all safe functions
62  virtual pvoid APICALL getInterfacePointer( uint64 interfaceID, uint32 interfaceVersion, pcIError_base & error ) __NOTHROW__ = 0;
64 
65  #ifdef FRIEND_CLASS_DECLARATION
66  FRIEND_CLASS_DECLARATION();
67  #endif
69  };
70 
71 }
72 
73 #endif // IVersionable_h__
XMP_PRIVATE
#define XMP_PRIVATE
Definition: XMP_Environment.h:222
__NOTHROW__
#define __NOTHROW__
Definition: XMPCommonDefines.h:147
XMP_PUBLIC
#define XMP_PUBLIC
Definition: XMP_Environment.h:221
AdobeXMPCommon::IVersionable::~IVersionable
virtual ~IVersionable()
Definition: IVersionable.h:58
AdobeXMPCommon
Definition: IConfigurable.h:21
XMPCommonFwdDeclarations.h
AdobeXMPCommon::pvoid
void * pvoid
Definition: XMPCommonFwdDeclarations.h:46
AdobeXMPCommon::uint32
XMP_Uns32 uint32
Definition: XMPCommonDefines.h:174
AdobeXMPCommon::IVersionable::GetInterfacePointer
const XMP_PRIVATE requestedInterface * GetInterfacePointer() const
Get the raw pointer to a const interface object implementing the requested version.
Definition: IVersionable.h:53
AdobeXMPCommon::IVersionable::GetInterfacePointer
XMP_PRIVATE requestedInterface * GetInterfacePointer()
Get the raw pointer to an interface object implementing the requested version.
Definition: IVersionable.h:40
AdobeXMPCommon::IVersionable
Interface that serves as the base interface for all the externally exposed interfaces which needs to ...
Definition: IVersionable.h:30
REQ_FRIEND_CLASS_DECLARATION
#define REQ_FRIEND_CLASS_DECLARATION()
Definition: XMPCommonDefines.h:137
AdobeXMPCommon::pcIError_base
const typedef IError_v1 * pcIError_base
Definition: XMPCommonFwdDeclarations.h:64
AdobeXMPCommon::uint64
XMP_Uns64 uint64
Definition: XMPCommonDefines.h:172