IDLのコンパイル後,valuetypeのインプリメンテーションを作成します。インプリメンテーションクラスは,ベースクラスを継承します。このクラスには,ValueFactoryで呼び出されたコンストラクタがあり,IDLで宣言された変数とメソッドのすべてを含んでいます。
例えばobv¥PntImpl.hでは,コードサンプル25-1で示すようにPointImplクラスはIDLから生成されたPointクラスを継承します。
例えばobv¥PointImpl.javaでは,コードサンプル25-2で示すようにPointImplクラスはIDLから生成されたPointクラスを継承します。
class PointImpl : public Map::OBV_Point,
public CORBA::DefaultValueRefCountBase {
public:
PointImpl(){}
virtual ~PointImpl(){}
CORBA_ValueBase* _copy_value() {
return new PointImpl(x(), y(),
new Map::Label(CORBA::string_dup(label())));
}
PointImpl( CORBA::Long x, CORBA::Long y,
Map::Label_ptr label )
: OBV_Point( x,y,label->_boxed_in())
{}
virtual void print() {
cout << "Point is [" << label() << ": ("
<< x() << ", " << y() << ")]" << endl << endl;
}
};
public class PointImpl extends Point {
public PointImpl() {}
public PointImpl(int a_x, int a_y, String a_label) {
x = a_x;
y = a_y;
label = a_label;
}
public void print() {
System.out.println("Point is [" + label +
": (" + x + ", " + y + ")]");
}
}