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

C++ pv函数代码示例

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

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



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

示例1: dc_add_altitude

static int dc_add_altitude()
{
	HKEY hkey1 = NULL;
	HKEY hkey2 = NULL;
	int  succs = 0;
	u32  flags = 0;

	if (RegCreateKey(
		HKEY_LOCAL_MACHINE, L"SYSTEM\\CurrentControlSet\\Services\\dcrypt\\Instances", &hkey1) != 0) 
	{
		goto exit;
	}
	if (RegSetValueEx(hkey1, L"DefaultInstance", 0, REG_SZ, pv(L"dcrypt"), sizeof(L"dcrypt")) != 0) {
		goto exit;
	}
	if (RegCreateKey(hkey1, L"dcrypt", &hkey2) != 0) {
		goto exit;
	}
	if (RegSetValueEx(hkey2, L"Altitude", 0, REG_SZ, pv(L"87150"), sizeof(L"87150")) != 0) {
		goto exit;
	}
	succs = RegSetValueEx(hkey2, L"Flags", 0, REG_DWORD, pv(&flags), sizeof(flags)) == 0;

	if (hkey2 != NULL) RegCloseKey(hkey2);
	if (hkey1 != NULL) RegCloseKey(hkey1);
exit:
	return succs != 0 ? ST_OK : ST_REG_ERROR;
}
开发者ID:capturePointer,项目名称:diskcryptor,代码行数:28,代码来源:drvinst.c


示例2: go

inline bool go()
{
    k=0;
    p[k].resize(0);
    p[k].push_back(pv(-inf,inf));
    p[k].push_back(pv(-inf,-inf));
    p[k].push_back(pv(inf,-inf));
    p[k].push_back(pv(inf,inf));
    for(i=0;i<n;++i)
    {
        get(pnt[i],pnt[(i+1)%n],a,b,c);
        c+=the*sqrt(a*a+b*b);
        p[!k].resize(0);
        for(l=0;l<p[k].size();++l)
            if(a*p[k][l].x+b*p[k][l].y+c<eps)
                p[!k].push_back(p[k][l]);
            else
            {
                m=(l+p[k].size()-1)%p[k].size();
                if(a*p[k][m].x+b*p[k][m].y+c<-eps)
                    p[!k].push_back(ins(p[k][m],p[k][l]));
                m=(l+1)%p[k].size();
                if(a*p[k][m].x+b*p[k][m].y+c<-eps)
                    p[!k].push_back(ins(p[k][m],p[k][l]));
            }
        k=!k;
        if(p[k].empty())
            break;
    }
    //`结果在p[k]中`
    return p[k].empty();
}
开发者ID:hellfiresong,项目名称:Code-Library,代码行数:32,代码来源:half-plane+intersection.cpp


示例3: main

int main(int argc, char *argv[])
{
	int sem_id = semget(IPC_PRIVATE, 1, 0666);

        union semun sem_un;
        sem_un.val = 1;
        semctl(sem_id, 0, SETVAL, sem_un);

        pid_t pid = fork();
        if (pid < 0) {
                return 1;
        } else if (pid == 0) {
                printf("Child try to get binary sem\n");
                pv(sem_id, -1);
                printf("Child get the sem and would release it after 5 seconds\n");
                sleep(5);
                pv(sem_id, 1);
                exit(0);
        } else {
                printf("Parent try to get binary sem\n");
                pv(sem_id, -1);
                printf("Parent get the sem and would release it after 5 seconds\n");
                sleep(5);
                pv(sem_id, 1);
        }

        waitpid(pid, NULL, 0);
        semctl(sem_id, 0, IPC_RMID, sem_un);

	return EXIT_SUCCESS;
}
开发者ID:autyinjing,项目名称:Network-Programming,代码行数:31,代码来源:ipc_private.c


示例4: dc_is_this_ssd

