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

C++ copy_from函数代码示例

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

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



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

示例1: rtlx_write

ssize_t rtlx_write(int index, void *buffer, size_t count, int user)
{
	struct rtlx_channel *rt;
	size_t fl;

	if (rtlx == NULL)
		return(-ENOSYS);

	rt = &rtlx->channel[index];

	/* total number of bytes to copy */
	count = min(count,
		    (size_t)write_spacefree(rt->rt_read, rt->rt_write,
					    rt->buffer_size));

	/* first bit from write pointer to the end of the buffer, or count */
	fl = min(count, (size_t) rt->buffer_size - rt->rt_write);

	copy_from (&rt->rt_buffer[rt->rt_write], buffer, fl, user);

	/* if there's any left copy to the beginning of the buffer */
	if( count - fl )
		copy_from (rt->rt_buffer, buffer + fl, count - fl, user);

	rt->rt_write += count;
	rt->rt_write %= rt->buffer_size;

	return(count);
}
开发者ID:BackupTheBerlios,项目名称:arp2-svn,代码行数:29,代码来源:rtlx.c


示例2: free

  JsonData& operator = ( JsonData const& rhs )
  {
    free();
    copy_from( rhs );

    return *this;
  }
开发者ID:ehwan,项目名称:miscellaneous,代码行数:7,代码来源:json.hpp


示例3: copy_from

  constant& constant::operator=(const constant& rhs)
  {
    if (this != &rhs)
      copy_from(rhs);

    return *this;
  }
开发者ID:amireh,项目名称:hasm,代码行数:7,代码来源:constant.cpp


示例4: TextureArray

 __host__
 inline TextureArray(const T *data, const Vector2i& sizes, size_t pitch,
                     cudaMemcpyKind kind = cudaMemcpyHostToDevice)
   : self_type{ sizes }
 {
   copy_from(data, sizes, pitch, kind);
 }
开发者ID:DO-CV,项目名称:shakti,代码行数:7,代码来源:TextureArray.hpp


示例5: copy_from

void GraphicConfig::interpolate(GraphicConfig &prev, 
	GraphicConfig &next, 
	int64_t prev_frame, 
	int64_t next_frame, 
	int64_t current_frame)
{
	double next_scale = (double)(current_frame - prev_frame) / (next_frame - prev_frame);
	double prev_scale = (double)(next_frame - current_frame) / (next_frame - prev_frame);

// Get current set of points from previous configuration
	copy_from(prev);
	

// Interpolate between current set of points and next set
	for(int i = 0; i < MIN(next.points.size(), points.size()); i++)
	{
		points.get(i)->freq = (int)(prev.points.get(i)->freq *
			prev_scale +
			next.points.get(i)->freq *
			next_scale);
		points.get(i)->value = prev.points.get(i)->value *
			prev_scale +
			next.points.get(i)->value *
			next_scale;
	}
}
开发者ID:petterreinholdtsen,项目名称:cinelerra-hv,代码行数:26,代码来源:graphic.C


示例6: flush_cache

bool DistributedObject::update(const DistributedLock& dist_lock, UpgradableReadLock& lock)
{
	lock.check_read(get_local_mutex());

	if (!persistence_enabled_)
		return false;

	throw std::runtime_error("Persistence currently not implemented");
#if 0
	if (&dist_lock.get_object() != this)
		throw std::runtime_error("Distributed lock has incorrect object");
	if (file_.string().empty())
		throw std::runtime_error("Distributed object has no associated file");

	try
	{
		{
			flush_cache();

			/* load from the file */
			std::ifstream file_stream(get_file().string().c_str());
			if (!file_stream)
				throw bfs::filesystem_error("open failed", get_file(), bs::error_code(errno, boost::system::posix_category));

			/* see if the file has changed, do nothing if it hasn't */
			time_t write_time = bfs::last_write_time(file_);
			if (write_time == timestamp_)
				return false;

			/* create a temporary instance to which the file will be loaded */
			DistributedObjectPtr temp_obj = boost::dynamic_pointer_cast<DistributedObject>(create_empty_instance());
			if (!temp_obj)
				throw std::runtime_error("Distributed object failed to create temporary instance");

			/* need an exclusive lock on the temporary object */
			BlockWriteLock temp_obj_lock(*temp_obj);

			InputArchive file_arch(file_stream);
			temp_obj->do_load(file_arch, temp_obj_lock);

			/* temporarily upgrade to a write lock for our local object and then apply the updates */
			BlockWriteLock write_lock(lock);
			copy_from(temp_obj, temp_obj_lock, write_lock);
		}

		/* update the timestamp */
		timestamp_ = bfs::last_write_time(file_);
	}
	catch (bfs::filesystem_error& e)
	{
		throw distributed_object_error("file error: " + std::string(e.what()));
	}
	catch (boost::archive::archive_exception& e)
	{
		throw distributed_object_error("deserialization error: " + std::string(e.what()));
	}
#endif
	return true;
}
开发者ID:Yale-LANS,项目名称:ALTO,代码行数:59,代码来源:dist_obj.cpp


