コード例 #1
0
ファイル: aa.c プロジェクト: 1100110/dmd
void *AArray::values()
{
    void *p = NULL;

    if (nodes)
    {
        p = (void *)new char[nodes * valuesize];
        void *q = p;
        for (size_t i = 0; i < buckets_length; i++)
        {   aaA *e = buckets[i];

            if (e)
                q = values_x(e, q);
        }
    }
    return p;
}
コード例 #2
0
ファイル: aa.c プロジェクト: 1100110/dmd
void *AArray::values_x(aaA *e, void *p)
{
    size_t keysize = keyti->tsize();
    do
    {
        memcpy(p,
               (char *)(e + 1) + keysize,
               valuesize);
        p = (void *)((char *)p + valuesize);
        if (e->left)
        {   if (!e->right)
            {   e = e->left;
                continue;
            }
            p = values_x(e->left, p);
        }
        e = e->right;
    } while (e != NULL);
    return p;
}
コード例 #3
0
ファイル: Spline.cpp プロジェクト: ci-group/tol-controllers
	TiXmlElement Spline::save_xml() const
	{
		std::size_t size = _spline->size;
		TiXmlElement result(Spline::XML_NAME);
		TiXmlElement values_x("X");
		TiXmlElement values_y("Y");

		result.SetAttribute("Size", boost::lexical_cast<std::string>(size));

		for (std::size_t index = 0; index < size; index++) {
			TiXmlElement value("Element");

			value.SetDoubleAttribute("Value", _spline->x[index]);

			if (!values_x.InsertEndChild(value)) {
				throw std::runtime_error("XML Error: Element Assembling");
			}
		}

		for (std::size_t index = 0; index < size; index++) {
			TiXmlElement value("Element");

			value.SetDoubleAttribute("Value", _spline->y[index]);

			if (!values_y.InsertEndChild(value)) {
				throw std::runtime_error("XML Error: Element Assembling");
			}
		}

		if (!result.InsertEndChild(values_x)) {
			throw std::runtime_error("XML Error: Element Assembling");
		}

		if (!result.InsertEndChild(values_y)) {
			throw std::runtime_error("XML Error: Element Assembling");
		}

		return result;
	}