static int dc_is_this_ssd(dev_hook *hook)
{
	STORAGE_PROPERTY_QUERY         query = { StorageDeviceSeekPenaltyProperty,  PropertyStandardQuery };
	DEVICE_SEEK_PENALTY_DESCRIPTOR seek  = {0};
	char                           buff[sizeof(ATA_PASS_THROUGH_EX) + sizeof(IDENTIFY_DEVICE_DATA)] = {0};
    PATA_PASS_THROUGH_EX           pata = pv(buff);
	PIDENTIFY_DEVICE_DATA          idat = pv(buff + sizeof(ATA_PASS_THROUGH_EX));
	int                            resl;

	resl = io_hook_ioctl(hook, IOCTL_STORAGE_QUERY_PROPERTY, &query, sizeof(query), &seek, sizeof(seek));

	if ( (resl == ST_OK) && (seek.Version >= sizeof(seek)) && (seek.Size >= sizeof(seek)) ) {
		DbgMsg("seek.IncursSeekPenalty %d\n", seek.IncursSeekPenalty);
		return seek.IncursSeekPenalty == FALSE;
	}
	pata->Length             = sizeof(ATA_PASS_THROUGH_EX);
	pata->DataBufferOffset   = sizeof(ATA_PASS_THROUGH_EX);
	pata->DataTransferLength = sizeof(IDENTIFY_DEVICE_DATA);
	pata->AtaFlags           = ATA_FLAGS_DATA_IN;
	pata->TimeOutValue       = 2;
	pata->CurrentTaskFile[6] = IDE_COMMAND_IDENTIFY;

	if (io_hook_ioctl(hook, IOCTL_ATA_PASS_THROUGH, buff, sizeof(buff), buff, sizeof(buff)) != ST_OK) {
		return 0;
	} else {
		DbgMsg("idat->NominalMediaRotationRate %d\n", idat->NominalMediaRotationRate);
	}
	return idat->NominalMediaRotationRate == 1;
}
开发者ID:capturePointer,项目名称:DiskCryptor-1,代码行数:29,代码来源:disk_info.c


示例5: leastSquaresEstimate

Vector2d leastSquaresEstimate(vector<Vector2f> points,
                              Vector2f p0, Vector2f p3,
                              Vector2d d1, Vector2d d2)
{
    // hack up points
    if(points.size() <= 10)
        points = interpolatePoints(points);
    if(points.size() <= 20)
        points = interpolatePoints(points);

    qDebug() << "num points in arc" << points.size();
    int m = points.size()-2; // number of points to fit
    int n = 2;               // number of control points to find

    Eigen::MatrixXd Z(m, n);
    Eigen::MatrixXd Y(m, n);
    Eigen::VectorXd pu(m);
    Eigen::VectorXd pv(m);

    for(int i = 0; i < m; ++i)


    {
        int idx = i+1;
        Vector2f pt = points[idx];

        double t = double(idx)/(m-1);
        auto b0 = Bernstein3(0, t);
        auto b1 = Bernstein3(1, t);
        auto b2 = Bernstein3(2, t);
        auto b3 = Bernstein3(3, t);

        // Filling in the matrices
        Z(i, 0) = b1*d1[0];
        Z(i, 1) = b2*d2[0];

        Y(i, 0) = b1*d1[1];
        Y(i, 1) = b2*d2[1];

        auto pp = pt - p0*(b0 + b1) - p3*(b2 + b3);
        pu(i) = pp[0];
        pv(i) = pp[1];
    }

    auto Zt = Z.transpose();
    auto Yt = Y.transpose();
    auto A = Zt*Z+Yt*Y;

    auto rhs = Zt*pu+Yt*pv;
    Eigen::VectorXd ans = A.inverse()*rhs;

    auto s = makeVector2d(ans(0), ans(1));
    qDebug() << "least squares" << s[0] << s[1];
    s[0]=fabs(s[0])/**10*/;
    s[1]=fabs(s[1]);
    return s;
}
开发者ID:mehtadushy,项目名称:visdat13,代码行数:57,代码来源:GMExperiment6_1.cpp


示例6: boot_from_mbr

static void boot_from_mbr(hdd_inf *hdd, int n_mount)
{
	if ( !(conf.options & OP_EXTERNAL) && (hdd->dos_numb == boot_dsk) ) {
		autocpy(pv(0x7C00), conf.save_mbr, SECTOR_SIZE);
	} else {
		dc_disk_io(hdd, pv(0x7C00), 1, 0, 1);
	}
	bios_jump_boot(hdd->dos_numb, n_mount);
}
开发者ID:dwalkes,项目名称:RDXEncryption,代码行数:9,代码来源:boot.c


示例7: static_cast_test

void static_cast_test()
{
    {
        boost::shared_ptr<void> pv;

        boost::shared_ptr<int[]> pi = boost::static_pointer_cast<int[]>( pv );
        BOOST_TEST( pi.get() == 0 );

        boost::shared_ptr<int[3]> pi2 = boost::static_pointer_cast<int[3]>( pv );
        BOOST_TEST( pi2.get() == 0 );

        boost::shared_ptr<X[]> px = boost::static_pointer_cast<X[]>( pv );
        BOOST_TEST( px.get() == 0 );

        boost::shared_ptr<X[5]> px2 = boost::static_pointer_cast<X[5]>( pv );
        BOOST_TEST( px2.get() == 0 );
    }

    {
        boost::shared_ptr<int[]> pi( new int[2] );
        boost::shared_ptr<void> pv( pi );

        boost::shared_ptr<int[]> pi2 = boost::static_pointer_cast<int[]>( pv );
        BOOST_TEST(pi.get() == pi2.get());
        BOOST_TEST(!(pi < pi2 || pi2 < pi));

        boost::shared_ptr<int[2]> pi3 = boost::static_pointer_cast<int[2]>( pv );
        BOOST_TEST(pi.get() == pi3.get());
        BOOST_TEST(!(pi < pi3 || pi3 < pi));

        boost::shared_ptr<void> pv2( pi3 );

        boost::shared_ptr<int[]> pi4 = boost::static_pointer_cast<int[]>( pv2 );
        BOOST_TEST(pi.get() == pi4.get());
        BOOST_TEST(!(pi < pi4 || pi4 < pi));
    }

    {
        boost::shared_ptr<X[]> px( new X[4] );
        boost::shared_ptr<void> pv( px );

        boost::shared_ptr<X[]> px2 = boost::static_pointer_cast<X[]>( pv );
        BOOST_TEST(px.get() == px2.get());
        BOOST_TEST(!(px < px2 || px2 < px));

        boost::shared_ptr<X[4]> px3 = boost::static_pointer_cast<X[4]>( pv );
        BOOST_TEST(px.get() == px3.get());
        BOOST_TEST(!(px < px3 || px3 < px));

        boost::shared_ptr<void> pv2( px3 );

        boost::shared_ptr<X[]> px4 = boost::static_pointer_cast<X[]>( pv2 );
        BOOST_TEST(px.get() == px4.get());
        BOOST_TEST(!(px < px4 || px4 < px));
    }
}
开发者ID:Adikteev,项目名称:rtbkit-deps,代码行数:56,代码来源:sp_array_cast_test.cpp


示例8: gfs2_rindex_print

void gfs2_rindex_print(const struct gfs2_rindex_host *ri)
{
	printk(KERN_INFO "  ri_addr = %llu\n", (unsigned long long)ri->ri_addr);
	pv(ri, ri_length, "%u");

	printk(KERN_INFO "  ri_data0 = %llu\n", (unsigned long long)ri->ri_data0);
	pv(ri, ri_data, "%u");

	pv(ri, ri_bitbytes, "%u");
}
开发者ID:3sOx,项目名称:asuswrt-merlin,代码行数:10,代码来源:ondisk.c


示例9: com_putchar

void com_putchar(char ch) 
{
	if (ch == '\n') {
		com_putchar('\r');
	}

	while ((READ_PORT_UCHAR (pv(SER_LSR(COM_BASE))) & SR_LSR_TBE) == 0);

	WRITE_PORT_UCHAR(pv(SER_THR(COM_BASE)), ch);
}
开发者ID:capturePointer,项目名称:diskcryptor,代码行数:10,代码来源:debug.c


示例10: dc_backup_header

int dc_backup_header(wchar_t *dev_name, dc_pass *password, void *out)
{
	dc_header *header = NULL;
	xts_key   *hdr_key = NULL;
	dev_hook  *hook    = NULL;
	int        resl;
	s8         salt[PKCS5_SALT_SIZE];

	do
	{
		if ( (hook = dc_find_hook(dev_name)) == NULL ) {
			resl = ST_NF_DEVICE; break;
		}
		wait_object_infinity(&hook->busy_lock);

		if (hook->flags & (F_SYNC | F_UNSUPRT | F_DISABLE | F_CDROM)) {
			resl = ST_ERROR; break;
		}
		if ( (hdr_key = mm_alloc(sizeof(xts_key), MEM_SECURE)) == NULL ) {
			resl = ST_NOMEM; break;
		}
		/* get device params */
		if (hook->dsk_size == 0) {
			if ( (resl = dc_fill_disk_info(hook)) != ST_OK ) break;
		}
		if ( (resl = io_read_header(hook, &header, NULL, password)) != ST_OK ) {
			break;
		}
		/* generate new salt */
		cp_rand_bytes(header->salt, PKCS5_SALT_SIZE);
		/* save original salt */
		memcpy(salt, header->salt, PKCS5_SALT_SIZE);		
		/* init new header key */
		cp_set_header_key(hdr_key, header->salt, header->alg_1, password);		
		/* encrypt header with new key */
		xts_encrypt(pv(header), pv(header), sizeof(dc_header), 0, hdr_key);
		/* restore original salt */
		memcpy(header->salt, salt, PKCS5_SALT_SIZE);

		/* copy header to output */
		memcpy(out, header, sizeof(dc_header));
		resl = ST_OK;
	} while (0);

	if (hook != NULL) {
		KeReleaseMutex(&hook->busy_lock, FALSE);
		dc_deref_hook(hook);
	}
	/* prevent leaks */
	burn(salt, sizeof(salt));
	/* free memory */	
	if (header != NULL) mm_free(header);
	if (hdr_key != NULL) mm_free(hdr_key);
	return resl;
}
开发者ID:capturePointer,项目名称:diskcryptor,代码行数:55,代码来源:misc_volume.c


示例11: sigUser

// ****************************************************************************
void sigUser(int sig) {
    if (SIGUSR1 == sig) {
        pv("SIGUSR1 received\n");
    }
    else if (SIGUSR2 == sig) {
        pv("SIGUSR2 received\n");
    }
    else {
        err_dump("unkown sig: %d\n", sig);
    }
}
开发者ID:elloop,项目名称:CS.cpp,代码行数:12,代码来源:signal_test.cpp


示例12: io_write_header

int io_write_header(dev_hook *hook, dc_header *header, xts_key *hdr_key, dc_pass *password)
{
	u8         salt[PKCS5_SALT_SIZE];
	int        hdr_len = max(sizeof(dc_header), hook->bps);
	dc_header *hcopy = NULL;
	xts_key   *h_key = hdr_key;
	int        resl;

	do
	{
		if ( (hcopy = mm_alloc(hdr_len, MEM_SECURE | MEM_SUCCESS)) == NULL ) { resl = ST_NOMEM; break; }
		memcpy(hcopy, header, sizeof(dc_header));
		
		if (h_key == NULL) {
			if ( (h_key = mm_alloc(sizeof(xts_key), MEM_SECURE | MEM_SUCCESS)) == NULL ) { resl = ST_NOMEM; break; }
		}
		if (hdr_key == NULL)
		{
			/* add volume header to random pool because RNG not 
			   have sufficient entropy at boot time 
			*/
			cp_rand_add_seed(header, sizeof(dc_header));
			/* generate new salt */
			cp_rand_bytes(salt, PKCS5_SALT_SIZE);
			/* copy salt to header */
			memcpy(hcopy->salt, salt, PKCS5_SALT_SIZE);
			/* init new header key */
			cp_set_header_key(h_key, salt, header->alg_1, password);
		} else {
			/* save original salt */
			memcpy(salt, header->salt, PKCS5_SALT_SIZE);
		}
		/* calc header CRC */
		hcopy->hdr_crc = crc32(pv(&hcopy->version), DC_CRC_AREA_SIZE);
		/* encrypt header with new key */
		xts_encrypt(pv(hcopy), pv(hcopy), sizeof(dc_header), 0, h_key);
		/* restore original salt */
		memcpy(hcopy->salt, salt, PKCS5_SALT_SIZE);		
		
		/* fill the gap with random numbers */
		if (hdr_len > sizeof(dc_header)) {
			cp_rand_bytes(pv(hcopy + 1), hdr_len - sizeof(dc_header));
		}
		/* write new header */
		resl = io_hook_rw(hook, hcopy, hdr_len, 0, 0);
	} while (0);

	/* prevent leaks */
	burn(salt, sizeof(salt));
	/* free resources */
	if (h_key != NULL && h_key != hdr_key) mm_free(h_key);
	if (hcopy != NULL) mm_free(hcopy);	
	return resl;
}
开发者ID:capturePointer,项目名称:diskcryptor,代码行数:54,代码来源:header_io.c


示例13: main

int main( int argc, char **argv )
{
    int retv = 0 ;
    
    char *p = NULL ;
    
    alloca2_init(1024) ;
    
    pv(p,alloca2_base) ;
    pv(p,alloca2_top) ;
    
    pv(p,p) ;
    
    /* grab alloca2's memory until we run out
     */
    
    int n = 0 ;
    
    do {
        p = alloca2(100) ;
        
        if( p != NULL )
            n++ ;
        
        pv(p,p) ;
        
        } while( p != NULL ) ;
    
    /* we ran out of (alloca2) memory to get here
     *
     * let's release some back and see what happens
     */
    
    alloca2_release( n * 100 ) ;
    
    do {
        p = alloca2(100) ;
        
        if( p != NULL )
            n++ ;
        
        pv(p,p) ;
        
        } while( p != NULL ) ;
    
    /* You should see that not all the memory could be
     * reused.  This is because of alignment issues as
     * alloca2 always keeps addresses aligned to
     * 16 bytes.
     */
    
    return retv ;
}
开发者ID:sjgcit,项目名称:alloca2,代码行数:53,代码来源:example.c


示例14: dc_mount_parts

static int dc_mount_parts()
{
	dc_header  *header  = pv(0x5000); /* free memory location */
	dc_key     *hdr_key = pv(0x5000 + sizeof(dc_header));
	list_entry *entry;
	prt_inf    *prt;
	int         n_mount;

	/* mount partitions on all disks */
	n_mount = 0;
	entry   = prt_head.flink;

	while ( (entry != &prt_head) && (n_mount < MAX_MOUNT) )
	{
		prt   = contain_record(entry, prt_inf, entry_glb);
		entry = entry->flink;

		do
		{
			/* read volume header */
			if (dc_partition_io(prt, header, DC_AREA_SECTORS, 0, 1) == 0) {					
				break;
			}

			if (dc_decrypt_header(hdr_key, header, &bd_dat->password) == 0) {
				break;
			}

			if (header->flags & VF_REENCRYPT) {
				prt->o_key.key_d = malloc(PKCS_DERIVE_MAX);
				autocpy(prt->o_key.key_d, header->key_2, PKCS_DERIVE_MAX);
			}

			prt->d_key.key_d = malloc(PKCS_DERIVE_MAX);
			autocpy(prt->d_key.key_d, header->key_1, PKCS_DERIVE_MAX);

			prt->flags     = header->flags;
			prt->tmp_size  = header->tmp_size / SECTOR_SIZE;
			prt->stor_off  = header->stor_off / SECTOR_SIZE;
			prt->disk_id   = header->disk_id; 
			prt->d_key.alg = header->alg_1;
			prt->o_key.alg = header->alg_2;
			prt->mnt_ok   = 1; n_mount++;
		} while (0);
	}

	/* prevent leaks */
	zeroauto(header,  sizeof(dc_header));
	zeroauto(hdr_key, sizeof(dc_key));

	return n_mount;
}
开发者ID:dwalkes,项目名称:RDXEncryption,代码行数:52,代码来源:boot.c


示例15: gfs2_sb_print2

/**
 * gfs2_sb_print2 - Print out a superblock
 * @sb: the cpu-order buffer
 */
static void gfs2_sb_print2(struct gfs2_sb *sbp2)
{
	gfs2_meta_header_print(&sbp2->sb_header);

	pv(sbp2, sb_fs_format, "%u", "0x%x");
	pv(sbp2, sb_multihost_format, "%u", "0x%x");

	if (sbd.gfs1)
		pv(sbd1, sb_flags, "%u", "0x%x");
	pv(sbp2, sb_bsize, "%u", "0x%x");
	pv(sbp2, sb_bsize_shift, "%u", "0x%x");
	if (sbd.gfs1) {
		pv(sbd1, sb_seg_size, "%u", "0x%x");
		gfs2_inum_print2("jindex ino", &sbd1->sb_jindex_di);
		gfs2_inum_print2("rindex ino", &sbd1->sb_rindex_di);
	}
	else
		gfs2_inum_print2("master dir", &sbp2->sb_master_dir);
	gfs2_inum_print2("root dir  ", &sbp2->sb_root_dir);

	pv(sbp2, sb_lockproto, "%s", NULL);
	pv(sbp2, sb_locktable, "%s", NULL);
	if (sbd.gfs1) {
		gfs2_inum_print2("quota ino ", &gfs1_quota_di);
		gfs2_inum_print2("license   ", &gfs1_license_di);
	}
#ifdef GFS2_HAS_UUID
	print_it("  sb_uuid", "%s", NULL, str_uuid(sbp2->sb_uuid));
#endif
}
开发者ID:BetaXOi,项目名称:gfs2-utils,代码行数:34,代码来源:gfs2hex.c


