#include "account.h" #include #include class Account_impl : virtual public Account_skel { private: CORBA::Long _current_balance ; public: Account_impl () { _current_balance = 0 ; }; void deposit (CORBA::ULong amount) { _current_balance += amount; }; void withdraw (CORBA::ULong amount) { _current_balance -= amount; }; CORBA::Long balance () { return _current_balance ; }; }; int main(int argc, char *argv[]) { //initialize ORB and basic object adapter CORBA::ORB_var orb = CORBA::ORB_init (argc, argv, "mico-local-orb"); CORBA::BOA_var boa = orb->BOA_init (argc, argv, "mico-local-boa"); // create an instance of Account_impl Account_impl* server = new Account_impl ; // write object reference to a file CORBA::String_var ref = orb->object_to_string(server) ; ofstream out ("account.objid") ; out << ref << endl ; out.close() ; // tell adapter that impl is ready and run orb boa->impl_is_ready(CORBA::ImplementationDef::_nil()) ; orb->run() ; CORBA::release(server) ; return 0 ; }