Wide Studio Programmer's Guide

Wide Studio Home
Up to


Accessing a remote instance



Accessing a remote instance

You can get a remote instance by requesting to the object management instance which exists one per a load module.
Object management class Instance retreiving class
WSCbaseList WSCbaseList* WSGIappObjectList()

The way to retreive the object to access is as follows:
#include "WSCbaseList.h" //Access WSGIappObjectList()
#include "WSCRbase.h"    //Use the virtual remote instance class
...
void event_procedure(WSCbase* object){

  //Get WSCRbase point by the object management
  char* obj_name   = "newvlab_001";     //Remote instance named newvlab_001
  WSCRbase* rinstance = WSGIappObjectList()->getRemoteInstance(obj_name);

  //Access to the remote instance by the virtual remote instance
  rinstance->setProperty(WSNlabelString,"HELLO WORLD"); 


rinstance is the instance to access the remote instance. It requires the object name as its argument. You can access remote instances through the virtual remote instance as well as you can access usuall instances(objects)

Casting a remote instance

You can use the virtual remote instance acquired through the object management by casting to original class as well as usual objects. Casting is required when you need to call methods exising in the original class. Next example is to cast WSCRlist type virtual remote instance in order to call WSClist::addItem() from WSCRbase type virtual remote instance.
#include "WSCbaseList.h" //Access to WSGIappObjectList() 
#include "WSCRlist.h"    //Use the virtual remote instance class
...
void event_procedure(WSCbase* object){

  //Getting a WSCRbase pointer by the object management
  char* obj_name   = "newlist_001";     //Remote instance named newlist_001
  WSCRbase* rinstance = WSGIappObjectList()->getRemoteInstance(obj_name);

  //Cast WSClist class remote instance to the virtual remote calss WSCRlist that corresponds
  //to the original WSClist class
  WSCRlist* rlist = (WSCRlist*)rinstance->cast("WSCRlist");
  if (rlist == NULL){
    //Not WSCRlist class
    return;
  }

  //Call a WSClist class method through WSCRlist virtual remote intance class

  rlist->addItem("item..");


Document Release 3.0

For Use with Wide Studio Release 3.0, Summer 2002


Wide Stuido Home | Up to

Copyright(C) T. Hirabayashi, 2000-2002 Last modified: June 20, 2002