示例7: copy_from

void _1080to540Config::interpolate(_1080to540Config &prev, 
	_1080to540Config &next, 
	long prev_frame, 
	long next_frame, 
	long current_frame)
{
	copy_from(prev);
}
开发者ID:knutj,项目名称:cinelerra,代码行数:8,代码来源:1080to540.C


示例8: copy_from

void CompressorConfig::interpolate(CompressorConfig &prev, 
	CompressorConfig &next, 
	int64_t prev_frame, 
	int64_t next_frame, 
	int64_t current_frame)
{
	copy_from(prev);
}
开发者ID:petterreinholdtsen,项目名称:cinelerra-hv,代码行数:8,代码来源:compressor.C


示例9: copy_from

void DeInterlaceConfig::interpolate(DeInterlaceConfig &prev, 
	DeInterlaceConfig &next, 
	int64_t prev_frame, 
	int64_t next_frame, 
	int64_t current_frame)
{
	copy_from(prev);
}
开发者ID:knutj,项目名称:cinelerra,代码行数:8,代码来源:deinterlace-cv.C


示例10: copy_from

void PhotoScaleConfig::interpolate(PhotoScaleConfig &prev, 
	PhotoScaleConfig &next, 
	int64_t prev_frame, 
	int64_t next_frame, 
	int64_t current_frame)
{
	copy_from(next);
}
开发者ID:knutj,项目名称:cinelerra,代码行数:8,代码来源:photoscale.C


示例11: copy_from

void FindObjectConfig::interpolate(FindObjectConfig &prev, 
	FindObjectConfig &next, 
	int64_t prev_frame, 
	int64_t next_frame, 
	int64_t current_frame)
{
	copy_from(prev);
}
开发者ID:petterreinholdtsen,项目名称:cinelerra-hv,代码行数:8,代码来源:findobject.C


示例12: copy_from

void PluginAClientConfig::interpolate(PluginAClientConfig &prev, 
	PluginAClientConfig &next, 
	int64_t prev_frame, 
	int64_t next_frame, 
	int64_t current_frame)
{
	copy_from(prev);
}
开发者ID:knutj,项目名称:cinelerra,代码行数:8,代码来源:pluginaclientlad.C


示例13: mem_block

  // copy construct into state 1, always.
  // This is a choice, even if X is state 2 (a numpy).
  // We copy a numpy into a regular C++ array, which can then be used at max speed.
  mem_block (mem_block const & X): size_(X.size()), py_numpy(nullptr), py_guard(nullptr) {
  try { p = new ValueType[X.size()];}
   catch (std::bad_alloc& ba) { TRIQS_RUNTIME_ERROR<< "Memory allocation error in memblock copy construction. Size :"<<X.size() << "  bad_alloc error : "<< ba.what();}
   TRACE_MEM_DEBUG("Allocating from C++ a block of size "<< X.size() << " at address " <<p);
   TRIQS_MEMORY_USED_INC(X.size());
   ref_count=1;
   weak_ref_count =0;
   // now we copy the data
#ifndef TRIQS_WITH_PYTHON_SUPPORT
   copy_from(X);
#else
   // if X is in state 1 or 3
   if (X.py_numpy==nullptr) { copy_from(X); }
   else { // X was in state 2
    // else make a new copy of the numpy ...
    import_numpy_array();
    if (!is_scalar_or_pod<ValueType>::value) TRIQS_RUNTIME_ERROR << "Internal Error : memcpy on non-scalar";
#ifdef TRIQS_NUMPY_VERSION_LT_17
    PyObject * arr3 = X.py_numpy;
#else
    // STRANGE : uncommenting this leads to a segfault on mac ???
    // TO BE INVESTIGATED, IT IS NOT NORMAL
    //if (!PyArray_Check(X.py_numpy)) TRIQS_RUNTIME_ERROR<<"Internal error : is not an array";
    PyArrayObject * arr3 = (PyArrayObject *)(X.py_numpy);
#endif
    // if we can make a memcpy, do it.
    if ( ( PyArray_ISFORTRAN(arr3)) || (PyArray_ISCONTIGUOUS(arr3)))  {
     memcpy (p,PyArray_DATA(arr3),size_ * sizeof(ValueType));
    }
    else { // if the X.py_numpy is not contiguous, first let numpy copy it properly, then memcpy
     PyObject * na = PyObject_CallMethod(X.py_numpy,(char *)"copy",nullptr);
     assert(na);
#ifdef TRIQS_NUMPY_VERSION_LT_17
     PyObject * arr = na;
#else
     if (!PyArray_Check(na)) TRIQS_RUNTIME_ERROR<<"Internal error : is not an array";
     PyArrayObject * arr = (PyArrayObject *)(na);
#endif
     assert( ( PyArray_ISFORTRAN(arr)) || (PyArray_ISCONTIGUOUS(arr)));
     memcpy (p,PyArray_DATA(arr),size_ * sizeof(ValueType));
     Py_DECREF(na);
    }
   }
#endif
  }
