当前位置: 首页>>代码示例>>C++>>正文


C++ PropertiesPtr::getPropertyAsInt方法代码示例

本文整理汇总了C++中ice::PropertiesPtr::getPropertyAsInt方法的典型用法代码示例。如果您正苦于以下问题:C++ PropertiesPtr::getPropertyAsInt方法的具体用法?C++ PropertiesPtr::getPropertyAsInt怎么用?C++ PropertiesPtr::getPropertyAsInt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ice::PropertiesPtr的用法示例。


在下文中一共展示了PropertiesPtr::getPropertyAsInt方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: FileCache

NodeI::NodeI(const Ice::ObjectAdapterPtr& adapter,
             NodeSessionManager& sessions,
             const ActivatorPtr& activator,
             const IceUtil::TimerPtr& timer,
             const TraceLevelsPtr& traceLevels,
             const NodePrx& proxy,
             const string& name,
             const UserAccountMapperPrx& mapper,
             const string& instanceName) :
    _communicator(adapter->getCommunicator()),
    _adapter(adapter),
    _sessions(sessions),
    _activator(activator),
    _timer(timer),
    _traceLevels(traceLevels),
    _name(name),
    _proxy(proxy),
    _redirectErrToOut(false),
    _allowEndpointsOverride(false),
    _waitTime(0),
    _instanceName(instanceName),
    _userAccountMapper(mapper),
    _platform("IceGrid.Node", _communicator, _traceLevels),
    _fileCache(new FileCache(_communicator)),
    _serial(1),
    _consistencyCheckDone(false)
{
    Ice::PropertiesPtr props = _communicator->getProperties();

    const_cast<string&>(_dataDir) = _platform.getDataDir();
    const_cast<string&>(_serversDir) = _dataDir + "/servers";
    const_cast<string&>(_tmpDir) = _dataDir + "/tmp";
    const_cast<Ice::Int&>(_waitTime) = props->getPropertyAsIntWithDefault("IceGrid.Node.WaitTime", 60);
    const_cast<string&>(_outputDir) = props->getProperty("IceGrid.Node.Output");
    const_cast<bool&>(_redirectErrToOut) = props->getPropertyAsInt("IceGrid.Node.RedirectErrToOut") > 0;
    const_cast<bool&>(_allowEndpointsOverride) = props->getPropertyAsInt("IceGrid.Node.AllowEndpointsOverride") > 0;

    //
    // Parse the properties override property.
    //
    vector<string> overrides = props->getPropertyAsList("IceGrid.Node.PropertiesOverride");
    if(!overrides.empty())
    {
        for(vector<string>::iterator p = overrides.begin(); p != overrides.end(); ++p)
        {
            if(p->find("--") != 0)
            {
                *p = "--" + *p;
            }
        }

        Ice::PropertiesPtr p = Ice::createProperties();
        p->parseCommandLineOptions("", overrides);
        Ice::PropertyDict propDict = p->getPropertiesForPrefix("");
        for(Ice::PropertyDict::const_iterator q = propDict.begin(); q != propDict.end(); ++q)
        {
            _propertiesOverride.push_back(createProperty(q->first, q->second));
        }
    }
}
开发者ID:chenbk85,项目名称:ice,代码行数:60,代码来源:NodeI.cpp

示例2: ex

TrustManager::TrustManager(const Ice::CommunicatorPtr& communicator) :
    _communicator(communicator)
{
    Ice::PropertiesPtr properties = communicator->getProperties();
    _traceLevel = properties->getPropertyAsInt("IceSSL.Trace.Security");
    string key;
    try
    {
        key = "IceSSL.TrustOnly";
        _all = parse(properties->getProperty(key));
        key = "IceSSL.TrustOnly.Client";
        _client = parse(properties->getProperty(key));
        key = "IceSSL.TrustOnly.Server";
        _allServer = parse(properties->getProperty(key));
        Ice::PropertyDict dict = properties->getPropertiesForPrefix("IceSSL.TrustOnly.Server.");
        for(Ice::PropertyDict::const_iterator p = dict.begin(); p != dict.end(); ++p)
        {
            string name = p->first.substr(string("IceSSL.TrustOnly.Server.").size());
            key = p->first;
            _server[name] = parse(p->second);
        }
    }
    catch(const ParseException& e)
    {
        Ice::PluginInitializationException ex(__FILE__, __LINE__);
        ex.reason = "IceSSL: invalid property " + key  + ":\n" + e.reason;
        throw ex;
    }
}
开发者ID:updowndown,项目名称:myffff,代码行数:29,代码来源:TrustManager.cpp

