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


C++ pcfree函数代码示例

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


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

示例1: test_point_geometry_bytes

void test_point_geometry_bytes(const PCSCHEMA *s, size_t expectedgeomwkbsize,
	const char *pthexbytes, const char *expectedgeomhexbytes)
{
	/* point
	byte:     endianness (1 = NDR, 0 = XDR)
	uint32:   pcid (key to POINTCLOUD_SCHEMAS)
	uchar[]:  data (interpret relative to pcid)
	*/

	/* geometry
	byte:     endianness (1 = NDR, 0 = XDR)
	uint32:   point type (XYZ=01000080, XYM=01000040, XY=01000000, XYZM=010000C0)
	double[]: XY(Z?)(M?) coordinates
	*/

	PCPOINT *pt;
	uint8_t *ptwkb, *geomwkb;
	char *geomhexbytes;
	size_t pthexsize, geomwkbsize;

	pthexsize = strlen(pthexbytes);
	ptwkb = pc_bytes_from_hexbytes(pthexbytes, pthexsize);
	pt = pc_point_from_wkb(s, ptwkb, pthexsize/2);
	CU_ASSERT_PTR_NOT_NULL(pt);
	geomwkb = pc_point_to_geometry_wkb(pt, &geomwkbsize);
	CU_ASSERT_EQUAL(geomwkbsize,expectedgeomwkbsize);
	geomhexbytes = pc_hexbytes_from_bytes(geomwkb,geomwkbsize);
	CU_ASSERT_STRING_EQUAL(geomhexbytes, expectedgeomhexbytes);

	pcfree(geomhexbytes);
	pcfree(geomwkb);
	pc_point_free(pt);
	pcfree(ptwkb);
}
开发者ID:LI3DS,项目名称:pointcloud,代码行数:34,代码来源:cu_pc_point.c

示例2: init_suite

/* Setup/teardown for this suite */
static int
init_suite(void)
{
	char *xmlstr = file_to_str(xmlfile);
	schema = pc_schema_from_xml(xmlstr);
	pcfree(xmlstr);
	if ( !schema ) return 1;

	xmlstr = file_to_str(simplexmlfile);
	simpleschema = pc_schema_from_xml(xmlstr);
	pcfree(xmlstr);
	if ( !simpleschema ) return 1;

	xmlstr = file_to_str(simplexmlfile_nointensity);
	simpleschema_nointensity = pc_schema_from_xml(xmlstr);
	pcfree(xmlstr);
	if ( !simpleschema_nointensity ) return 1;

	xmlstr = file_to_str(lasxmlfile);
	lasschema = pc_schema_from_xml(xmlstr);
	pcfree(xmlstr);
	if ( !lasschema ) return 1;

	xmlstr = file_to_str(simplelazxmlfile);
	simplelazschema = pc_schema_from_xml(xmlstr);
	pcfree(xmlstr);
	if ( !simplelazschema ) return 1;

	return 0;
}
开发者ID:ldgeo,项目名称:pointcloud,代码行数:31,代码来源:cu_pc_patch.c

示例3: init_suite

/* Setup/teardown for this suite */
static int
init_suite(void)
{
	char *xmlstr;

	xmlstr = file_to_str(xmlfile);
	schema = pc_schema_from_xml(xmlstr);
	pcfree(xmlstr);
	if ( !schema ) return 1;

	xmlstr = file_to_str(xmlfile_xy);
	schema_xy = pc_schema_from_xml(xmlstr);
	pcfree(xmlstr);
	if ( !schema_xy ) return 1;

	xmlstr = file_to_str(xmlfile_xyz);
	schema_xyz = pc_schema_from_xml(xmlstr);
	pcfree(xmlstr);
	if ( !schema_xyz ) return 1;

	xmlstr = file_to_str(xmlfile_xym);
	schema_xym = pc_schema_from_xml(xmlstr);
	pcfree(xmlstr);
	if ( !schema_xym ) return 1;

	xmlstr = file_to_str(xmlfile_xyzm);
	schema_xyzm = pc_schema_from_xml(xmlstr);
	pcfree(xmlstr);
	if ( !schema_xyzm ) return 1;
	return 0;
}
开发者ID:LI3DS,项目名称:pointcloud,代码行数:32,代码来源:cu_pc_point.c

