Application::IWindowPrx DesktopImpl::createWindow(const Ice::Current& cur) {
std::cout << std::endl << "DEBUG -- BEGIN -- in createWindow() ..." << std::endl;
WindowImpl *w = new WindowImpl();
Ice::Identity myID;
myID.name = IceUtil::generateUUID();
objectAdapterPtr->add(w, myID);//ic->stringToIdentity("blabla"));
objectAdapterPtr->activate();
Ice::ObjectPrx base2 = Ice::ObjectPrx::uncheckedCast(objectAdapterPtr->createProxy(myID));//ic->stringToProxy("blabla:default -h 127.0.0.1 -p 3434");
w->window = X12::Application::IWindowPrx::checkedCast(base2);
//X12::Application::IWindowPrx appIWindow = iWindowPrxV.back();
std::cout << "windowprx: " << w->window << std::endl;
try {
// store in list, honestly i dont know what we are doing here lg c
windowList.push_back(w);
windowIDMap.insert( std::make_pair((long int) w, w) );
// this adds an identity with an Window, if we need a list or map, implement it!
std::cout << "--> DEBUG -- adding ID \"" << cur.id.name << "\" with Window " << windowList.size() << std::endl;
}
catch(const std::exception& e) { // Alle C++-Exc.-Klassen erben von exception
std::cout << "DEBUG -- creating Window -- FAILED" << std::endl;
std::cout << e.what() << std::endl;
}
for ( int i = 0; i < windowList.size(); i++)
{
std::cout << "inlist: " << i << " is: " << (windowList.at(i))->window << std::endl;
}
std::cout << "DEBUG -- END -- creating Window -- SUCCESS" << std::endl;
return w->window;
}
Display::IDesktopPrx DesktopImpl::registerDisplay(const Display::IDisplayPrx& x, const Ice::Current& cur) {
std::cout << std::endl << "DEBUG -- BEGIN -- in registerDisplay() ... " << std::endl;
//Display::IDesktopPrx dispIDesktop;
// store in List, honestly i dont know what we are doing here lg c
// debug for all reading this
// wir erstellen ein neues objekt DisplayImpl
// dem construktor übergeben wir den Display Proxy ( wird intern gespeichert ).
DisplayImpl *d = new DisplayImpl(x);
objectAdapterPtr->add(d, ic->stringToIdentity("trara"));
objectAdapterPtr->activate();
try {
// speichern des displays in der displayListe ( als pointer )
displayList.push_back(d);
// wir speichern den gleichen pointer auch in eine map und casten den pointer in einen int long
// den wir später als id benutzen
// damit können wir über die id abfragen ob das display noch existiert oder nicht
// bzw. wenn wir eines löschen den pointer auf null setzen - diese null können wir abfragen.
// wenn wir nur das objekt löschen könnte es sein, dass wir auf ein zerstörtes objekt zugreifen
// die map liste exisitert länger als die objekte selbst
displayIDMap.insert( std::make_pair((long int) d, d) );
// this adds an identity with a Display, if we need a list or map, implement it!
std::cout << "--> DEBUG -- adding ID \"" << cur.id.name << "\" with Display " << displayList.size() << std::endl;
}
catch(const std::exception& e) { // Alle C++-Exc.-Klassen erben von exception
std::cout << "DEBUG -- creating Window -- FAILED" << std::endl;
std::cout << e.what() << std::endl;
}
std::cout << "DEBUG -- END -- registering Display -- SUCCESS" << std::endl;
Ice::ObjectPrx base2 = ic->stringToProxy("trara:default -h 127.0.0.1 -p 3434");
return X12::Display::IDesktopPrx::checkedCast(base2);
//return _desktopProxy;
}