TwiceAsNice  2019-02-18
Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
Nice::ObjectFinder Class Reference


Multicasting for Object References More...

#include <ObjectFinder.h>

Inheritance diagram for Nice::ObjectFinder:
Inheritance graph
Collaboration diagram for Nice::ObjectFinder:
Collaboration graph

Public Member Functions

 ObjectFinder (const Ice::CommunicatorPtr &_communicator, Nice::ObjectPrxDict &_objects)
 
virtual ~ObjectFinder ()
 
 ObjectFinder (const Ice::CommunicatorPtr &_communicator, Nice::ObjectPrxDict &_objects)
 
virtual ~ObjectFinder ()
 

Static Public Member Functions

static Nice::ObjectPrxMultiDict resolveMultiObjectList (const Ice::CommunicatorPtr &_communicator, double _time=0.7)
 
template<typename CALLBACK >
static void resolveMultiObjectListToCallback (const Ice::CommunicatorPtr &_communicator, CALLBACK *_cb, double _time=0.7)
 
static Nice::ObjectPrxDict resolveObjectList (const Ice::CommunicatorPtr &_communicator, double _time=0.7)
 
static Nice::ObjectPrxDict resolveObjectListOfType (const Ice::CommunicatorPtr &_communicator, const std::string &_type, double _time=0.7)
 
static Ice::ObjectPrx resolveObjectPrx (const Ice::CommunicatorPtr &_communicator, const std::string &_name, double _time=0.7)
 
template<class S >
static S::ProxyType resolveObject (const Ice::CommunicatorPtr &_communicator, const std::string &_name, double _time=0.7)
 
static Nice::ObjectPrxMultiDict resolveMultiObjectList (const Ice::CommunicatorPtr &_communicator, double _time=0.7)
 
template<typename CALLBACK >
static void resolveMultiObjectListToCallback (const Ice::CommunicatorPtr &_communicator, CALLBACK *_cb, double _time=0.7)
 
static Nice::ObjectPrxDict resolveObjectList (const Ice::CommunicatorPtr &_communicator, double _time=0.7)
 
static Nice::ObjectPrxDict resolveObjectListOfType (const Ice::CommunicatorPtr &_communicator, const std::string &_type, double _time=0.7)
 
static Ice::ObjectPrx resolveObjectPrx (const Ice::CommunicatorPtr &_communicator, const std::string &_name, double _time=0.7)
 
template<class S >
static S::ProxyType resolveObject (const Ice::CommunicatorPtr &_communicator, const std::string &_name, double _time=0.7)
 

Private Attributes

ObjectFinderServicePtr m_finder
 
Ice::ObjectAdapterPtr m_adapter
 

Detailed Description


Multicasting for Object References

Author
Florian Briegel
Version
11.02.04
Date
2012-08-10 11:04:58 AM Usage:

Simple example of the serverside usage

     Ice::CommunicatorPtr communicator = Ice::initialize ( argc, argv );;

     // Here we put all the proxy we want to find by multicast.
     Nice::ObjectPrxDict & objects;

     Nice::ObjectFinderPtr finder = new ObjectFinder(communicator, objects);

     Ice::ObjectAdapterPtr adapter =
              communicator()->createObjectAdapterWithEndpoints("HelloAdapter", "tcp -p 10000");
     adapter->activate();

     Ice::ObjectPrx prx =
              adapter->add(new HelloI(), communicator->stringToIdentity("hello"));

     // Add the hello proxy ( Maybe we should use a list instead of map ?)
     objects["hello"] = prx;

     communicator->waitForShutdown ();

With this Class you can multicast (UDP) for a named object Reference or a list of Object References.

The following code snippet illustrates finding a ObjectReference of type Hello and with the name Hello

     Ice::CommunicatorPtr communicator = Ice::initialize ( argc, argv );;

     Nice::MyObjectServicePrx service =
         Nice::ObjectFinder::resolveObject<Hello>(communicator, "Hello");

     if(service == 0) E_LOG("No service found!");