示例4: test_patch_pointn_laz_compression

static void
test_patch_pointn_laz_compression()
{
	// 00 endian (big)
	// 00000000 pcid
	// 00000000 compression
	// 00000003 npoints
	// 0000000800000003000000050006 pt1 (XYZi)
	// 0000000200000003000000040008 pt2 (XYZi)
	// 0000000200000003000000040009 pt3 (XYZi)

	char *hexbuf = "00000000000000000000000003000000080000000300000005000600000002000000030000000400080000000200000003000000040009";
	size_t hexsize = strlen(hexbuf);
	uint8_t *wkb = bytes_from_hexbytes(hexbuf, hexsize);
	char *str;

	PCPATCH *pa = pc_patch_from_wkb(simpleschema, wkb, hexsize/2);
	PCPOINTLIST *li = pc_pointlist_from_patch(pa);

	PCPATCH_LAZPERF* paz = pc_patch_lazperf_from_pointlist(li);
	PCPOINT *pt = pc_patch_pointn((PCPATCH*) paz, 2);
	CU_ASSERT(pt != NULL);
	str = pc_point_to_string(pt);
	CU_ASSERT_STRING_EQUAL(str, "{\"pcid\":0,\"pt\":[0.02,0.03,0.04,8]}");
	pc_patch_free((PCPATCH *)paz);
	pc_point_free(pt);
	pcfree(str);

	pcfree(wkb);
	pc_patch_free(pa);
	pc_pointlist_free(li);
}
开发者ID:ldgeo,项目名称:pointcloud,代码行数:32,代码来源:cu_pc_patch.c

示例5: test_patch_filter

static void
test_patch_filter()
{
    int i;
    int npts = 20;
    PCPOINTLIST *pl1, *pl2;
    PCPATCH *pa1, *pa2, *pa3, *pa4;
    char *str1, *str2;

    pl1 = pc_pointlist_make(npts);
    pl2 = pc_pointlist_make(npts);

    for ( i = 0; i < npts; i++ )
    {
        PCPOINT *pt1 = pc_point_make(simpleschema);
        PCPOINT *pt2 = pc_point_make(simpleschema);
        pc_point_set_double_by_name(pt1, "x", i);
        pc_point_set_double_by_name(pt1, "y", i);
        pc_point_set_double_by_name(pt1, "Z", i*0.1);
        pc_point_set_double_by_name(pt1, "intensity", 100-i);
        pc_pointlist_add_point(pl1, pt1);
        pc_point_set_double_by_name(pt2, "x", i);
        pc_point_set_double_by_name(pt2, "y", i);
        pc_point_set_double_by_name(pt2, "Z", i*0.1);
        pc_point_set_double_by_name(pt2, "intensity", 100-i);
        pc_pointlist_add_point(pl2, pt2);
    }

    // PCPATCH* pc_patch_filter(const PCPATCH *pa, uint32_t dimnum, PC_FILTERTYPE filter, double val1, double val2);

    pa1 = (PCPATCH*)pc_patch_dimensional_from_pointlist(pl1);
    // printf("pa1\n%s\n", pc_patch_to_string(pa1));
    pa2 = pc_patch_filter(pa1, 0, PC_GT, 17, 20);
    str1 = pc_patch_to_string(pa2);
    // printf("pa2\n%s\n", str1);
    CU_ASSERT_STRING_EQUAL(str1, "{\"pcid\":0,\"pts\":[[18,18,1.8,82],[19,19,1.9,81]]}");

    pa3 = (PCPATCH*)pc_patch_uncompressed_from_pointlist(pl2);
    // printf("\npa3\n%s\n", pc_patch_to_string(pa3));
    pa4 = pc_patch_filter(pa3, 0, PC_GT, 17, 20);
    str2 = pc_patch_to_string(pa4);
    // printf("\npa4\n%s\n", str2);
    CU_ASSERT_STRING_EQUAL(str2, "{\"pcid\":0,\"pts\":[[18,18,1.8,82],[19,19,1.9,81]]}");

    pcfree(str1);
    pcfree(str2);

    pc_pointlist_free(pl1);
    pc_pointlist_free(pl2);
    pc_patch_free(pa1);
    pc_patch_free(pa3);
    pc_patch_free(pa4);
    pc_patch_free(pa2);
    
    return;



}
开发者ID:caomw,项目名称:pointcloud,代码行数:59,代码来源:cu_pc_patch.c

示例6: test_patch_hex_out

/*
* Write an uncompressed patch out to hex
*/
static void
test_patch_hex_out()
{
	// 00 endian
	// 00000000 pcid
	// 00000000 compression
	// 00000002 npoints
	// 0000000200000003000000050006 pt1 (XYZi)
	// 0000000200000003000000050008 pt2 (XYZi)

	static char *wkt_result = "{\"pcid\":0,\"pts\":[[0.02,0.03,0.05,6],[0.02,0.03,0.05,8]]}";
	static char *hexresult_xdr =
	   "0000000000000000000000000200000002000000030000000500060000000200000003000000050008";
	static char *hexresult_ndr =
	   "0100000000000000000200000002000000030000000500000006000200000003000000050000000800";

	double d0[4] = { 0.02, 0.03, 0.05, 6 };
	double d1[4] = { 0.02, 0.03, 0.05, 8 };

	PCPOINT *pt0 = pc_point_from_double_array(simpleschema, d0, 4);
	PCPOINT *pt1 = pc_point_from_double_array(simpleschema, d1, 4);

	PCPATCH_UNCOMPRESSED *pa;
	uint8_t *wkb;
	size_t wkbsize;
	char *hexwkb;
	char *wkt;

	PCPOINTLIST *pl = pc_pointlist_make(2);
	pc_pointlist_add_point(pl, pt0);
	pc_pointlist_add_point(pl, pt1);

	pa = pc_patch_uncompressed_from_pointlist(pl);
	wkb = pc_patch_uncompressed_to_wkb(pa, &wkbsize);
	// printf("wkbsize %zu\n", wkbsize);
	hexwkb = hexbytes_from_bytes(wkb, wkbsize);

	// printf("hexwkb %s\n", hexwkb);
	// printf("hexresult_ndr %s\n", hexresult_ndr);
	// printf("machine_endian %d\n", machine_endian());
	if ( machine_endian() == PC_NDR )
	{
		CU_ASSERT_STRING_EQUAL(hexwkb, hexresult_ndr);
	}
	else
	{
		CU_ASSERT_STRING_EQUAL(hexwkb, hexresult_xdr);
	}

	wkt = pc_patch_uncompressed_to_string(pa);
	// printf("wkt %s\n", wkt);
	CU_ASSERT_STRING_EQUAL(wkt, wkt_result);

	pc_patch_free((PCPATCH*)pa);
	pc_pointlist_free(pl);
	pcfree(hexwkb);
	pcfree(wkb);
	pcfree(wkt);
}
开发者ID:ldgeo,项目名称:pointcloud,代码行数:62,代码来源:cu_pc_patch.c

示例7: pc_dstats_free

static void
pc_dstats_free(PCDOUBLESTATS *stats)
{
    if ( ! stats) return;
    if ( stats->dims ) pcfree(stats->dims);
    pcfree(stats);
    return;
}
开发者ID:cugwhp,项目名称:pointcloud,代码行数:8,代码来源:pc_stats.c

示例8: pc_point_free

void
pc_point_free(PCPOINT *pt)
{
	if ( ! pt->readonly )
	{
		pcfree(pt->data);
	}
	pcfree(pt);
}
开发者ID:Shankarsetty,项目名称:pointcloud,代码行数:9,代码来源:pc_point.c

示例9: pc_patch_uncompressed_free

void
pc_patch_uncompressed_free(PCPATCH_UNCOMPRESSED *patch)
{
	if ( patch->data && ! patch->readonly )
	{
		pcfree(patch->data);
	}
	pcfree(patch);
}
开发者ID:cyrilleberger,项目名称:pointcloud,代码行数:9,代码来源:pc_patch_uncompressed.c

示例10: pc_dimension_free

/** Release the memory behind the PCDIMENSION struct */
static void
pc_dimension_free(PCDIMENSION *pcd)
{
	/* Assumption: No memory in the dimension is owned somewhere else */
	if ( pcd->description )
		pcfree(pcd->description);
	if ( pcd->name )
		pcfree(pcd->name);
	pcfree(pcd);
}
开发者ID:kjartab,项目名称:pointcloud,代码行数:11,代码来源:pc_schema.c

示例11: test_endian_flip

static void
test_endian_flip()
{
	PCPOINT *pt;
	double a1, a2, a3, a4, b1, b2, b3, b4;
	int rv;
	uint8_t *ptr;

	/* All at once */
	pt = pc_point_make(schema);
	a1 = 1.5;
	a2 = 1501500.12;
	a3 = 19112;
	a4 = 200;
	rv = pc_point_set_double_by_name(pt, "X", a1);
	CU_ASSERT_EQUAL(rv, PC_SUCCESS);
	rv = pc_point_set_double_by_name(pt, "Z", a2);
	CU_ASSERT_EQUAL(rv, PC_SUCCESS);
	rv = pc_point_set_double_by_name(pt, "Intensity", a3);
	CU_ASSERT_EQUAL(rv, PC_SUCCESS);
	rv = pc_point_set_double_by_name(pt, "UserData", a4);
	CU_ASSERT_EQUAL(rv, PC_SUCCESS);
	rv = pc_point_get_double_by_name(pt, "X", &b1);
	CU_ASSERT_EQUAL(rv, PC_SUCCESS);
	rv = pc_point_get_double_by_name(pt, "Z", &b2);
	CU_ASSERT_EQUAL(rv, PC_SUCCESS);
	rv = pc_point_get_double_by_name(pt, "Intensity", &b3);
	CU_ASSERT_EQUAL(rv, PC_SUCCESS);
	rv = pc_point_get_double_by_name(pt, "UserData", &b4);
	CU_ASSERT_EQUAL(rv, PC_SUCCESS);
	CU_ASSERT_DOUBLE_EQUAL(a1, b1, 0.0000001);
	CU_ASSERT_DOUBLE_EQUAL(a2, b2, 0.0000001);
	CU_ASSERT_DOUBLE_EQUAL(a3, b3, 0.0000001);
	CU_ASSERT_DOUBLE_EQUAL(a4, b4, 0.0000001);

	ptr = uncompressed_bytes_flip_endian(pt->data, schema, 1);
	pcfree(pt->data);
	pt->data = uncompressed_bytes_flip_endian(ptr, schema, 1);
	pcfree(ptr);

	rv = pc_point_get_double_by_name(pt, "X", &b1);
	CU_ASSERT_EQUAL(rv, PC_SUCCESS);
	rv = pc_point_get_double_by_name(pt, "Z", &b2);
	CU_ASSERT_EQUAL(rv, PC_SUCCESS);
	rv = pc_point_get_double_by_name(pt, "Intensity", &b3);
	CU_ASSERT_EQUAL(rv, PC_SUCCESS);
	rv = pc_point_get_double_by_name(pt, "UserData", &b4);
	CU_ASSERT_EQUAL(rv, PC_SUCCESS);
	CU_ASSERT_DOUBLE_EQUAL(a1, b1, 0.0000001);
	CU_ASSERT_DOUBLE_EQUAL(a2, b2, 0.0000001);
	CU_ASSERT_DOUBLE_EQUAL(a3, b3, 0.0000001);
	CU_ASSERT_DOUBLE_EQUAL(a4, b4, 0.0000001);

	pc_point_free(pt);
}
开发者ID:ldgeo,项目名称:pointcloud,代码行数:55,代码来源:cu_pc_patch.c

示例12: pc_pointlist_free

void
pc_pointlist_free(PCPOINTLIST *pl)
{
	int i;
	for ( i = 0; i < pl->npoints; i++ )
	{
		pc_point_free(pl->points[i]);
	}
	pcfree(pl->points);
	pcfree(pl);
	return;
}
开发者ID:Remi-C,项目名称:pointcloud,代码行数:12,代码来源:pc_pointlist.c

示例13: pc_patch_uncompressed_free

void
pc_patch_uncompressed_free(PCPATCH_UNCOMPRESSED *patch)
{
	assert(patch);
	assert(patch->schema);

	pc_patch_free_stats((PCPATCH*) patch);

	if ( patch->data && ! patch->readonly )
	{
		pcfree(patch->data);
	}
	pcfree(patch);
}
开发者ID:mbredif,项目名称:pointcloud,代码行数:14,代码来源:pc_patch_uncompressed.c

示例14: test_wkb_lazperf

static void
test_wkb_lazperf()
{
	PCPOINT *pt;
	int i;
	int npts = 400;
	PCPOINTLIST *pl;
	PCPATCH_LAZPERF *pal1, *pal2;
	PCPATCH_UNCOMPRESSED *pau;
	uint8_t *wkb1, *wkb2;
	size_t wkbsize;

	// build a list of points
	pl = pc_pointlist_make(npts);

	for ( i = 0; i < npts; i++ )
	{
		pt = pc_point_make(simpleschema);
		pc_point_set_double_by_name(pt, "x", i*2.0);
		pc_point_set_double_by_name(pt, "y", i*1.9);
		pc_point_set_double_by_name(pt, "Z", i*0.34);
		pc_point_set_double_by_name(pt, "intensity", 10);
		pc_pointlist_add_point(pl, pt);
	}

	// build patch lazperf
	pal1 = pc_patch_lazperf_from_pointlist(pl);

	// get the corresponding wkb
	wkb1 = pc_patch_lazperf_to_wkb(pal1, &wkbsize);

	// rebuild a lazperf patch thanks to the wkb
	pal2 = (PCPATCH_LAZPERF*) pc_patch_lazperf_from_wkb( pal1->schema, wkb1, wkbsize);

	// get the wkb reference
	pau = pc_patch_uncompressed_from_pointlist(pl);
	wkb2 = pc_patch_uncompressed_to_wkb( pau, &wkbsize );

	// compare wkb
	CU_ASSERT_STRING_EQUAL(wkb1, wkb2);

	// free
	pc_patch_free((PCPATCH*) pal1);
	pc_patch_free((PCPATCH*) pal2);
	pc_patch_free((PCPATCH*) pau);
	pc_pointlist_free(pl);
	pcfree(wkb1);
	pcfree(wkb2);
}
开发者ID:mbredif,项目名称:pointcloud,代码行数:49,代码来源:cu_pc_patch_lazperf.c

示例15: pc_stats_free

/**
* Free the standard stats object for in memory patches
*/
void
pc_stats_free(PCSTATS *stats)
{
    if ( stats->min.readonly != PC_TRUE )
        pcfree(stats->min.data);

    if ( stats->max.readonly != PC_TRUE )
        pcfree(stats->max.data);

    if ( stats->avg.readonly != PC_TRUE )
        pcfree(stats->avg.data);

    pcfree(stats);
    return;
}
开发者ID:cugwhp,项目名称:pointcloud,代码行数:18,代码来源:pc_stats.c


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