示例3: invalid_argument

	LaserI::LaserI(Ice::PropertiesPtr prop)
	{
		std::string model = prop->getProperty("Laser.Model");
		
		if ("Hokuyo"==model || "hokuyo"==model){
	        std::string deviceId = prop->getProperty("Laser.DeviceId");
			double min = (double)prop->getPropertyAsInt("Laser.MinAng");
			double max = (double)prop->getPropertyAsInt("Laser.MaxAng");
			int clustering = prop->getPropertyAsInt("Laser.Clustering");
            int faceup = prop->getPropertyAsInt("Laser.FaceUp");
			double min_ang = min*M_PI/180;
			double max_ang = max*M_PI/180;
            this->manager = new hokuyo::HokuyoManager(deviceId, min_ang, max_ang, clustering, -1, faceup);
		}else{
			throw std::invalid_argument( model + " laser is not allowed" );
		}
	}
开发者ID:Diegojnb,项目名称:JdeRobot,代码行数:17,代码来源:laseri.cpp

示例4: topicMgr

TraceLevels::TraceLevels(const string name, const Ice::PropertiesPtr& properties, const Ice::LoggerPtr& theLogger) :
    topicMgr(0),
    topicMgrCat("TopicManager"),
    topic(0),
    topicCat("Topic"),
    subscriber(0),
    subscriberCat("Subscriber"),
    election(0),
    electionCat("Election"),
    replication(0),
    replicationCat("Replication"),
    logger(theLogger)
{
    const string keyBase = name + ".Trace.";
    const_cast<int&>(topicMgr) = properties->getPropertyAsInt(keyBase + topicMgrCat);
    const_cast<int&>(topic) = properties->getPropertyAsInt(keyBase + topicCat);
    const_cast<int&>(subscriber) = properties->getPropertyAsInt(keyBase + subscriberCat);
    const_cast<int&>(election) = properties->getPropertyAsInt(keyBase + electionCat);
}
开发者ID:Jonavin,项目名称:ice,代码行数:19,代码来源:TraceLevels.cpp

示例5: communicator

int
Server::run(int argc, char* argv[])
{
    Ice::StringSeq args = Ice::argsToStringSeq(argc, argv);
    Ice::PropertiesPtr properties = communicator()->getProperties();
    args = properties->parseCommandLineOptions("", args);
    Ice::stringSeqToArgs(args, argc, argv);
    if(properties->getPropertyAsInt("FailOnStartup") > 0)
    {
        return EXIT_FAILURE;
    }

    Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("TestAdapter");
    TestI* test = new TestI();
    Ice::ObjectPtr obj = test;
    adapter->add(test, communicator()->stringToIdentity(properties->getProperty("Ice.Admin.ServerId")));

    int delay = properties->getPropertyAsInt("ActivationDelay");
    if(delay > 0)
    {
        IceUtil::ThreadControl::sleep(IceUtil::Time::seconds(delay));
    }

    shutdownOnInterrupt();
    try
    {
        adapter->activate();
    }
    catch(const Ice::ObjectAdapterDeactivatedException&)
    {
    }
    communicator()->waitForShutdown();
    ignoreInterrupt();

    delay = properties->getPropertyAsInt("DeactivationDelay");
    if(delay > 0)
    {
        IceUtil::ThreadControl::sleep(IceUtil::Time::seconds(delay));
    }

    return test->isFailed() ? EXIT_FAILURE : EXIT_SUCCESS;
}
开发者ID:Jonavin,项目名称:ice,代码行数:42,代码来源:Server.cpp

示例6: appName

