3D PLM Enterprise Architecture

Middleware Abstraction

Callback versus Send/Receive

How to create and use a notification depending on the mechanism
Technical Article

Abstract

The goal of this article is explained how to create and use a notification in Callback and Send/Receive mechanisms. You will learn how to create a class deriving from the CATNotification class, and how to manage the life cycle of an instance.  


Introduction

To send a notification by the Callback or the Send/Receive mechanism, you can create a class which Object Modeler and C++ derives from the CATNotification component. The only one difference between the two mechanism is the argument of the class constructor: 

...
CATNotification(int iAutomaticDelete=CATNotificationDeleteOff);
...

For iAutomaticDelete there are two possible values:

Callback Mechanism

The CAASysRingNotification class is a class created in the "The Callback Mechanism" use case [1].

CATNotification Class Creation

Here the header class:

#include "CATNotification.h"

class CAASysRingNotification : public CATNotification
{
  CATDeclareClass;
  public:
    CAASysRingNotification();
    virtual ~CAASysRingNotification();
  private:
    CAASysRingNotification(const CAASysRingNotification &iObjectToCopy);
    CAASysRingNotification& operator = (const CAASysRingNotification &iObjectToCopy);
};

Here the source file:

#include "CAASysRingNotification.h"

CATImplementClass(CAASysRingNotification,
                  Implementation,
                  CATBaseUnknown,
                  CATNull);
                  
CAASysRingNotification::CAASysRingNotification()
{}

CAASysRingNotification::~CAASysRingNotification()
{}

CATNotification Class Usage

There are two ways:

...
  CAASysRingNotification * pMyNotif = new CATMyNotification (); 
      
  DispatchCallback(,pMyNotif);
      
  pMyNotif ->Release(); pMyNotif = NULL ;      
...

or simpler: 

...
   CAASysRingNotification MyNotif ;
      
   DispatchCallback(,MyNotif);
...     

[Top]

Send/Receive Mechanism

The CAADlgAddNotification class is a class created in the "The Send/Receive Mechanism" use case [2].

CATNotification Class Creation

Here the header class:

#include "CATNotification.h"
class CAADlgAddNotification : public CATNotification
{
  CATDeclareClass;
  public:
    CAADlgAddNotification();
    virtual CAADlgAddNotification();
  private:
    CAADlgAddNotification(const CAADlgAddNotification&iObjectToCopy);
    CAADlgAddNotification& operator = (const CAADlgAddNotification&iObjectToCopy);
};

Here the source file:

#include "CAADlgAddNotification.h"

CATImplementClass(CAADlgAddNotification,
                  Implementation,
                  CATBaseUnknown,
                  CATNull);
                  
CAADlgAddNotification::CAADlgAddNotification():CATNotification(CATNotificationDeleteOn)
{}

CAADlgAddNotification::CAADlgAddNotification()
{}

CATNotification Class Usage

...
  CAADlgAddNotification* pMyNotif = new CAADlgAddNotification(); 
      
  SendNotification(...,pMyNotif);
  pMyNotif = NULL ;       
...

[Top]


In Short

[Top]


References

[1] The Callback Mechanism
[2] The Send/Receive Mechanism
[Top]

History

Version: 1 [Fev 2004] Document created
[Top]

Copyright © 2004, Dassault Systèmes. All rights reserved.