开发者ID:JaksaVucicevic,项目名称:triqs,代码行数:48,代码来源:mem_block.hpp


示例14: clear

		/// Assignment operator.
		Vector<T>& operator=(const Vector<T>& other) {
			if (this != &other) {
				clear();
				m_size = other.m_size;
				ensure_capacity(other.m_capacity);
				if (m_size != NULL)
					copy_from(other.m_elements, m_size);
			}
			return *this;
		}
开发者ID:Jameszjhe,项目名称:iphoneheaders,代码行数:11,代码来源:KBVector.hpp


示例15: m_manager

goal::goal(goal const & src):
    m_manager(src.m()),
    m_ref_count(0),
    m_depth(0), 
    m_models_enabled(src.models_enabled()),
    m_proofs_enabled(src.proofs_enabled()), 
    m_core_enabled(src.unsat_core_enabled()), 
    m_inconsistent(false), 
    m_precision(PRECISE) {
    copy_from(src);
    }
开发者ID:CharudattaSChitale,项目名称:sygus-comp14,代码行数:11,代码来源:goal.cpp


示例16: copy_from

void PianoConfig::interpolate(PianoConfig &prev, 
	PianoConfig &next, 
	int64_t prev_frame, 
	int64_t next_frame, 
	int64_t current_frame)
{
	double next_scale = (double)(current_frame - prev_frame) / (next_frame - prev_frame);
	double prev_scale = (double)(next_frame - current_frame) / (next_frame - prev_frame);

	copy_from(prev);
	wetness = (int)(prev.wetness * prev_scale + next.wetness * next_scale);
	base_freq = (int)(prev.base_freq * prev_scale + next.base_freq * next_scale);
}
开发者ID:knutj,项目名称:cinelerra,代码行数:13,代码来源:piano.C


示例17: copy_from

    archive_options_create::archive_options_create(const archive_options_create & ref)
    {
	x_selection = x_subtree = x_ea_mask = x_compr_mask = x_backup_hook_file_mask = NULL;
	x_entrepot = NULL;
	try
	{
	    copy_from(ref);
	}
	catch(...)
	{
	    destroy();
	    throw;
	}
    }
开发者ID:simon-el,项目名称:dar-code,代码行数:14,代码来源:archive_options.cpp


示例18: copy_from

void SynthConfig::interpolate(SynthConfig &prev, 
	SynthConfig &next, 
	int64_t prev_frame, 
	int64_t next_frame, 
	int64_t current_frame)
{
	double next_scale = (double)(current_frame - prev_frame) / (next_frame - prev_frame);
	double prev_scale = (double)(next_frame - current_frame) / (next_frame - prev_frame);

	copy_from(prev);
	wetness = (int)(prev.wetness * prev_scale + next.wetness * next_scale);
//	base_freq = (int)(prev.base_freq * prev_scale + next.base_freq * next_scale);

	momentary_notes = prev.momentary_notes;
}
开发者ID:knutj,项目名称:cinelerra,代码行数:15,代码来源:synthesizer.C


示例19: destroy

    const escape_catalogue & escape_catalogue::operator = (const escape_catalogue &ref)
    {
	catalogue *me = this;
	const catalogue *you = &ref;

	destroy();

	    // copying the catalogue part
	*me = *you;

	    // copying the escape_catalogue specific part
	copy_from(ref);

	return *this;
    }
开发者ID:simon-el,项目名称:dar-code,代码行数:15,代码来源:escape_catalogue.cpp


示例20: d

void flowgraph::operator = ( const flowgraph& f )
{
   if( this != &f )
   {
      destructor d( &b );
      visitnodes( d, &b, &e );

      b. pred. clear( ); b. succ. clear( ); 
      e. pred. clear( ); e. succ. clear( ); 

      n = f. n;
      c = f. c;

      copy_from(f);
   }
}
开发者ID:marekbrzoska,项目名称:Compiler-Construction-Class,代码行数:16,代码来源:flowgraph.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ copy_from_user函数代码示例发布时间:2022-05-30
下一篇:
C++ copy_flags函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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