int
LibraryServer::run(int argc, char*[])
{
    if(argc > 1)
    {
        cerr << appName() << ": too many arguments" << endl;
        return EXIT_FAILURE;
    }

    Ice::PropertiesPtr properties = communicator()->getProperties();

    //
    // Create an object adapter
    //
    Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("Library");

    //
    // Create an evictor for books.
    //
    Freeze::EvictorPtr evictor = Freeze::createBackgroundSaveEvictor(adapter, _envName, "books");
    Ice::Int evictorSize = properties->getPropertyAsInt("EvictorSize");
    if(evictorSize > 0)
    {
        evictor->setSize(evictorSize);
    }

    //
    // Use the evictor as servant Locator.
    //
    adapter->addServantLocator(evictor, "book");

    //
    // Create the library, and add it to the object adapter.
    //
    LibraryIPtr library = new LibraryI(communicator(), _envName, "authors", evictor);
    adapter->add(library, Ice::stringToIdentity("library"));

    //
    // Create and install a factory for books.
    //
    Ice::ValueFactoryPtr bookFactory = new BookFactory(library);
    communicator()->getValueFactoryManager()->add(bookFactory, Demo::Book::ice_staticId());

    //
    // Everything ok, let's go.
    //
    shutdownOnInterrupt();
    adapter->activate();
    communicator()->waitForShutdown();
    ignoreInterrupt();

    return EXIT_SUCCESS;
}
开发者ID:ming-hai,项目名称:freeze,代码行数:53,代码来源:Server.cpp

示例7: admin

TraceLevels::TraceLevels(const Ice::CommunicatorPtr& communicator, const string& prefix) :
    admin(0),
    adminCat("Admin"),
    application(0),
    applicationCat("Application"),
    node(0),
    nodeCat("Node"),
    replica(0),
    replicaCat("Replica"),
    server(0),
    serverCat("Server"),
    adapter(0),
    adapterCat("Adapter"),
    object(0),
    objectCat("Object"),
    activator(0),
    activatorCat("Activator"),
    patch(0),
    patchCat("Patch"),
    locator(0),
    locatorCat("Locator"),
    session(0),
    sessionCat("Session"),
    logger(communicator->getLogger())
{
    Ice::PropertiesPtr properties = communicator->getProperties();

    string keyBase = prefix + ".Trace.";
    const_cast<int&>(admin) = properties->getPropertyAsInt(keyBase + adminCat);
    const_cast<int&>(application) = properties->getPropertyAsInt(keyBase + applicationCat);
    const_cast<int&>(node) = properties->getPropertyAsInt(keyBase + nodeCat);
    const_cast<int&>(replica) = properties->getPropertyAsInt(keyBase + replicaCat);
    const_cast<int&>(server) = properties->getPropertyAsInt(keyBase + serverCat);
    const_cast<int&>(adapter) = properties->getPropertyAsInt(keyBase + adapterCat);
    const_cast<int&>(object) = properties->getPropertyAsInt(keyBase + objectCat);
    const_cast<int&>(activator) = properties->getPropertyAsInt(keyBase + activatorCat);
    const_cast<int&>(patch) = properties->getPropertyAsInt(keyBase + patchCat);
    const_cast<int&>(locator) = properties->getPropertyAsInt(keyBase + locatorCat);
    const_cast<int&>(session) = properties->getPropertyAsInt(keyBase + sessionCat);
}
开发者ID:yuanbaopapa,项目名称:ice,代码行数:40,代码来源:TraceLevels.cpp

示例8: TestI

void
ServiceI::start(const string& name,
                const CommunicatorPtr& communicator,
                const StringSeq& args)
{
    Ice::PropertiesPtr properties = communicator->getProperties();
    Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter(name);
    if(properties->getPropertyAsInt(name + ".Freeze") > 0)
    {
        //
        // We do this to ensure the dbenv directory exists.
        //
        Freeze::createConnection(communicator, name);
    }
    Ice::ObjectPtr object = new TestI(adapter, properties);
    adapter->add(object, communicator->stringToIdentity(properties->getProperty(name + ".Identity")));
    adapter->activate();
}
开发者ID:updowndown,项目名称:myffff,代码行数:18,代码来源:Service.cpp

示例9: ex

TrustManager::TrustManager(const Ice::CommunicatorPtr& communicator) :
    _communicator(communicator)
{
    Ice::PropertiesPtr properties = communicator->getProperties();
    _traceLevel = properties->getPropertyAsInt("IceSSL.Trace.Security");
    string key;
    try
    {
        key = "IceSSL.TrustOnly";
        parse(properties->getProperty(key), _rejectAll, _acceptAll);
        key = "IceSSL.TrustOnly.Client";
        parse(properties->getProperty(key), _rejectClient, _acceptClient);
        key = "IceSSL.TrustOnly.Server";
        parse(properties->getProperty(key), _rejectAllServer, _acceptAllServer);
        Ice::PropertyDict dict = properties->getPropertiesForPrefix("IceSSL.TrustOnly.Server.");
        for(Ice::PropertyDict::const_iterator p = dict.begin(); p != dict.end(); ++p)
        {
            string name = p->first.substr(string("IceSSL.TrustOnly.Server.").size());
            key = p->first;
            list<DistinguishedName> reject, accept;
            parse(p->second, reject, accept);
            if(!reject.empty())
            {
                _rejectServer[name] = reject;
            }
            if(!accept.empty())
            {
                _acceptServer[name] = accept;
            }
        }
    }
    catch(const ParseException& e)
    {
        Ice::PluginInitializationException ex(__FILE__, __LINE__);
        ex.reason = "IceSSL: invalid property " + key  + ":\n" + e.reason;
        throw ex;
    }
}
开发者ID:Jonavin,项目名称:ice,代码行数:38,代码来源:TrustManager.cpp

示例10: initialize

void MyUtil::initialize() {

	ServiceI& service = ServiceI::instance();

	// 注册SubjectObserver
	service.getAdapter()->add(&SubjectObserverI::instance(), service.createIdentity("SO", ""));

	// 注册AdminConsole
	// AdminConsoleManagerI::instance().registerComponent("ClusterController", "CC", &ControllerManagerI::instance());
	// service.getAdapter()->add(&AdminConsoleManagerI::instance(), service.createIdentity("ACM", ""));

	// 注册Controller
	service.getAdapter()->add(&ControllerManagerI::instance(), service.createIdentity("M", ""));

	// Controller初始化&开始运行
	Ice::PropertiesPtr prop = service.getCommunicator()->getProperties();
	int intervalFetch =  prop->getPropertyAsIntWithDefault("Fetch.Interval", 5);
	int intervalNotify =  prop->getPropertyAsIntWithDefault("Notify.Interval", 120);
	int cluster =  prop->getPropertyAsInt("Server.Cluster");	// cluster改为在controller设置 -- 090727 by zhanghan

	ControllerManagerI::instance().initialize(cluster, intervalFetch, intervalNotify);
  ServiceMonitorManager::instance().start();
}
开发者ID:bradenwu,项目名称:oce,代码行数:23,代码来源:ClusterControllerI.cpp

示例11: BankInitializer