Next example multicasts for all available Objectreferences in the net.

     Ice::CommunicatorPtr communicator = Ice::initialize ( argc, argv );;

     ObjectProxyDict objects = ObjectFinder::resolveObjectList(communicator);

     U9_LOG("We found #" << objects.size() << " object refs.);
     for (ObjectProxyDict::iterator it = objects.begin(); it != objects.end(); ++it)
     {
            U9_LOG(it->first);
     }
Todo:
How can I close a Ice::Adapter?
Author
Florian Briegel
Version
11.02.04
Date
2012-08-10 11:04:58 AM Usage:

Simple example of the serverside usage

     Ice::CommunicatorPtr communicator = Ice::initialize ( argc, argv );;

     // Here we put all the proxy we want to find by multicast.
     Nice::ObjectPrxDict & objects;

     Nice::ObjectFinderPtr finder = new ObjectFinder(communicator, objects);

     Ice::ObjectAdapterPtr adapter =
              communicator()->createObjectAdapterWithEndpoints("HelloAdapter", "tcp -p 10000");
     adapter->activate();

     Ice::ObjectPrx prx =
              adapter->add(new HelloI(), communicator->stringToIdentity("hello"));

     // Add the hello proxy ( Maybe we should use a list instead of map ?)
     objects["hello"] = prx;

     communicator->waitForShutdown ();

With this Class you can multicast (UDP) for a named object Reference or a list of Object References.

The following code snippet illustrates finding a ObjectReference of type Hello and with the name Hello

     Ice::CommunicatorPtr communicator = Ice::initialize ( argc, argv );;

     Nice::MyObjectServicePrx service =
         Nice::ObjectFinder::resolveObject<Hello>(communicator, "Hello");

     if(service == 0) E_LOG("No service found!");

Next example multicasts for all available Objectreferences in the net.

     Ice::CommunicatorPtr communicator = Ice::initialize ( argc, argv );;

     ObjectProxyDict objects = ObjectFinder::resolveObjectList(communicator);

     U9_LOG("We found #" << objects.size() << " object refs.);
     for (ObjectProxyDict::iterator it = objects.begin(); it != objects.end(); ++it)
     {
            U9_LOG(it->first);
     }
Todo:
How can I close a Ice::Adapter?

Constructor & Destructor Documentation

◆ ObjectFinder() [1/2]

Nice::ObjectFinder::ObjectFinder ( const Ice::CommunicatorPtr &  _communicator,
Nice::ObjectPrxDict _objects 
)

◆ ~ObjectFinder() [1/2]

Nice::ObjectFinder::~ObjectFinder ( )
virtual

◆ ObjectFinder() [2/2]

Nice::ObjectFinder::ObjectFinder ( const Ice::CommunicatorPtr &  _communicator,
Nice::ObjectPrxDict _objects 
)

◆ ~ObjectFinder() [2/2]

virtual Nice::ObjectFinder::~ObjectFinder ( )
virtual

Member Function Documentation

◆ resolveMultiObjectList() [1/2]

ObjectPrxMultiDict Nice::ObjectFinder::resolveMultiObjectList ( const Ice::CommunicatorPtr &  _communicator,
double  _time = 0.7 
)
static

◆ resolveMultiObjectList() [2/2]

static Nice::ObjectPrxMultiDict Nice::ObjectFinder::resolveMultiObjectList ( const Ice::CommunicatorPtr &  _communicator,
double  _time = 0.7 
)
static

◆ resolveMultiObjectListToCallback() [1/2]

template<typename CALLBACK >
void Nice::ObjectFinder::resolveMultiObjectListToCallback ( const Ice::CommunicatorPtr &  _communicator,
CALLBACK _cb,
double  _time = 0.7 
)
static

◆ resolveMultiObjectListToCallback() [2/2]

template<typename CALLBACK >
static void Nice::ObjectFinder::resolveMultiObjectListToCallback ( const Ice::CommunicatorPtr &  _communicator,
CALLBACK _cb,
double  _time = 0.7 
)
static

◆ resolveObject() [1/2]

template<class S >
static S::ProxyType Nice::ObjectFinder::resolveObject ( const Ice::CommunicatorPtr &  _communicator,
const std::string &  _name,
double  _time = 0.7 
)
inlinestatic

◆ resolveObject() [2/2]

template<class S >
static S::ProxyType Nice::ObjectFinder::resolveObject ( const Ice::CommunicatorPtr &  _communicator,
const std::string &  _name,
double  _time = 0.7 
)
inlinestatic

◆ resolveObjectList() [1/2]

static Nice::ObjectPrxDict Nice::ObjectFinder::resolveObjectList ( const Ice::CommunicatorPtr &  _communicator,
double  _time = 0.7 
)
static

◆ resolveObjectList() [2/2]

ObjectPrxDict Nice::ObjectFinder::resolveObjectList ( const Ice::CommunicatorPtr &  _communicator,
double  _time = 0.7 
)
static

◆ resolveObjectListOfType() [1/2]

static Nice::ObjectPrxDict Nice::ObjectFinder::resolveObjectListOfType ( const Ice::CommunicatorPtr &  _communicator,
const std::string &  _type,
double  _time = 0.7 
)
static

◆ resolveObjectListOfType() [2/2]

ObjectPrxDict Nice::ObjectFinder::resolveObjectListOfType ( const Ice::CommunicatorPtr &  _communicator,
const std::string &  _type,
double  _time = 0.7 
)
static

◆ resolveObjectPrx() [1/2]

Ice::ObjectPrx Nice::ObjectFinder::resolveObjectPrx ( const Ice::CommunicatorPtr &  _communicator,
const std::string &  _name,
double  _time = 0.7 
)
static

◆ resolveObjectPrx() [2/2]

static Ice::ObjectPrx Nice::ObjectFinder::resolveObjectPrx ( const Ice::CommunicatorPtr &  _communicator,
const std::string &  _name,
double  _time = 0.7 
)
static

Member Data Documentation

◆ m_adapter

Ice::ObjectAdapterPtr Nice::ObjectFinder::m_adapter
private

◆ m_finder

ObjectFinderServicePtr Nice::ObjectFinder::m_finder
private

The documentation for this class was generated from the following files: