• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ boost::scoped_ptr类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中boost::scoped_ptr的典型用法代码示例。如果您正苦于以下问题:C++ scoped_ptr类的具体用法?C++ scoped_ptr怎么用?C++ scoped_ptr使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: alloc

    /** allocs a scoped_block for a new key
     ** doesn't support reallocing on an existing key, maybe in the future */
    void alloc(boost::scoped_ptr< variable_store::scoped_block > & p,
               const Key & key,
               size_t block_size)
    {
        boost::mutex::scoped_lock lock(m_mutex);
        // don't support reallocing for now
        typename hm_key_location::const_iterator it = m_key_location.find(key);

        if (it != m_key_location.end())
            throw std::invalid_argument("realloc not supported");

        p.reset( new variable_store::scoped_block(m_variable_store, block_size) );
        m_key_location[key] = location(p->block_size(), p->index());
    }
开发者ID:KublaikhanGeek,项目名称:libmoost,代码行数:16,代码来源:map_store.hpp


示例2: lock

LogBackend& LogBackend::instance()
{
	static boost::scoped_ptr< LogBackend >	m_t;
	static boost::mutex			m_mutex;
	static bool				m_initialized = false;

	if ( !m_initialized )	{
		boost::lock_guard< boost::mutex > lock( m_mutex );
		if ( !m_initialized )	{
			m_t.reset( new LogBackend() );
			m_initialized = true;
		}
	}
	return *m_t;
}
开发者ID:ProjectTegano,项目名称:Tegano,代码行数:15,代码来源:logBackendImpl.cpp


示例3: p_solve

 /// Solve the problem
 void p_solve(const p_optimizeMethod& m)
 {
   switch (m) {
   case (Maximize):
     p_impl->maximize();
     break;
   case (Minimize):
     p_impl->minimize();
     break;
   default:
     BOOST_ASSERT(false);
   }
 }
开发者ID:,项目名称:,代码行数:14,代码来源:


示例4: handle_start

    virtual void handle_start()
    {
        tcp::resolver resolver(main_pool().io_service());
        tcp::endpoint endpoint = *resolver.resolve(addr_query_);

        acceptor_.reset(new tcp::acceptor(main_pool().io_service()));
        acceptor_->open(endpoint.protocol());
        acceptor_->set_option(tcp::acceptor::reuse_address(true));
        acceptor_->bind(endpoint);
        acceptor_->listen();
        start_accept();

        std::cout << "Server started" << std::endl;
    }
开发者ID:mrZreat,项目名称:AsioTest,代码行数:14,代码来源:echo_server.cpp


示例5:

bool CameraV4LPublisher::getImage(cv::Mat& img, bool emptyBuffer)
{
  bool ok = false;
  if ( emptyBuffer )
  {
    for (int i = 0; i < 4; ++i) //v4l stores a buffer of 4 images
      _capture->grab();
  }
  if ( _capture->grab() )
    if ( _capture->retrieve(img) )
      ok = true;

  return ok;
}
开发者ID:pal-robotics,项目名称:camera_v4l,代码行数:14,代码来源:node.cpp


示例6: configure

        /*! @brief configure the detector state
         *
         * The configure method is called once when the ECTO cell is launched,
         * and is designed to initialise the detector state and load models,
         * parameters, etc.
         *
         * @param params the parameters made available through the config file and
         * python bindings
         * @param inputs for initializing inputs, if necessary
         * @param outputs for initializing outputs, if necessary
         */
        void
        configure(const tendrils& params, const tendrils& inputs, const tendrils& outputs) {

            // create the model object and deserialize it
            FileStorageModel model;
            model.deserialize(*model_file_);

            // create the visualizer
            visualizer_.reset(new Visualize(model.name()));

            // create the PartsBasedDetector and distribute the model parameters
            detector_.reset(new PartsBasedDetector<float>);
            detector_->distributeModel(model);
        }
开发者ID:singhshalender,项目名称:PartsBasedDetector,代码行数:25,代码来源:detect.cpp


示例7: VisualServo

  VisualServo() : arm_("left"),
		planning_group_name_(arm_+"_arm"),
		camera_frame_(arm_+"_hand_camera")
  {
    move_group_.reset(new move_group_interface::MoveGroup(planning_group_name_));
    move_group_->setPlanningTime(30.0);
    move_group_->setPlannerId("RRTstark");
    while(ros::ok())
      {
	// marker_pose_subscriber_ = node_.subscribe("ar_pose_marker",50, &VisualServo::marker_pose_callback, this);
	// target_publisher_ = node_.advertise<geometry_msgs::Pose>("/visual_servo_target", 10);
	servo_to_tag();
      }
  }
开发者ID:ktiwari9,项目名称:baxter_barcode_pickup,代码行数:14,代码来源:ar_viz_servo.cpp


示例8: reset

	void reset()
	{
		fallback.reset();
		effects.clear();
		if(target)
			target.Release();
		if(offsetTarget)
			offsetTarget.Release();

		vbuffer.reset();
		ibuffer.reset();
		vshader.reset();
		pshader.reset();
	}
