forked from Luxoft/iviLink
-
Notifications
You must be signed in to change notification settings - Fork 2
Creating a new profile API
vplachkov edited this page Aug 9, 2012
·
3 revisions
Profile API declares interface of profiles that inherit it. To create Profile API, do the next steps:
- Create C++ class that inherits CProfileApiBase class
- Pass UID of this Profile api into
IVILINK_PROFILE_API_UID()macros - Add pure virtual functions and interface of callbacks class
- Create Profile API manifest
- Add manifest to Profile API database
Example of Profile API Example of Profile API manifest
Every Profile API has special Profile Proxy class. Object of this class is used to provide access to profile that inherits profile API. To create Profile Proxy, do the next steps:
- Create header file
- Include there profile API header and CProfileProxy.hpp
- Define
CURRENT_PROFILE_API, CURRENT_PROFILE_PROXY, CURRENT_PROFILE_PROXY_API_UIDby passing name of profile api class, name of profile proxy class and profile API UID. - Add
IVILINK_PROFILE_PROXY_BEGIN(CURRENT_PROFILE_PROXY, CURRENT_PROFILE_API, CURRENT_PROFILE_PROXY_API_UID)after previous declarations andIVILINK_PROFILE_PROXY_ENDin the end of file. - Add virtual functions of Profile API and put there macros that call functions in loaded profiles. There are set of macros for different functions:
-
IVILINK_PROXY_VOID_FUNCTION(CURRENT_PROFILE_API, function_name [, function_parameters])for void functions -
IVILINK_PROXY_FUNCTION(CURRENT_PROFILE_API,function_name,return_datatype[, function_parameters])for functions that return value -
IVILINK_PROXY_FUNCTION_CONST(CURRENT_PROFILE_API,function_name,return_datatype[, function_parameters])for const functions that return value`