本文整理汇总了C++中Generator::gen_string方法的典型用法代码示例。如果您正苦于以下问题:C++ Generator::gen_string方法的具体用法?C++ Generator::gen_string怎么用?C++ Generator::gen_string使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Generator
的用法示例。
在下文中一共展示了Generator::gen_string方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
int
Test_Var_Struct::init_parameters (Param_Test_ptr)
{
Generator *gen = GENERATOR::instance (); // value generator
// get some sequence length (not more than 10)
CORBA::ULong len = (CORBA::ULong) (gen->gen_long () % 10) + 1;
this->in_.dbl = 3.14159;
this->in_.dummy1 = gen->gen_string ();
this->in_.boole = gen->gen_short () % 2;
this->in_.dummy2 = gen->gen_string ();
this->in_.shrt = gen->gen_short ();
// set the length of the sequence
this->in_.seq.length (len);
// now set each individual element
for (CORBA::ULong i = 0; i < this->in_.seq.length (); i++)
{
// generate some arbitrary string to be filled into the ith location in
// the sequence
char *str = gen->gen_string ();
this->in_.seq[i] = str;
}
this->inout_->dbl = 0.0;
this->inout_->dummy1 = CORBA::string_dup ("");
this->inout_->boole = 0;
this->inout_->dummy2 = CORBA::string_dup ("");
this->inout_->shrt = 0;
// set the length of the sequence
this->inout_->seq.length (0);
return 0;
}
示例2: catch
int
Test_Objref_Struct::init_parameters (Param_Test_ptr objref)
{
try
{
Generator *gen = GENERATOR::instance (); // value generator
// Set the long member.
this->in_.x = gen->gen_long ();
this->in_.y = objref->make_coffee ();
Coffee::Desc d;
d.name = gen->gen_string ();
this->in_.y->description (d);
this->inout_->x = 0;
this->inout_->y = Coffee::_nil ();
Coffee::Desc dd;
dd.name = CORBA::string_dup ("");
return 0;
}
catch (const CORBA::Exception& ex)
{
ex._tao_print_exception ("Test_Objref_Struct::init_parameters\n");
}
return -1;
}
示例3:
int
Test_Unbounded_String::init_parameters (Alt_Mapping_ptr)
{
Generator *gen = GENERATOR::instance (); // value generator
this->in_ = gen->gen_string ();
this->inout_ = this->in_.c_str ();
return 0;
}
示例4:
int
Test_Var_Array::init_parameters (Param_Test_ptr)
{
Generator *gen = GENERATOR::instance (); // value generator
// fill the in_ array
for (CORBA::ULong i=0; i < Param_Test::DIM2; i++)
{
this->in_[i] = gen->gen_string ();
}
return 0;
}
示例5: switch
int
Test_Any::reset_parameters (void)
{
Generator *gen = GENERATOR::instance (); // value generator
CORBA::ULong index = (counter++ % Test_Any::ANY_LAST_TEST_ITEM);
switch (index)
{
default:
case Test_Any::ANY_SHORT:
{
if (TAO_debug_level > 0)
ACE_DEBUG ((LM_DEBUG,
"Param_Test: ANY_SHORT subtest\n"));
CORBA::Short s;
s = gen->gen_short ();
if (TAO_debug_level > 0)
ACE_DEBUG ((LM_DEBUG, "setting short = %d\n", s));
this->in_ <<= s;
this->inout_ <<= s;
}
break;
case Test_Any::ANY_STRING:
{
if (TAO_debug_level > 0)
ACE_DEBUG ((LM_DEBUG,
"Param_Test: ANY_STRING subtest\n"));
char *str = gen->gen_string ();
if (TAO_debug_level > 0)
ACE_DEBUG ((LM_DEBUG, "setting string = %s\n", str));
this->in_ <<= str;
this->inout_ <<= str;
CORBA::string_free (str);
}
break;
case Test_Any::ANY_OBJREF:
{
if (TAO_debug_level > 0)
ACE_DEBUG ((LM_DEBUG,
"Param_Test: ANY_OBJREF subtest\n"));
// insert the coffee object into the Any
this->in_ <<= this->cobj_.in ();
this->inout_ <<= this->cobj_.in ();
}
break;
case Test_Any::ANY_ARRAY:
{
if (TAO_debug_level > 0)
ACE_DEBUG ((LM_DEBUG,
"Param_Test: ANY_ARRAY subtest\n"));
Param_Test::Fixed_Array array;
for (size_t i = 0; i < Param_Test::DIM1; i++)
array[i] = i;
if (TAO_debug_level > 0)
ACE_DEBUG ((LM_DEBUG, "Setting Fixed_Array\n"));
this->in_ <<= Param_Test::Fixed_Array_forany (array);
this->inout_ <<= Param_Test::Fixed_Array_forany (array);
}
break;
case Test_Any::ANY_SHORT_SEQ:
{
if (TAO_debug_level > 0)
ACE_DEBUG ((LM_DEBUG,
"Param_Test: ANY_SHORT_SEQ subtest\n"));
CORBA::ShortSeq seq;
seq.length (gen->gen_short () % 16);
for (size_t i = 0; i < seq.length (); i++)
seq[i] = gen->gen_short ();
this->in_ <<= seq;
this->inout_ <<= seq;
}
break;
case Test_Any::ANY_BD_SHORT_SEQ:
{
if (TAO_debug_level > 0)
ACE_DEBUG ((LM_DEBUG,
"Param_Test: ANY_BD_SHORT_SEQ subtest\n"));
Param_Test::Bounded_Short_Seq seq;
seq.length (gen->gen_short () % seq.maximum ());
for (size_t i = 0; i < seq.length (); i++)
seq[i] = gen->gen_short ();
this->in_ <<= seq;
this->inout_ <<= seq;
}
break;
case Test_Any::ANY_STRUCT:
{
if (TAO_debug_level > 0)
ACE_DEBUG ((LM_DEBUG,
"Param_Test: ANY_STRUCT subtest\n"));
//.........这里部分代码省略.........