示例16: line

    line(double a,double b,double c) // a*x + b*y + c = 0
    {
#define maxl 1e2 //preciseness should not be too high ( compare with eps )
        if(fabs(b)>eps)
        {
            pnt[0]=pv(maxl,(c+a*maxl)/(-b));
            pnt[1]=pv(-maxl,(c-a*maxl)/(-b));
        }
        else
        {
            pnt[0]=pv(-c/a,maxl);
            pnt[1]=pv(-c/a,-maxl);
        }
#undef maxl
    }
开发者ID:himemeizhi,项目名称:Code-Library-Short,代码行数:15,代码来源:shit.cpp


示例17: pv

Vector<double> AncillaryMethods::PlaneToWorld(const Camera& camera, const Vector<double>& plane_in_camera)
{
    Vector<double> pv(plane_in_camera(0), plane_in_camera(1), plane_in_camera(2));
    pv = camera.get_R() * pv;

    double d = plane_in_camera(3) - DotProduct(pv, camera.get_t());

    Vector<double> plane(4);
    plane(0) = pv(0)/pv.norm();
    plane(1) = pv(1)/pv.norm();
    plane(2) = pv(2)/pv.norm();
    plane(3) = d;

    return plane;
}
开发者ID:AtDinesh,项目名称:Jaf_pose_est,代码行数:15,代码来源:AncillaryMethods.cpp


示例18: pv

 bool EdgeSE2PointXY::resolveCaches()
 {
   ParameterVector pv(1);
   pv[0] = _sensorOffset;
   resolveCache(_sensorCache, static_cast<OptimizableGraph::Vertex*>(_vertices[0]), "TUTORIAL_CACHE_SE2_OFFSET", pv);
   return _sensorCache != 0;
 }
开发者ID:Aerobota,项目名称:c2tam,代码行数:7,代码来源:edge_se2_pointxy.cpp


示例19: TEST

TEST(kdtree, DefaultConstructor)
{
    typedef double realScalarType;
    typedef point<realScalarType> pointType;
    typedef kdTree<pointType> kdTreeType;

    std::default_random_engine generator;

    std::normal_distribution<double> distribution(0.,1.0);

    const size_t numDims = 1;
    const size_t numPoints = 10;

    std::vector<pointType> pts(numPoints);


    for(size_t i=0;i<numPoints;++i)
    {
        std::vector<double> pv(numDims);
        for(size_t j=0;j<numDims;++j)
        {
            pv[j] = distribution(generator);
        }

        pointType pt(pv);

        pts[i] = pt;
    }

    kdTreeType kdtr(pts);
}
开发者ID:tbs1980,项目名称:simpleKDTree,代码行数:31,代码来源:kdTree.cpp


示例20: TEST

TEST(CLASSNAME(test_local_parameters, RMW_IMPLEMENTATION), to_string) {
  rclcpp::parameter::ParameterVariant pv("foo", "bar");
  rclcpp::parameter::ParameterVariant pv2("foo2", "bar2");
  std::string json_dict = std::to_string(pv);
  EXPECT_STREQ(
    "{\"name\": \"foo\", \"type\": \"string\", \"value\": \"bar\"}",
    json_dict.c_str());
  json_dict = rclcpp::parameter::_to_json_dict_entry(pv);
  EXPECT_STREQ(
    "\"foo\": {\"type\": \"string\", \"value\": \"bar\"}",
    json_dict.c_str());
  std::vector<rclcpp::parameter::ParameterVariant> vpv;
  vpv.push_back(pv);
  vpv.push_back(pv2);
  json_dict = std::to_string(vpv);
  EXPECT_STREQ(
    "{\"foo\": {\"type\": \"string\", \"value\": \"bar\"}, "
    "\"foo2\": {\"type\": \"string\", \"value\": \"bar2\"}}",
    json_dict.c_str());

  pv = rclcpp::parameter::ParameterVariant("foo", 2.1);
  // TODO(tfoote) convert the value to a float and use epsilon test.
  EXPECT_STREQ(
    "{\"name\": \"foo\", \"type\": \"double\", \"value\": \"2.100000\"}",
    std::to_string(pv).c_str());
  pv = rclcpp::parameter::ParameterVariant("foo", 8);
  EXPECT_STREQ(
    "{\"name\": \"foo\", \"type\": \"integer\", \"value\": \"8\"}",
    std::to_string(pv).c_str());
}
开发者ID:dhood,项目名称:system_tests,代码行数:30,代码来源:test_local_parameters.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ pvPortMalloc函数代码示例发布时间:2022-05-30
下一篇:
C++ putwchar函数代码示例发布时间: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