Handle

Files CCore/inc/gadget/Handle.h CCore/src/gadget/Handle.cpp

Handle is a universal object handle. It is a union of four common handle types: int, unsigned, void * and the function pointer.


union Handle
 {
  using FuncPtr = void (*)() ;
 
  int sid;
  unsigned uid;
  void *ptr;
  FuncPtr func_ptr;
  
  // constructors

  Handle() noexcept {}

  Handle(int sid_) { sid=sid_; }
 
  Handle(unsigned uid_) { uid=uid_; }
 
  Handle(void *ptr_) { ptr=ptr_; }
 
  Handle(FuncPtr func_ptr_) { func_ptr=func_ptr_; }
 };