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


C++ istringstream::clear方法代码示例

本文整理汇总了C++中std::istringstream::clear方法的典型用法代码示例。如果您正苦于以下问题:C++ istringstream::clear方法的具体用法?C++ istringstream::clear怎么用?C++ istringstream::clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在std::istringstream的用法示例。


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

示例1:

 // This resets the flags of streamToReset and sets its string to be
 // newString.
 inline void
 ParsingUtilities::ResetStringstream( std::istringstream& streamToReset,
                                      std::string const& newString )
 {
   streamToReset.clear();
   streamToReset.str( newString );
 }
开发者ID:benoleary,项目名称:LesHouchesParserClasses_CPP,代码行数:9,代码来源:ParsingUtilities.hpp

示例2: resetContent

 inline bool
 AsciiXmlParser::loadString( std::string const stringToParse )
 /* this loads stringToParse into the internal stringstream for parsing. if
   * there was a problem loading the file, false is returned. if there was a
   * file open, it is now closed.
   */
 {
   resetContent();
   stringParsingStream.clear();
   stringParsingStream.str( stringToParse );
   textStream = &stringParsingStream;
   return stringParsingStream.good();
 }
开发者ID:benoleary,项目名称:LesHouchesParserClasses_CPP,代码行数:13,代码来源:AsciiXmlParser.hpp

示例3: wam_main

int wam_main(int argc, char** argv, ProductManager& pm, systems::Wam<DOF>& wam) {

	BARRETT_UNITS_TEMPLATE_TYPEDEFS(DOF);

	// These vectors are fixed sized, stack allocated, and zero-initialized.
	jp_type jp;  // jp is a DOFx1 column vector of joint positions
	cp_type cp;  // cp is a 3x1 vector representing a Cartesian position

	wam.gravityCompensate();
	printMenu();
	Hand* hand = pm.getHand();

	std::string line;
	bool going = true;
	while (going) {
		printf(">>> ");
		std::getline(std::cin, line);

		switch (line[0]) {

		case 'p':
			moveToStr(wam, &cp, "tool position", line.substr(1));
			break;

		case 'j':
					moveToStr(wam, &jp, "joint positions", line.substr(1));
					break;

		case 'h':
			std::cout << "Moving to home position: "
					<< wam.getHomePosition() << std::endl;
			wam.moveHome();
			break;

		case 'i':
			printf("WAM idled.\n");
			wam.idle();
			break;

		case 'g':
			hand->trapezoidalMove(Hand::jp_type(M_PI/3.0), Hand::SPREAD);
			break;


		case 'o':
			hand->initialize();
//			hand->close(Hand::GRASP);
//			hand->open(Hand::GRASP);
//		   	hand->close(Hand::SPREAD);
//		   	hand->trapezoidalMove(Hand::jp_type(M_PI/2.0),1, Hand::GRASP);
//		   	hand->trapezoidalMove(Hand::jp_type(M_PI/2.0), Hand::GRASP);
		   	break;

		case 'a':
//			hand->initialize();
			hand->close(Hand::SPREAD);
//			hand->close(Hand::GRASP);
			break;

		case 'c':
//			hand->initialize();
			hand->close(Hand::GRASP);
			break;

//		case 'f':
//			while (std::getline(file_jp,line_jp))
//			{
//			moveToStr(wam, &jp, "joint positions", line_jp);
//			waitForEnter();
//			}
//			break;

		case 'd':
//					hand->initialize();
					hand->open(Hand::SPREAD);
					break;

		case 'e':
//							hand->initialize();
							hand->open(Hand::GRASP);
							break;

		case 'b':
			hand->trapezoidalMove(Hand::jp_type(M_PI/2.0), Hand::GRASP);
			break;

		case 't':
			hand->trapezoidalMove(Hand::jp_type((M_PI)/6.0), Hand::GRASP);
//			std::cout << "sending back a message..." << std::endl;
			break;

		case 'm':
//			temp_str = line.substr(2);
			iss2.clear();
			iss2.str("");
			iss2.str(line.substr(2)) ;
		    iss2 >> angle_degree;
//			std::cin >> angle_degree;
			angle_radian = angle_degree*(M_PI/180);
			hand->trapezoidalMove(Hand::jp_type(angle_radian), Hand::GRASP);
//.........这里部分代码省略.........
开发者ID:niladridas,项目名称:module_heisenberg,代码行数:101,代码来源:hand_control_complete.cpp


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