Figure 7   Using Meta Data with Runtime Binding

class Color {
public:
 Color(int r, int g, int b) : red(r), green(g), blue(b) {}
 int getRed() { return red; }
 int getGreen() { return green; }
 int getBlue() { return blue; }
 void setRed(int r) { red = r; }
 void setGreen(int g) { green = g; }
 void setBlue(int b) { blue = b; }

private:
 // "callback enabled" data members
 IntData red;
 IntData green;
 IntData blue;
};

Figure 11   chatApp.h

// chatApp.h
class ChatApp: public EosFramework
{
public:
ChatApp();
ChatApp(const ChatApp& src);
virtual ~ChatApp();
ChatApp& operator =(const ChatApp& src);

      // overriden functions from the base application framework class
      virtual EosObject  *getFirstObject();
      virtual EosAtom  getClientViewName(EosClient *client);

private:
// storage for the chat strings based on messages created by remote clients
      EosPrimitiveArray<EosString> fChatList;
};

Figure 12   chatApp.cpp

// chatApp.cpp
#include "stdeos.hpp"
#include <chatApp.h>
#include <chatperson.h>

// retrieves a chat person object for each client that attaches to the server .exe
EosObject *ChatApp::getFirstObject()
{
  return (EosObject *)new ChatPerson(&fChatList);
}
// allows the server app to control the object and dialog name that is to be used at the applet level
// of the remote presentation
EosAtom ChatApp::getClientViewName(EosClient *client)
{
  return EosAtom("ChatPerson.Chat");
}

// misc. member functions
ChatApp::ChatApp() : EosFramework(),
    fChatList()
{
}
ChatApp::ChatApp(const ChatApp& src) : EosFramework(src),
    fChatList(src.fChatList)
{
}
ChatApp::~ChatApp()
{
}
ChatApp& ChatApp::operator =(const ChatApp& src)
{
    if (this != &src)
    {
        EosFramework::operator=(src);
        fChatList = src.fChatList;
    }
    return *this;
}

Figure 13   chatperson.hpp

// chatperson.hpp
class ChatPerson: public EosObject
{
public:
ChatPerson();
ChatPerson(const ChatPerson& src);
virtual ~ChatPerson();
ChatPerson& operator =(const ChatPerson& src);

     // constructor which initializes the shared chat list
    ChatPerson(EosPrimitiveArray<EosString> *chatList);

// adds the user message to the chat list
    void send(void);

protected: 
     // client message string for adding to the chat list
      EosString fSendString;
      // the client user name to be presented with the client's message in the chat list
    EosString fName;
      // a "reference" to the shared chat list initialized within the ChatPerson constructor
    EosPrimitiveArrayRef<EosString> fChatList;
};

Figure 14   chatperson.cpp

// chatperson.cpp
#include "stdeos.hpp"
#include <chatperson.hpp>

// performs the send which adds the client string to the chat list
void ChatPerson::send()
{
  // prepare the client string and add it to the chat list
  EosString theString("(" + fName + ") " + fSendString);
  fChatList->add(theString);

  // now clear the send string field on the client
  fSendString = "";
}

// the constructor that takes a reference to the global chat list
ChatPerson::ChatPerson(EosPrimitiveArray<EosString> *chatList) : EosObject(),
    fSendString(),
    fName(),
      // assign the shared chat list object with this client
      fChatList(chatList) {}

ChatPerson::ChatPerson() : EosObject(),
    fSendString(),
    fName(),
    fChatList() {}
ChatPerson::ChatPerson(const ChatPerson& src) : EosObject(src),
    fSendString(src.fSendString),
    fName(src.fName),
    fChatList(src.fChatList) {}
ChatPerson::~ChatPerson() {}
ChatPerson& ChatPerson::operator =(const ChatPerson& src)
{
    if (this != &src)
    {
        EosObject::operator=(src);
        fSendString = src.fSendString;
        fName = src.fName;
        fChatList = src.fChatList;
    }
    return *this;
}

Figure 15   Java Thin Client Chat Applet


// Java File Generated By ViewSoft's Builder
// Portions Copyright (c) 1996 MSJ
package chat;
import java.applet.*;
import java.awt.*;
import java.util.*;
import viewsoft.*;
public class ChatPerson extends EosEmbeddedView
{
  // this section of the generated code is used for client/server communication
  // and basic object to dialog connections...
  // socket port used for remote server side communication private EosPort fPort;
  // information used to connect view to C++ object on the server
  private EosMapperTable fIdTable;
  public ChatPerson() { super(); init(); }

  // data state change management hooks
  public EosMapperTableEntry getProbe(int id)
  { return (EosMapperTableEntry) fIdTable.elementAt(id); }
  public void removeProbe(int id) { fIdTable.removeProbe(id); }
  public void setMapperTable(EosMapperTable table) { fIdTable = table; }

  // port assignment
  public void setPort(EosPort port) { fPort = port; }

  // "resource" generation for the ChatPerson object dialogs designed in the
  // builder... responds to applet request to create an instance of a
  // ChatPerson dialog
  public void createView(String viewName, Container shell)
  {
    // since an object can have multiple views a comparison is made when the
    // create view function is called
    if (viewName.equals("Chat"))
    {
      int id;

      // create a geometry layout manager
      EosBoxContainer eosC1 = new EosBoxContainer();
      this.add(eosC1);

      // propagate communication variables
      eosC1.setPort(fPort);
      eosC1.setMapperTable(fIdTable);
      EosBoxContainer eosC2 = new EosBoxContainer();
      eosC1.add(eosC2);
      eosC2.setPort(fPort);
      eosC2.setMapperTable(fIdTable);

      // add the "Chat" label
      EosLabel eosC3 = new EosLabel();
      eosC2.add(eosC3);
      eosC3.setProperty("Caption", new EosString("Chat"));

      // add the list box for the chat list
      EosListBox eosC4 = new EosListBox();
      eosC2.add(eosC4);

      // probe ids...used to connect dialog elements to the object running on 
      // the server
      id = fIdTable.attachProbe(eosC4, "fInvalidate");
      eosC4.setUp(fPort, "fInvalidate", id);
      id = fIdTable.attachProbe(eosC4, "select");
      eosC4.setUp(fPort, "select", id);
      id = fIdTable.attachProbe(eosC4, "insert");
      eosC4.setUp(fPort, "insert", id);
      id = fIdTable.attachProbe(eosC4, "fRemove");
      eosC4.setUp(fPort, "fRemove", id);
      id = fIdTable.attachProbe(eosC4, "fRemoveAll");
      eosC4.setUp(fPort, "fRemoveAll", id);
      id = fIdTable.attachProbe(eosC4, "set");
      eosC4.setUp(fPort, "set", id);

      // create a row/column layout manager
      EosGridContainer eosC5 = new EosGridContainer();
      eosC1.add(eosC5);

      // propagate communication variables
      eosC5.setPort(fPort);
      eosC5.setMapperTable(fIdTable);

      // "My Name" label
      EosLabel eosC6 = new EosLabel();
      eosC5.add(eosC6);
      eosC6.setProperty("Caption", new EosString("My Name:"));

      // horizontal layout manager
      EosBoxContainer eosC7 = new EosBoxContainer();
      eosC5.add(eosC7);
      eosC7.setPort(fPort);
      eosC7.setMapperTable(fIdTable);

      // user name edit box
      EosTextField eosC8 = new EosTextField();
      eosC7.add(eosC8);
      // probe ids
      id = fIdTable.attachProbe(eosC8, "fText");
      eosC8.setUp(fPort, "fText", id);

      // send button
      EosButton eosC9 = new EosButton();
      eosC7.add(eosC9);
      // probe ids
      id = fIdTable.attachProbe(eosC9, "fPressed");
      eosC9.setUp(fPort, "fPressed", id);
      eosC9.setProperty("Caption", new EosString("Send"));

      // "Message" label
      EosLabel eosC10 = new EosLabel();
      eosC5.add(eosC10);
      eosC10.setProperty("Caption", new EosString("Message:"));

      // edit box for the client message
      EosTextField eosC11 = new EosTextField();
      eosC5.add(eosC11);
      // probe ids
      id = fIdTable.attachProbe(eosC11, "fText");
      eosC11.setUp(fPort, "fText", id);
    } 
  }
}