int
CasinoServer::run(int argc, char*[])
{
    if(argc > 1)
    {
        cerr << appName() << ": too many arguments" << endl;
        return EXIT_FAILURE;
    }

    //
    // Initialize pseudo-random number generator
    //
    srand((unsigned int)IceUtil::Time::now().toMicroSeconds());

    Ice::PropertiesPtr properties = communicator()->getProperties();

    _bankEdge = properties->getPropertyAsInt("Bank.Edge");
    if(_bankEdge < 1)
    {
        _bankEdge = 1;
    }
    cout << "Bank edge is " << _bankEdge << endl;

    //
    // Create an object adapter
    //
    Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("Casino");

    //
    // Register factories
    //
    communicator()->addValueFactory(new ValueFactory<BankI>, CasinoStore::PersistentBank::ice_staticId());
    communicator()->addValueFactory(new ValueFactory<PlayerI>, CasinoStore::PersistentPlayer::ice_staticId());
    communicator()->addValueFactory(new ValueFactory<BetI>, CasinoStore::PersistentBet::ice_staticId());

    //
    // Create evictors; each type gets its own type-specific evictor
    //

    //
    // Bank evictor
    //

    class BankInitializer : public Freeze::ServantInitializer
    {
    public:

        BankInitializer(CasinoServer& server) :
            _server(server)
        {
        }

        virtual void
        initialize(const Ice::ObjectAdapterPtr& /*adapter*/, const Ice::Identity& /*identity*/, const string& /*facet*/,
                   const Ice::ObjectPtr& servant)
        {
            BankI* bank = dynamic_cast<BankI*>(servant.get());
            bank->init(_server._bankPrx, _server._bankEvictor, _server._playerEvictor, _server._betEvictor,
                       _server._betResolver, _server._bankEdge);
        }

    private:

        BankInitializer& operator=(const BankInitializer&) { return *this; }

        CasinoServer& _server;
    };

    _bankEvictor =
        Freeze::createTransactionalEvictor(adapter, _envName, "bank",
                                           createTypeMap(CasinoStore::PersistentBank::ice_staticId()),
                                           new BankInitializer(*this));

    int size = properties->getPropertyAsInt("Bank.EvictorSize");
    if(size > 0)
    {
        _bankEvictor->setSize(size);
    }

    adapter->addServantLocator(_bankEvictor, "bank");

    //
    // Player evictor
    //

    class PlayerInitializer : public Freeze::ServantInitializer
    {
    public:

        PlayerInitializer(CasinoServer& server) :
            _server(server)
        {
        }

        virtual void
        initialize(const Ice::ObjectAdapterPtr& adptr, const Ice::Identity& identity, const string& /*facet*/,
                   const Ice::ObjectPtr& servant)
        {
            CasinoStore::PersistentPlayerPrx prx =
                CasinoStore::PersistentPlayerPrx::uncheckedCast(adptr->createProxy(identity));
//.........这里部分代码省略.........
开发者ID:fengpsky,项目名称:freeze,代码行数:101,代码来源:Server.cpp

示例12: runParser

int
PhoneBookCollocated::run(int argc, char* argv[])
{
    Ice::PropertiesPtr properties = communicator()->getProperties();

    //
    // Create and install a factory for contacts.
    //
    ContactFactoryPtr contactFactory = new ContactFactory();
    communicator()->addObjectFactory(contactFactory, Demo::Contact::ice_staticId());

    //
    // Create the name index.
    //
    NameIndexPtr index = new NameIndex("name");
    vector<Freeze::IndexPtr> indices;
    indices.push_back(index);

    //
    // Create an object adapter, use the evictor as servant locator.
    //
    Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("PhoneBook");

    //
    // Create an evictor for contacts.
    //
    // When Freeze.Evictor.db.contacts.PopulateEmptyIndices is not 0
    // and the Name index is empty, Freeze will traverse the database
    // to recreate the index during createXXXEvictor(). Therefore the
    // factories for the objects stored in evictor (contacts here)
    // must be registered before the call to createXXXEvictor().
    //
    Freeze::EvictorPtr evictor = Freeze::createBackgroundSaveEvictor(adapter, _envName, "contacts", 0, indices);
    adapter->addServantLocator(evictor, "contact");

    Ice::Int evictorSize = properties->getPropertyAsInt("EvictorSize");
    if(evictorSize > 0)
    {
        evictor->setSize(evictorSize);
    }

    //
    // Completes the initialization of the contact factory. Note that ContactI/
    // ContactFactoryI uses this evictor only when a Contact is destroyed,
    // which cannot happen during createXXXEvictor().
    //
    contactFactory->setEvictor(evictor);
    
    //
    // Create the phonebook, and add it to the Object Adapter.
    //
    PhoneBookIPtr phoneBook = new PhoneBookI(evictor, contactFactory, index);
    adapter->add(phoneBook, communicator()->stringToIdentity("phonebook"));
    
    //
    // Everything ok, let's go.
    //
    int runParser(int, char*[], const Ice::CommunicatorPtr&);
    int status = runParser(argc, argv, communicator());
    adapter->destroy();

    return status;
}
开发者ID:MemoRyAxis,项目名称:ice-demos,代码行数:63,代码来源:Collocated.cpp

示例13: main

int main(int argc, char** argv){



	struct sigaction sigIntHandler;

   sigIntHandler.sa_handler = exitApplication;
   sigemptyset(&sigIntHandler.sa_mask);
   sigIntHandler.sa_flags = 0;

   sigaction(SIGINT, &sigIntHandler, NULL);

	int accion=0;
	int sentido=10;

	int status;

	struct timeval a, b, t2;
	int cycle = 100;
	long totalb,totala;
	long diff;

	// INTERFACE
	std::vector<jderobot::LaserPrx> lprx;
	std::vector<jderobot::CameraPrx> cprx;
	std::vector<jderobot::Pose3DEncodersPrx> pose3dencoders;
	std::vector<jderobot::Pose3DPrx> pose3dprx;
	std::vector<jderobot::EncodersPrx> encoders;
	std::vector <jderobot::pointCloudPrx> prx;


	//INTERFACE DATA
	jderobot::EncodersDataPtr ed;
	jderobot::LaserDataPtr ld;
	
	jderobot::ImageDataPtr imageData;

	//pools

	pthread_attr_t attr;
	//images
	std::vector<recorder::poolWriteImages*> poolImages;
	int nConsumidores;
	int poolSize;
	//lasers
	std::vector<recorder::poolWriteLasers*> poolLasers;
	//pose3dencoders
	std::vector<recorder::poolWritePose3dEncoders*> poolPose3dEncoders;
	//pose3d
	std::vector<recorder::poolWritePose3d*> poolPose3d;
	//encoders
	std::vector<recorder::poolWriteEncoders*> poolEncoders;
	//pointClouds
	std::vector<recorder::poolWritePointCloud*> poolPointClouds;

	//numero de lasers

	int Hz = 10;
	int muestrasLaser = 180;
	int pngCompressRatio;
	int jpgQuality;
    std::string fileFormat;
	std::vector<int> compression_params;
    
   
	//---------------- INPUT ARGUMENTS ---------------//

	if (argc<2){
		std::cout << std::endl << "USE: ./mycomponent --Ice.Config=mycomponent.cfg" << std::endl;
	}

	//---------------- INPUT ARGUMENTS -----------------//

	try{
		//creamos el directorio principal
		struct stat buf;
		char dire[]="./data/";
		if( stat( dire, &buf ) == -1 )
		{
			system("mkdir data");
		}
   
		Ice::PropertiesPtr prop;

		ic = Ice::initialize(argc,argv);

		prop = ic->getProperties();

		Hz = prop->getPropertyAsInt("Recorder.Hz");
		cycle = 1000.0/Hz;
      
		pthread_attr_init(&attr);
		pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
      

		nCameras = prop->getPropertyAsIntWithDefault("Recorder.nCameras",0);
		if (nCameras > 0 ){
			struct stat buf;
			char dire[]="./data/images/";
			if( stat( dire, &buf ) == -1 )
//.........这里部分代码省略.........
开发者ID:mmoya,项目名称:jderobot,代码行数:101,代码来源:recorder2.cpp

示例14: string

Sensors::Sensors(Ice::CommunicatorPtr ic)
{
    this-> ic = ic;
    Ice::PropertiesPtr prop = ic->getProperties();


    ////////////////////////////// ENCODERS //////////////////////////////
    // Contact to ENCODERS interface
    Ice::ObjectPrx baseEncoders = ic->propertyToProxy("introrob.Encoders.Proxy");
    if (0 == baseEncoders)
        throw "Could not create proxy with encoders";

    // Cast to encoders
    eprx = jderobot::EncodersPrx::checkedCast(baseEncoders);
    if (0 == eprx)
        throw "Invalid proxy introrob.Encoders.Proxy";

    ////////////////////////////// CAMERA1 /////////////////////////////2

    Ice::ObjectPrx baseCamera1 = ic->propertyToProxy("introrob.Camera1.Proxy");
    if (0==baseCamera1)
      throw "Could not create proxy";

    /*cast to CameraPrx*/
    camera1 = jderobot::CameraPrx::checkedCast(baseCamera1);
    if (0==camera1)
      throw "Invalid proxy";

    jderobot::ImageDataPtr data = camera1->getImageData(camera1->getImageFormat().at(0));
    image1.create(data->description->height, data->description->width, CV_8UC3);

    ////////////////////////////// CAMERA2 /////////////////////////////2
    Ice::ObjectPrx baseCamera2 = ic->propertyToProxy("introrob.Camera2.Proxy");
    if (0==baseCamera2)
      throw "Could not create proxy";

    /*cast to CameraPrx*/
    camera2 = jderobot::CameraPrx::checkedCast(baseCamera2);
    if (0==camera2)
      throw "Invalid proxy";

    data = camera2->getImageData(camera2->getImageFormat().at(0));
    image2.create(data->description->height, data->description->width, CV_8UC3);

    ////////////////////////////// LASER //////////////////////////////
    boolLaser = prop->getPropertyAsInt("introrob.Laser");

    std::cout << "Laser " <<  boolLaser << std::endl;
    if(boolLaser){
        // Contact to LASER interface
        Ice::ObjectPrx laserICE = ic->propertyToProxy("introrob.Laser.Proxy");
        if (0 == laserICE)
            throw "Could not create proxy with Laser";

        // Cast to LASER
        laserprx = jderobot::LaserPrx::checkedCast(laserICE);
        if (0 == laserprx){
           throw std::string("Invalid proxy introrob.Laser.Proxy");
        }
    }
}
开发者ID:DanielYS,项目名称:JdeRobot,代码行数:61,代码来源:sensors.cpp

示例15: Connect


//.........这里部分代码省略.........
		return -1;
	}

	try
	{
		std::string verS = _session->GetVersion();
		Ice::PropertiesPtr prop = _communicator->getProperties();
		std::string serverV = prop->getPropertyWithDefault("LbanetServerVersion", "v0");
		if(verS != serverV)
		{
			reason = "Server version mismatch - please update your game.";
			Disconnect();
			return -1;
		}
	}
	catch(const Ice::Exception& ex)
	{
		LogHandler::getInstance()->LogToFile(std::string("Error getting server version: ") + ex.what());
		return 0;
	}


	try
	{
		_adapter = _communicator->createObjectAdapter("LbaNetClient");
		_adapter->activate();

	}
	catch(const Ice::Exception& ex)
	{
		LogHandler::getInstance()->LogToFile(std::string("Error creating adapter: ") + ex.what());
		return 0;
	}


	// clear online list
	ThreadSafeWorkpile::JoinEvent evcl;
	evcl.ListName = "online";
	evcl.Clear = true;
	ThreadSafeWorkpile::getInstance()->HappenedJoinEvent(evcl);


	// fill it with already connected people
	if(_session)
	{
		Ice::Long ownid = -1;
		LbaNet::ConnectedL listco = _session->GetConnected(ownid);
		ThreadSafeWorkpile::getInstance()->SetPlayerId(ownid);
		LbaNet::ConnectedL::const_iterator it = listco.begin();
		LbaNet::ConnectedL::const_iterator end = listco.end();
		for(;it != end; ++it)
		{
			ThreadSafeWorkpile::JoinEvent ev;
			ev.ListName = "online";
			ev.Joined = true;
			ev.Clear = false;
			ev.Nickname = it->first;
			ev.Status = it->second.Status;
			ev.Color = it->second.NameColor;
			ThreadSafeWorkpile::getInstance()->HappenedJoinEvent(ev);
			ThreadSafeWorkpile::getInstance()->ChatColorChanged(ev.Nickname, ev.Color);
		}

		//synchronize time with server
		//SynchronizedTimeHandler::getInstance()->Initialize(session);
	}



	IceUtil::ThreadPtr t = new SendingLoopThread(_adapter, _session,
						_router->getServerProxy()->ice_getIdentity().category,
						user);
	_tc = t->start();
	_thread_started = true;


	//---------------------------------------------------------------
	// start the irc thread
	Ice::PropertiesPtr prop = _communicator->getProperties();
	_ircOn = (prop->getPropertyAsInt("IrcOn") == 1);
	std::string IrcServer = prop->getProperty("IrcServer");
	std::string IrcChannel = "#" + prop->getProperty("IrcChannel");
	if(_ircOn)
	{
		ircon = true;
		IrcThread::IrcCoInfo coi;
		coi.Server = IrcServer;
		coi.Nickname = user;
		coi.Channel = IrcChannel;

		_ircth = new IrcThread(coi);
		_tcirc = _ircth->start();
	}
	else
		ircon = false;



	return 1;
}
开发者ID:leloulight,项目名称:lbanet,代码行数:101,代码来源:ServerConnectionHandler.cpp


注:本文中的ice::PropertiesPtr::getPropertyAsInt方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。