开发者ID:,项目名称:,代码行数:14,代码来源:


示例9:

		~FiberControl(){
			AUTO(it, g_stack_pool.begin());
			for(;;){
				if(it == g_stack_pool.end()){
					stack.reset();
					break;
				}
				if(!*it){
					stack.swap(*it);
					break;
				}
				++it;
			}
		}
开发者ID:chenbk85,项目名称:poseidon,代码行数:14,代码来源:job_dispatcher.cpp


示例10: HeartbeatArrival

void HeartbeatArrival(uint16_t sourceId, const std::uint8_t *data, std::uint8_t len)
{
	if (len<5)
		return;
	CANExtended::DeviceState state = static_cast<CANExtended::DeviceState>(data[0]);
	if (state != CANExtended::Operational)
		return;
	auto unit = unitManager->FindUnit(sourceId&0x7f);
	bool updated = (unit!=nullptr) && (unit->UpdateStatus()==StorageUnit::Updated);
	
	if (unit == nullptr || updated)
	{
		StorageBasic basic(CanEx);
		basic.DeviceId = sourceId;
		basic.SensorNum = data[2];
		basic.Version = (data[3]<<8)|data[4];
		switch (data[1])
		{
			case UNIT_TYPE_INDEPENDENT:
				unit.reset(new IndependentUnit(basic));
				break;
			case UNIT_TYPE_UNITY:
				unit.reset(new UnityUnit(basic));
				break;
			case UNIT_TYPE_UNITY_RFID:
				unit.reset(new RfidUnit(basic));
				break;
			default:
				CanEx->Sync(sourceId, DeviceSync::SyncLive,  CANExtended::Trigger);
				return;
		}
		unit->ReadCommandResponse.bind(ethEngine.get(), &NetworkEngine::DeviceReadResponse);
		unit->WriteCommandResponse.bind(ethEngine.get(), &NetworkEngine::DeviceWriteResponse);
		CanEx->RegisterDevice(unit);
		if (updated)
		{	
			unitManager->Recover(sourceId&0x7f, unit);
#ifdef DEBUG_PRINT
			cout<<"#Recovered Device 0x"<<std::hex<<sourceId<<std::dec<<endl;
#endif
		}
		else
		{
			unitManager->Add(sourceId&0x7f, unit);
#ifdef DEBUG_PRINT
			cout<<"#Added Device 0x"<<std::hex<<sourceId<<std::dec<<endl;
#endif
		}
	}
	//CanEx->Sync(sourceId, DeviceSync::SyncLive, CANExtended::AutoSync); //Confirm & Start AutoSync
	CanEx->Sync(sourceId, DeviceSync::SyncLive, CANExtended::Trigger);
	if (updated)
		unitManager->SyncUpdate();
}
开发者ID:chinnyannieb,项目名称:iValuable,代码行数:54,代码来源:main.cpp


示例11: Initialize

		//-----------------------------------------------------------------------------
		void Editor::Initialize(Main::IGame* pGame)
		{
				m_pGame = pGame;

				Core::IGameStateManager* pStateMan = m_pGame->GetGameStateManager();
				Main::GameStateTest::Create(pStateMan, "StateTest");

				pStateMan->Change(pStateMan->FindByName("StateTest"));

				m_pGrid.reset(m_pGame->GetEngine()->CreateGrid());
				m_pGrid->Initialze(100.f, 1.f);

				m_pCamManipulator.reset(m_pGame->GetEngine()->CreateCameraManipulator());
				m_pCamManipulator->Set(Ogre::Vector3(-50.f, 0.f, 50.f),Ogre::Vector3(0,0,0));
		}
开发者ID:kdjoon42,项目名称:ProjectJ,代码行数:16,代码来源:Editor.cpp


示例12: catch

~OmniNamesFixture() {
  BOOST_TEST_MESSAGE("== Test teardown [BEGIN]: Stopping OmniNames ==");
  bf::remove_all(logdir);

  if (processNamingService) {
    try {
     processNamingService->terminate();
     processNamingService->wait();
    } catch (...) {
      BOOST_TEST_MESSAGE("== Problem while ending OmniNames ==");
    }
  }
  boost::this_thread::sleep(boost::posix_time::milliseconds(SLEEP_TIME));
  BOOST_TEST_MESSAGE("== Test teardown [END]: Stopping OmniNames ==");
}
开发者ID:SysFera,项目名称:libdadiCORBA,代码行数:15,代码来源:fixtures.hpp


示例13:

sound::InputStream*
Sound_as::attachAuxStreamerIfNeeded()
{
    media::AudioInfo* audioInfo =  _mediaParser->getAudioInfo();
    if (!audioInfo) return 0;

    // the following may throw an exception
    _audioDecoder.reset(_mediaHandler->createAudioDecoder(*audioInfo).release());

    // start playing ASAP, a call to ::start will just change _startTime
#ifdef GNASH_DEBUG_SOUND_AS
    log_debug("Attaching the aux streamer");
#endif
    return _soundHandler->attach_aux_streamer(getAudioWrapper, (void*) this);
}
开发者ID:ascendancy721,项目名称:gnash,代码行数:15,代码来源:Sound_as.cpp


示例14: datasource_exception

    boost::shared_ptr<mongo::DBClientCursor> query(const std::string &json, int limit = 0, int skip = 0) {
        try {
            mongo::DBClientCursor *ptr = conn_->get()->query(ns_, mongo::Query(json), limit, skip).release();

            if (!ptr)
                throw conn_->get()->getLastError();

            return boost::shared_ptr<mongo::DBClientCursor>(ptr);
        } catch(mongo::DBException &de) {
            std::string err_msg = "Mongodb Plugin: ";
            err_msg += de.toString();
            err_msg += "\n";
            throw mapnik::datasource_exception(err_msg);
        }
    }
开发者ID:ErmakovDmitriy,项目名称:mapnik-mongo,代码行数:15,代码来源:connection.hpp


示例15: update_timestamp

static void update_timestamp( bool force = false )
{
    static const boost::posix_time::time_duration timeout = boost::posix_time::seconds( 60 );
    static boost::posix_time::ptime last = boost::posix_time::microsec_clock::universal_time();
    boost::posix_time::ptime now = boost::posix_time::microsec_clock::universal_time();
    if( !force && ( now - last ) < timeout ) { return; }
    if( verbose ) { std::cerr << "sick-ldmrs-stream: setting time to " << boost::posix_time::to_iso_string( now ) << "..." << std::endl; }
    std::pair< comma::uint32, comma::uint32 > ntp = snark::timing::to_ntp_time( now );
    clear_fault();
    if( !protocol->write( sick::ibeo::commands::set_ntp_seconds( ntp.first ) ).ok() ) { COMMA_THROW( comma::exception, "failed to set NTP seconds" ); }
    clear_fault();
    if( !protocol->write( sick::ibeo::commands::set_ntp_fractions( ntp.second ) ).ok() ) { COMMA_THROW( comma::exception, "failed to set NTP fractions" ); }
    last = now;
    if( verbose ) { std::cerr << "sick-ldmrs-stream: set time to " << boost::posix_time::to_iso_string( now ) << std::endl; }
}
开发者ID:WangFei-DUT,项目名称:snark,代码行数:15,代码来源:sick-ldmrs-stream.cpp


示例16: train

 void train(DataView2D<FeatureType> samples, 
            DataView2D<int> labels, 
            int* sample_idxes, 
            size_t n_samples, 
            SplitGenerator split_generator,
            RandomGen const& gen
            ) 
 {
     // copy generator
     RandomGen my_gen = gen;
     // initialize root node
     root_node.reset(new NodeT(0, params));
     // train root node (other notes get trained recursively)
     root_node->train(samples, labels, sample_idxes, n_samples, split_generator, my_gen);
 }
开发者ID:qnzhou,项目名称:cgal,代码行数:15,代码来源:tree.hpp


示例17: Traversal

static void Traversal(void const *argument)  //Prevent missing status
{
	static bool forceReport = true;
	while(1)
	{
		if (!ethEngine->IsConnected())
		{
			forceReport = true;
			continue;
		}
		unitManager->Traversal(forceReport);	//Update all units
		forceReport = false;
		osThreadYield();
	}
}
开发者ID:chinnyannieb,项目名称:iValuable,代码行数:15,代码来源:main.cpp


示例18: last

	virtual bool last() {
		current = end;
		while (current != begin) {
			--current;

			nested_current.reset((*current)->lines());

			if (nested_current->last()) {
				valid = true;
				return true;
			}
		}

		valid = false;
		return false;
	}
开发者ID:BBBSnowball,项目名称:mehari,代码行数:16,代码来源:pprint_vcat.cpp


示例19: clear_fault

static bool clear_fault()
{
    boost::optional< sick::ibeo::fault > fault = protocol->last_fault();
    if( !fault ) { return true; }
    std::cerr << "sick-ldmrs-stream: " << *fault << std::endl;
    return !fault->fatal();
}
开发者ID:WangFei-DUT,项目名称:snark,代码行数:7,代码来源:sick-ldmrs-stream.cpp


示例20: similarity_path

    float similarity_path(float const* sample_1, float const* sample_2) {
        NodeT const* node_1 = root_node.get();
        NodeT const* node_2 = root_node.get();
        int n_common = 0;
        int n_1 = 1;
        int n_2 = 1;

        while (node_1 == node_2) {
            if (node_1->is_leaf) {
                return 1;
            }
            n_common++;
            node_1 = node_1->split(sample_1);
            node_2 = node_2->split(sample_2);
        }
        while (!node_1->is_leaf) {
            node_1 = node_1->split(sample_1);
            n_1++;
        }
        while (!node_2->is_leaf) {
            node_2 = node_2->split(sample_2);
            n_2++;
        }
        return n_common/sqrt((n_common + n_1)*(n_common + n_2));
    }
开发者ID:qnzhou,项目名称:cgal,代码行数:25,代码来源:tree.hpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ boost::shared_array类代码示例发布时间:2022-05-31
下一篇:
C++ boost::scoped_array类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap