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

C++ atom类代码示例

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

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



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

示例1: location_of

 string location_of(atom atom)
 {
  int path_id=literal_id(atom.path());
  int line_id=literal_id(atom.line().trim());
  
  return concat("location",pack(path_id,line_id,atom.number()).join(",").parens());
 }
开发者ID:vmorgulys,项目名称:sandbox,代码行数:7,代码来源:class.compiler.cpp


示例2: literal_id

 int literal_id(atom value)
 {
  //string
  
  if(value.is_string())
   return _literals.index(value.get());
  
  //literal
  
  return literal_id(value.get());
 }
开发者ID:vmorgulys,项目名称:sandbox,代码行数:11,代码来源:class.compiler.cpp


示例3: bGeomSetTransform

wrl::atom::atom(const atom& that)
{
    param_map::const_iterator i;

    // Copy that atom.

    *this = that;

    // Duplicate GL state.

    if (that.fill) fill = new ogl::unit(*that.fill);
    if (that.line) line = new ogl::unit(*that.line);

    // Duplicate ODE state.

    if ((edit_geom = that.new_edit_geom(0)))
    {
        dGeomSetData     (edit_geom, this);
        bGeomSetTransform(edit_geom, current_M);
    }

    // Flush and clone each parameter separately.

    params.clear();

    for (i = that.params.begin(); i != that.params.end(); ++i)
        params[i->first] = new param(*i->second);
}
开发者ID:rlk,项目名称:thumb,代码行数:28,代码来源:wrl-atom.cpp


示例4: guard

typename basic_otp_mailbox_registry<Alloc, Mutex>::mailbox_ptr
basic_otp_mailbox_registry<Alloc, Mutex>::create_mailbox(
    const atom& a_name, boost::asio::io_service* a_svc)
{
    lock_guard<Mutex> guard(m_lock);
    if (!a_name.empty()) {
        typename std::map<atom, mailbox_ptr>::iterator it = m_by_name.find(a_name);
        if (it != m_by_name.end())
            return it->second;   // Already registered!
    }

    epid<Alloc> l_pid = m_owner_node.create_pid();
    mailbox_ptr mbox = new mailbox_type(m_owner_node, l_pid, a_name, a_svc);
    if (!a_name.empty())
        m_by_name.insert(std::pair<atom, mailbox_ptr>(a_name, mbox));
    m_by_pid.insert(std::pair<epid<Alloc>, mailbox_ptr>(l_pid, mbox));
    return mbox;
}
开发者ID:alepharchives,项目名称:eixx,代码行数:18,代码来源:basic_otp_mailbox_registry.hpp


示例5: value_of

 string value_of(atom atom)
 {
  string type=atom.type();
  string value=atom.get();
  
  if(atom.is_number())
  {
   //number
  
   if(value.is_integer())
    type="integer";
   else
   {
    check(value.is_real());

    type="real";
   }
  }
  else if(atom.is_string())
  {
   //string

   type="literal";
   value=stringify(literal_id(atom));
  }
  else if(atom.is_identifier())
  {
   //identifier
   
   value=_identifiers.index(literal_id(atom)).string_();
  }
  else
  {
   //raw

   type="literal";
   value=stringify(literal_id(atom));
  }
   
  return concat(type,value.parens());
 }
开发者ID:vmorgulys,项目名称:sandbox,代码行数:41,代码来源:class.compiler.cpp


示例6: err_bad_argument

bool basic_otp_mailbox_registry<Alloc, Mutex>::add(const atom& a_name, mailbox_ptr a_mbox)
{
    if (a_name.empty())
        throw err_bad_argument("Empty registering name!");
    if (!a_mbox->name().empty())
        throw err_bad_argument("Mailbox already registered as", a_mbox->name());
    lock_guard<Mutex> guard(m_lock);
    if (m_by_name.find(a_name) != m_by_name.end())
        return false;
    m_by_name.insert(std::pair<atom, mailbox_ptr>(a_name, a_mbox));
    a_mbox->name(a_name);
    return true;
}
开发者ID:alepharchives,项目名称:eixx,代码行数:13,代码来源:basic_otp_mailbox_registry.hpp


示例7: check

// Verify data encoding
void check(atom test, atom::type_t type, atom::enc_t enc, size_t size)
{
    atom::type_t type_found;
    atom::enc_t enc_found;
    byte_vector test_bytes = test.encode_vector();
    atom copy;

    // Dump
    printf("Atom: ");
    test.print();

    // What's in the atom?
    type_found = test.get_type();
    printf("\nData Type: %s\n", atom_type_to_string(type_found));
    if (type != type_found)
    {
        printf("*** Failed (expected %s) ***\n", atom_type_to_string(type));
        exit(1);
    }

    // How is it encoded?
    enc_found = test.get_enc();
    printf("Encoding: %s\n", atom_enc_to_string(enc_found));
    if (enc != enc_found)
    {
        printf("*** Failed (expected %s) ***\n", atom_enc_to_string(enc));
        exit(1);
    }

    // Debug
    dump(test_bytes);

    // Check total size
    if (test.get_header_size() + size != test_bytes.size())
    {
        printf("*** Failed (expected %u bytes) ***\n",
               (unsigned int)(test.get_header_size() + size));
        exit(1);
    }

    // Reconstruct atom
    printf("Testing reconstructed copy ...\n");
    copy.decode_vector(test_bytes);
    if (test != copy)
    {
        printf("*** Failed (decoded object differs) ***\n");
        exit(1);
    }

    // Bump the counter
    test_count++;
}
开发者ID:tparys,项目名称:topaz-alpha,代码行数:53,代码来源:test-atom.cpp


示例8: basic_otp_connection

 basic_otp_connection(
     connect_completion_handler h,
     boost::asio::io_service& a_svc,
     basic_otp_node<Alloc,Mutex>* a_node, const atom& a_remote_node,
     const std::string& a_cookie, int a_reconnect_secs = 0,
     const Alloc& a_alloc = Alloc())
     : m_io_service(a_svc)
     , m_node(a_node)
     , m_remote_nodename(a_remote_node)
     , m_cookie(a_cookie)
     , m_alloc(a_alloc)
     , m_connected(false)
     , m_reconnect_timer(m_io_service)
     , m_reconnect_secs(a_reconnect_secs)
     , m_abort(false)
 {
     BOOST_ASSERT(a_node != NULL);
     m_on_connect_status = h;
     m_transport = connection_type::create(
                       m_io_service, this, a_node->nodename().to_string(),
                       a_remote_node.to_string(), a_cookie, a_alloc);
 }
开发者ID:alepharchives,项目名称:eixx,代码行数:22,代码来源:basic_otp_connection.hpp


示例9: is_neighbor

//! Returns true if the current atom is covalently bonded to a given atom.
bool atom::is_neighbor(const atom& a) const
{
	assert(this != &a);
	const double r = 1.1 * (covalent_radius() + a.covalent_radius());
	return distance_sqr(coord, a.coord) < r * r;
}
开发者ID:HongjianLi,项目名称:igrow,代码行数:7,代码来源:atom.cpp


示例10: has_covalent_bond

	/// Returns true if the current atom is covalently bonded to a given atom.
	bool has_covalent_bond(const atom& a) const
	{
		const float s = covalent_radius() + a.covalent_radius();
		return distance_sqr(coord, a.coord) < s * s;
	}
开发者ID:HongjianLi,项目名称:zinc,代码行数:6,代码来源:statligand.cpp


示例11: port

 port(const atom& node, const int id, const int creation, const Alloc& a_alloc = Alloc())
     throw (err_bad_argument)
 {
     detail::check_node_length(node.size());
     init(node, id, creation, a_alloc);
 }
开发者ID:fredrikelinder,项目名称:eixx,代码行数:6,代码来源:port.hpp


示例12: partitions

receptor::receptor(istream& is, const box& b) : partitions(b.num_partitions)
{
	// Initialize necessary variables for constructing a receptor.
	atoms.reserve(5000); // A receptor typically consists of <= 5,000 atoms.

	// Initialize helper variables for parsing.
	string residue = "XXXX"; // Current residue sequence, used to track residue change, initialized to a dummy value.
	vector<size_t> residues;
	residues.reserve(1000); // A receptor typically consists of <= 1,000 residues, including metal ions and water molecules if any.
	size_t num_lines = 0; // Used to track line number for reporting parsing errors, if any.
	string line;
	line.reserve(79); // According to PDBQT specification, the last item AutoDock atom type locates at 1-based [78, 79].

	// Parse ATOM/HETATM.
	while (getline(is, line))
	{
		++num_lines;
		if (starts_with(line, "ATOM") || starts_with(line, "HETATM"))
		{
			// Parse and validate AutoDock4 atom type.
			const string ad_type_string = line.substr(77, isspace(line[78]) ? 1 : 2);
			const size_t ad = parse_ad_type_string(ad_type_string);
			if (ad == AD_TYPE_SIZE) continue;

			// Skip non-polar hydrogens.
			if (ad == AD_TYPE_H) continue;

			// Parse the Cartesian coordinate.
			string name = line.substr(12, 4);
			boost::algorithm::trim(name);
			const atom a(line.substr(21, 1) + ':' + line.substr(17, 3) + right_cast<string>(line, 23, 26) + ':' + name, vec3(right_cast<fl>(line, 31, 38), right_cast<fl>(line, 39, 46), right_cast<fl>(line, 47, 54)), ad);

			// For a polar hydrogen, the bonded hetero atom must be a hydrogen bond donor.
			if (ad == AD_TYPE_HD)
			{
				const size_t residue_start = residues.back();
				for (size_t i = atoms.size(); i > residue_start;)
				{
					atom& b = atoms[--i];
					if (!b.is_hetero()) continue; // Only a hetero atom can be a hydrogen bond donor.
					if (a.is_neighbor(b))
					{
						b.donorize();
						break;
					}
				}
			}
			else // It is a heavy atom.
			{
				// Parse the residue sequence located at 1-based [23, 26].
				if ((line[25] != residue[3]) || (line[24] != residue[2]) || (line[23] != residue[1]) || (line[22] != residue[0])) // This line is the start of a new residue.
				{
					residue[3] = line[25];
					residue[2] = line[24];
					residue[1] = line[23];
					residue[0] = line[22];
					residues.push_back(atoms.size());
				}
				atoms.push_back(a);
			}
		}
		else if (starts_with(line, "TER"))
		{
			residue = "XXXX";
		}
	}

	// Dehydrophobicize carbons if necessary.
	const size_t num_residues = residues.size();
	residues.push_back(atoms.size());
	for (size_t r = 0; r < num_residues; ++r)
	{
		const size_t begin = residues[r];
		const size_t end = residues[r + 1];
		for (size_t i = begin; i < end; ++i)
		{
			const atom& a = atoms[i];
			if (!a.is_hetero()) continue; // a is a hetero atom.

			for (size_t j = begin; j < end; ++j)
			{
				atom& b = atoms[j];
				if (b.is_hetero()) continue; // b is a carbon atom.

				// If carbon atom b is bonded to hetero atom a, b is no longer a hydrophobic atom.
				if (a.is_neighbor(b))
				{
					b.dehydrophobicize();
				}
			}
		}
	}
	
	// Find all the heavy receptor atoms that are within 8A of the box.
	vector<size_t> receptor_atoms_within_cutoff;
	receptor_atoms_within_cutoff.reserve(atoms.size());
	const size_t num_rec_atoms = atoms.size();
	for (size_t i = 0; i < num_rec_atoms; ++i)
	{
		const atom& a = atoms[i];
//.........这里部分代码省略.........
开发者ID:HongjianLi,项目名称:istar,代码行数:101,代码来源:receptor.cpp


示例13: test_single_cas

void test_single_cas(size_t id, size_t nrun) {
    size_t dummy;
    for (size_t i = 0; i < nrun; i++) {
        lock_instr_test.compare_exchange_weak(dummy,
                                              dummy+1,
					      std::memory_order_relaxed,
                                              std::memory_order_relaxed);
    }
}
开发者ID:schets,项目名称:contention_test,代码行数:9,代码来源:scale_test.cpp


示例14: test_many_cas

void test_many_cas(size_t id, size_t nrun) {
    size_t dummy;
    for (size_t i = 0; i < nrun; i++) {
        while (!lock_instr_test.compare_exchange_weak(dummy,
                                                      dummy+1,
                                                      std::memory_order_relaxed,
                                                      std::memory_order_relaxed))
        {}
    }
}
开发者ID:schets,项目名称:contention_test,代码行数:10,代码来源:scale_test.cpp


示例15: timer_reconnect

    void timer_reconnect(const boost::system::error_code& ec) {
        if (ec == boost::asio::error::operation_aborted)
            return;     // timer reset

        if (verbose() >= VERBOSE_TRACE)
            std::cerr << "basic_otp_connection::timer_reconnect: " << ec.message() << std::endl;

        m_transport = connection_type::create(
                          m_io_service, this, m_node->nodename().to_string(),
                          m_remote_nodename.to_string(), m_cookie, m_alloc);
    }
开发者ID:alepharchives,项目名称:eixx,代码行数:11,代码来源:basic_otp_connection.hpp


示例16: test_single_add

void test_single_add(size_t id, size_t nrun) {
    for (size_t i = 0; i < nrun; i++) {
        lock_instr_test.fetch_add(1, std::memory_order_relaxed);
    }
}
开发者ID:schets,项目名称:contention_test,代码行数:5,代码来源:scale_test.cpp


示例17: length

 size_t                  length()        const { return m_name.length(); }
开发者ID:fredrikelinder,项目名称:eixx,代码行数:1,代码来源:var.hpp


示例18: str

 const string_t&         str()           const { return m_name.to_string(); }
开发者ID:fredrikelinder,项目名称:eixx,代码行数:1,代码来源:var.hpp


示例19:

 const char*             c_str()         const { return m_name.c_str(); }
开发者ID:fredrikelinder,项目名称:eixx,代码行数:1,代码来源:var.hpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ atomic类代码示例发布时间:2022-05-31
下一篇:
C++ astring类代码示例发布时间: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