本文整理汇总了C++中Sentence::set方法的典型用法代码示例。如果您正苦于以下问题:C++ Sentence::set方法的具体用法?C++ Sentence::set怎么用?C++ Sentence::set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sentence
的用法示例。
在下文中一共展示了Sentence::set方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Parse_Sequencer_Statement
/*****************************************************************
Do the work of the Telegram :
return TRUE = GPIO Telegram was Handled by this routine
FALSE= GPIO Telegram not Handled by this routine
return: pointer to the next telegram (ie. after all our header and data bytes)
this will be null if end of the received buffer (terminator added in serverthread.c
by the number of bytes read).
, ServerHandler* mh
*****************************************************************/
int Parse_Sequencer_Statement( Sentence& mSentence )
{
int retval = -1;
printf("Parse_Sequencer_Statement() ");
mSentence.restore_reduced();
/* “Motor:Speed:Board=1:M1=211,M2=10,M3=127,M4=127”
“Motor:Speed:Board=2:M1=211,M2=10,M3=127,M4=127”
“Motor:Position:Board=1:M1=211,M2=10,M3=127,M4=127”
“Motor:Position:Board=2:M1=211,M2=10,M3=127,M4=127”
“Motor:home:Board=2:”
“Motor:stop_all:Board=1:”
*/
mSentence.m_sentence.split(':');
string key_word = mSentence.m_sentence.m_split_words[0];
string cmd_word = mSentence.m_sentence.m_split_words[1];
string board_select = mSentence.m_sentence.m_split_words[2];
string data_words = mSentence.m_sentence.m_split_words[3];
Sentence data;
data.set( data_words.c_str(), false);
float Values[5];
int Size;
//printf("Recieved: %s, %s, %s, %s \n", key_word.c_str(), cmd_word.c_str(), board_select.c_str(), data_words.c_str() );
int okay = key_word.compare( "Motor" );
if (okay==0)
{
if (cmd_word.compare( "Speed" )==0)
parse_motor_speed_command(data, Values, Size);
else if (cmd_word.compare( "Position" )==0)
parse_motor_position_command(data, Values, Size);
else if (cmd_word.compare( "home" )==0)
{
} else if (key_word.compare( "stop" )==0)
{
} else if (key_word.compare( "resume" )==0)
{
}
}
if (retval>-1) printf("Parse_Sequencer_Statement() ");
return retval;
}
示例2: test_math_protocol
void test_math_protocol()
{
printf("======= MATH PROTOCOL UNIT TESTS ==========\n");
ServerHandler mh;
Sentence sent;
// TEST ADDITION:
sent.set( "what is 5 plus 5 equal?");
Parse_Math_Statement( sent, &mh );
if (mh.nlp_reply_formulated) printf("RESPONSE: %s\n", mh.NLP_Response.c_str() );
sent.set( "what is 5 + 5 equal?");
Parse_Math_Statement( sent, &mh );
if (mh.nlp_reply_formulated) printf("RESPONSE: %s\n", mh.NLP_Response.c_str() );
sent.set( "what is 125 plus 250 plus 101 plus 201 equal ?");
Parse_Math_Statement( sent, &mh );
if (mh.nlp_reply_formulated) printf("RESPONSE: %s\n", mh.NLP_Response.c_str() );
sent.set( "what is 125 plus 250 equal ?");
Parse_Math_Statement( sent, &mh );
if (mh.nlp_reply_formulated) printf("RESPONSE: %s\n", mh.NLP_Response.c_str() );
// TEST SUBTRACTION:
sent.set( "what is 25 minus 10 equal ?");
Parse_Math_Statement( sent, &mh );
if (mh.nlp_reply_formulated) printf("RESPONSE: %s\n", mh.NLP_Response.c_str() );
sent.set( "what is 25 - 10 equal ?");
Parse_Math_Statement( sent, &mh );
if (mh.nlp_reply_formulated) printf("RESPONSE: %s\n", mh.NLP_Response.c_str() );
// TEST MULTIPLICATION:
sent.set( "what is 256 times 4 equal?");
Parse_Math_Statement( sent, &mh );
if (mh.nlp_reply_formulated) printf("RESPONSE: %s\n", mh.NLP_Response.c_str() );
// TEST DIVISION:
sent.set( "what is 512 divided by 16 equal?");
Parse_Math_Statement( sent, &mh );
if (mh.nlp_reply_formulated) printf("RESPONSE: %s\n", mh.NLP_Response.c_str() );
sent.set( "what is 64 / 16 equal?");
Parse_Math_Statement( sent, &mh );
if (mh.nlp_reply_formulated) printf("RESPONSE: %s\n", mh.NLP_Response.c_str() );
// UNIT CONVERSION:
sent.set( "Convert 230 km/hr to miles/hr");
Parse_Math_Statement( sent, &mh );
if (mh.nlp_reply_formulated) printf("RESPONSE: %s\n", mh.NLP_Response.c_str() );
sent.set( "Convert 130 miles per hour to km/hr");
Parse_Math_Statement( sent, &mh );
if (mh.nlp_reply_formulated) printf("RESPONSE: %s\n", mh.NLP_Response.c_str() );
sent.set( "Convert 185 lbs to kg");
Parse_Math_Statement( sent, &mh );
if (mh.nlp_reply_formulated) printf("RESPONSE: %s\n", mh.NLP_Response.c_str() );
sent.set( "Convert 100 kilograms to pounds");
Parse_Math_Statement( sent, &mh );
if (mh.nlp_reply_formulated) printf("RESPONSE: %s\n", mh.NLP_Response.c_str() );
sent.set( "Convert 16 ounces to grams");
Parse_Math_Statement( sent, &mh );
if (mh.nlp_reply_formulated) printf("RESPONSE: %s\n", mh.NLP_Response.c_str() );
sent.set( "Convert 10 grams to ounce");
Parse_Math_Statement( sent, &mh );
if (mh.nlp_reply_formulated) printf("RESPONSE: %s\n", mh.NLP_Response.c_str() );
sent.set( "Convert 6 inches to cm");
Parse_Math_Statement( sent, &mh );
if (mh.nlp_reply_formulated) printf("RESPONSE: %s\n", mh.NLP_Response.c_str() );
sent.set( "Convert 50 cm to inches");
Parse_Math_Statement( sent, &mh );
if (mh.nlp_reply_formulated) printf("RESPONSE: %s\n", mh.NLP_Response.c_str() );
sent.set( "Convert 5280 feet to meters");
Parse_Math_Statement( sent, &mh );
if (mh.nlp_reply_formulated) printf("RESPONSE: %s\n", mh.NLP_Response.c_str() );
sent.set( "Convert 100 meters to feet");
Parse_Math_Statement( sent, &mh );
if (mh.nlp_reply_formulated) printf("RESPONSE: %s\n", mh.NLP_Response.c_str() );
sent.set( "Convert 100 meters to feet");
Parse_Math_Statement( sent, &mh );
if (mh.nlp_reply_formulated) printf("RESPONSE: %s\n", mh.NLP_Response.c_str() );
}