Customization of Diarkis Module
This page introduces parts of the code from the directmessage_simple
sample and explains how to customize and use the Diarkis Module.
The actual sample source code is located at samples\directmessage_simple\directmessage_simple.cpp
.
Customizing Each Feature of the Diarkis Module
You can integrate application-specific processing into the module you wish to use. For example, the application can recognize when someone joins or leaves a room and update the UI accordingly. In directmessage_simple
, the DM functionality of the Diarkis Module is customized to determine if any message from another user has been received at least once.
To customize a function in the Diarkis Module, you inherit the base class (DiarkisModuleNameBase) for each feature. The DM feature is implemented in DiarkisDirectMessageBase
, and in the sample, this class is inherited to implement the necessary processes. The following code shows a part of the actual implementation.
DiarkisDirectMessageBase
mainly defines interfaces for using DM features and interfaces for receiving events. The interface for using DM features can be employed for executing a specific process before calling a DM function. Meanwhile, the interface for receiving events can be used to implement processing against notifications when events occur, such as receiving messages in the DM feature.
In the sample implementation, DiarkisDirectMessageBase::OnMessage
, which is triggered when a message is received via DM, is overridden to save the state of whether a message has been received.
Customizing DiarkisInterfaceBase
When using the Diarkis Module, instances of classes implementing each feature are all managed by the DiarkisInterfaceBase
class, and instance creation is done internally by DiarkisInterfaceBase
. If the base class is customized, it's necessary to change the type of instance generated within DiarkisInterfaceBase
, hence a customized DiarkisInterfaceBase
class is implemented by inheriting it. Below is a part of the sample implementation.
Instance generation for each feature is conducted in DiarkisInterfaceBase::Setup...
. Since the DM feature instance is handled in DiarkisInterfaceBase::SetupDirectMessage()
, this method is overridden to generate the user-customized DM feature class. Also, a method has been added to retrieve the DM feature instance using the customized type.
By using these customized classes, you can integrate application-specific processing into the Diarkis Module for customization.
Points to Note
Since the Diarkis Module is provided with source code, it is possible to directly modify it without inheriting from the base class for similar customization. However, as the source code of the Diarkis Module may undergo significant changes during version upgrades, it is anticipated that merging could become difficult. To avoid such situations, it is recommended to customize the module using the method introduced on this page.
Last updated