本文整理汇总了C++中ACE_Unbounded_Queue::enqueue_tail方法的典型用法代码示例。如果您正苦于以下问题:C++ ACE_Unbounded_Queue::enqueue_tail方法的具体用法?C++ ACE_Unbounded_Queue::enqueue_tail怎么用?C++ ACE_Unbounded_Queue::enqueue_tail使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ACE_Unbounded_Queue
的用法示例。
在下文中一共展示了ACE_Unbounded_Queue::enqueue_tail方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: aggr_cstr
void
FE_extract_env_include_paths (ACE_Unbounded_Queue<ACE_CString> &list)
{
ACE_Env_Value<char*> incl_paths (ACE_TEXT ("INCLUDE"),
(char *) 0);
const char *aggr_str = incl_paths;
if (aggr_str != 0)
{
char separator;
#if defined (ACE_WIN32)
separator = ';';
#else
separator = ':';
#endif
ACE_CString aggr_cstr (aggr_str);
ACE_CString::size_type pos;
do
{
pos = aggr_cstr.find (separator);
list.enqueue_tail (aggr_cstr.substr (0, pos));
aggr_cstr = aggr_cstr.substr (pos + 1);
} while (pos != ACE_CString::npos);
}
}
示例2: remove_from_owner
void Gadget_Part_Impl::remove_from_owner (void)
{
// Need to guarantee the existence of the owner for the duration of this call.
Gadget_var owner = owner_;
// Weak pointers are automatically set to NULL if the object they refer to
// is deleted. We can use this fact to check that our owner still exists.
if (owner == 0)
return;
// Take all existing parts from the owner and build up a temporary list. If
// we find ourselves then we won't add ourselves to the list.
ACE_Unbounded_Queue<Gadget_Part_var> parts;
for (;;)
{
Gadget_Part_var part = owner->remove_part ();
if (part == 0)
break;
if (part != this)
parts.enqueue_tail (part);
}
// Add the remaining parts back to the gadget.
while (!parts.is_empty ())
{
Gadget_Part_var part;
parts.dequeue_head (part);
owner->add_part (part);
}
}
示例3: runStackUnboundedQueue
// Listing 1 code/ch05
int QueueExample::runStackUnboundedQueue (void)
{
ACE_TRACE ("QueueExample::runStackUnboundedQueue");
ACE_Unbounded_Queue<DataElement> queue;
DataElement elem1[10];
int i;
for (i = 0; i < 10; i++)
{
elem1[i].setData (9-i);
queue.enqueue_head (elem1[i]);
}
DataElement elem2[10];
for (i = 0; i < 10; i++)
{
elem2[i].setData (i+10);
queue.enqueue_tail (elem2[i]);
}
for (ACE_Unbounded_Queue_Iterator<DataElement> iter (queue);
!iter.done ();
iter.advance ())
{
DataElement *elem = 0;
iter.next (elem);
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%d:"), elem->getData ()));
}
return 0;
}
示例4: saveFrame
void saveFrame(Sound& sound) {
sounds.enqueue_tail(sound);
samples += sound.getSamples();
channels = sound.getChannels();
printf(" %ld sound frames buffered in memory (%ld samples)\n",
(long int) sounds.size(),
(long int) samples);
}
示例5:
void
TAO_InterfaceDef_i::inherited_operations (
ACE_Unbounded_Queue<ACE_Configuration_Section_Key> &key_queue
)
{
ACE_Unbounded_Queue<CORBA::DefinitionKind> kind_queue;
ACE_Unbounded_Queue<ACE_TString> path_queue;
this->base_interfaces_recursive (kind_queue,
path_queue);
size_t size = path_queue.size ();
ACE_Configuration_Section_Key base_key, ops_key, op_key;
int status = 0;
ACE_TString path_name;
u_int count = 0;
for (size_t i = 0; i < size; ++i)
{
path_queue.dequeue_head (path_name);
status =
this->repo_->config ()->expand_path (this->repo_->root_key (),
path_name,
base_key,
0);
if (status == 0)
{
this->repo_->config ()->open_section (base_key,
"ops",
0,
ops_key);
this->repo_->config ()->get_integer_value (ops_key,
"count",
count);
for (u_int j = 0; j < count; ++j)
{
char *stringified = TAO_IFR_Service_Utils::int_to_string (j);
this->repo_->config ()->open_section (ops_key,
stringified,
0,
op_key);
key_queue.enqueue_tail (op_key);
}
}
}
}
示例6: recv
void Socket_Impl::recv (Message_ptr m)
{
if (m->find (Data::id) != 0 || m->find (NoData::id) != 0)
{
if (!loop_)
{
Address to (static_cast<To const*> (m->find (To::id))->address ());
Address from (
static_cast<From const*> (m->find (From::id))->address ());
if (to == from)
return;
}
Lock l (mutex_);
//if (queue_.size () != 0)
// cerr << "recv socket queue size: " << queue_.size () << endl;
//FUZZ: disable check_for_lack_ACE_OS
bool signal (queue_.is_empty ());
//FUZZ: enable check_for_lack_ACE_OS
queue_.enqueue_tail (m);
if (signal)
{
// Also write to the pipe.
if (signal_pipe_.write_handle () != ACE_INVALID_HANDLE)
{
char c;
if (signal_pipe_.send (&c, 1) != 1)
{
// perror ("write: ");
ACE_OS::abort ();
}
}
cond_.signal ();
}
}
}
示例7: return
// Are we or the parameter node involved in any recursion?
bool
AST_Exception::in_recursion (ACE_Unbounded_Queue<AST_Type *> &list)
{
bool self_test = (list.size () == 0);
// We should calculate this only once. If it has already been
// done, just return it.
if (self_test && this->in_recursion_ != -1)
{
return (this->in_recursion_ == 1);
}
if (list.size () > 1)
{
if (match_names (this, list))
{
// this happens when we are not recursed ourselves but instead
// are part of another recursive type
return false;
}
}
list.enqueue_tail(this);
// Proceed if the number of members in our scope is greater than 0.
if (this->nmembers () > 0)
{
// Continue until each element is visited.
for (UTL_ScopeActiveIterator i (this, IK_decls);!i.is_done ();i.next ())
{
AST_Field *field = AST_Field::narrow_from_decl (i.item ());
if (field == 0)
// This will be an enum value or other legitimate non-field
// member - in any case, no recursion.
{
continue;
}
AST_Type *type = field->field_type ();
if (type->node_type () == AST_Decl::NT_typedef)
{
AST_Typedef *td = AST_Typedef::narrow_from_decl (type);
type = td->primitive_base_type ();
}
if (type == 0)
{
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("(%N:%l) AST_Exception::")
ACE_TEXT ("in_recursion - ")
ACE_TEXT ("bad field type\n")),
0);
}
if (type->in_recursion (list))
{
if (self_test)
this->in_recursion_ = 1;
idl_global->recursive_type_seen_ = true;
return true;
}
}
}
// Not in recursion.
if (self_test)
this->in_recursion_ = 0;
return 0; //this->in_recursion_;
}
示例8: tmp
void
TAO_InterfaceDef_i::base_interfaces_recursive (
ACE_Unbounded_Queue<CORBA::DefinitionKind> &kind_queue,
ACE_Unbounded_Queue<ACE_TString> &path_queue
)
{
ACE_Configuration_Section_Key inherited_key;
int status =
this->repo_->config ()->open_section (this->section_key_,
"inherited",
0,
inherited_key);
// No base interfaces.
if (status != 0)
{
return;
}
int index = 0;
u_int kind = 0;
ACE_Configuration::VALUETYPE type;
ACE_TString section_name, inherited_path;
CORBA::DefinitionKind def_kind = CORBA::dk_none;
ACE_Configuration_Section_Key base_key;
while (this->repo_->config ()->enumerate_values (inherited_key,
index++,
section_name,
type)
== 0)
{
this->repo_->config ()->get_string_value (inherited_key,
section_name.c_str (),
inherited_path);
status =
this->repo_->config ()->expand_path (this->repo_->root_key (),
inherited_path,
base_key,
0);
if (status == 0)
{
TAO_InterfaceDef_i tmp (this->repo_);
tmp.section_key (base_key);
tmp.base_interfaces_recursive (kind_queue,
path_queue);
path_queue.enqueue_tail (inherited_path);
this->repo_->config ()->get_integer_value (base_key,
"def_kind",
kind);
def_kind = static_cast<CORBA::DefinitionKind> (kind);
kind_queue.enqueue_tail (def_kind);
}
}
}
示例9: base_iface
void
TAO_InterfaceDef_i::interface_contents (
ACE_Unbounded_Queue<CORBA::DefinitionKind> &kind_queue,
ACE_Unbounded_Queue<ACE_TString> &path_queue,
CORBA::DefinitionKind limit_type,
CORBA::Boolean exclude_inherited
)
{
ACE_TString id;
this->repo_->config ()->get_string_value (this->section_key_,
"id",
id);
ACE_TString path;
this->repo_->config ()->get_string_value (this->repo_->repo_ids_key (),
id.c_str (),
path);
ACE_TString section_name;
int index = 0;
int status = 0;
// Attributes
if (limit_type == CORBA::dk_Attribute
|| limit_type == CORBA::dk_all)
{
ACE_Configuration_Section_Key attrs_key;
status =
this->repo_->config ()->open_section (this->section_key_,
"attrs",
0,
attrs_key);
// Only if we have any.
if (status == 0)
{
while (this->repo_->config ()->enumerate_sections (attrs_key,
index++,
section_name)
== 0)
{
kind_queue.enqueue_tail (CORBA::dk_Attribute);
path_queue.enqueue_tail (
path + "\\attrs\\" + section_name.c_str ()
);
}
}
}
// Operations
if (limit_type == CORBA::dk_Operation
|| limit_type == CORBA::dk_all)
{
index = 0;
ACE_Configuration_Section_Key ops_key;
status =
this->repo_->config ()->open_section (this->section_key_,
"ops",
0,
ops_key);
// Only if we have any.
if (status == 0)
{
while (this->repo_->config ()->enumerate_sections (ops_key,
index++,
section_name)
== 0)
{
kind_queue.enqueue_tail (CORBA::dk_Operation);
path_queue.enqueue_tail (
path + "\\ops\\" + section_name.c_str ()
);
}
}
}
if (exclude_inherited == 0)
{
// Must recurse through the base interfaces.
ACE_Configuration_Section_Key inherited_key;
status =
this->repo_->config ()->open_section (this->section_key_,
"inherited",
0,
inherited_key);
if (status == 0)
{
ACE_TString base_path;
ACE_Configuration_Section_Key base_key;
ACE_Configuration::VALUETYPE type;
index = 0;
while (this->repo_->config ()->enumerate_values (inherited_key,
index++,
section_name,
//.........这里部分代码省略.........
示例10: while
void
Event_Supplier::load_schedule_data
(ACE_Unbounded_Queue<Schedule_Viewer_Data *> &schedule_data)
{
Schedule_Viewer_Data *data = 0;
if (this->input_file_name_)
{
// Open the scheduler data input file and read its contents into
// a queue.
FILE *input_file;
int scan_count = 0;
input_file = ACE_OS::fopen(this->input_file_name_, "r");
if (input_file)
{
// Get a line at a time from the data file and parse it.
char input_buf[BUFSIZ];
while (ACE_OS::fgets (input_buf, BUFSIZ, input_file))
{
// Run through leading whitespace.
char *temp = input_buf;
while (*temp && ACE_OS::ace_isspace (*temp))
++temp;
// If there is anything besides whitespace in the line
// read, scan its fields into the scheduling data
// structure.
if (ACE_OS::strlen (temp) > 0)
{
ACE_NEW (data, Schedule_Viewer_Data);
scan_count = sscanf (temp, "%s %lf %lf %lu %lu %lu %lu",
data->operation_name,
&data->utilitzation,
&data->overhead,
&data->arrival_time,
&data->deadline_time,
&data->completion_time,
&data->computation_time);
if (scan_count != 7)
{
ACE_ERROR ((LM_ERROR,
"Event_Supplier::start_generating_events: "
"scanned incorrect number of data elements: %d\n", scan_count));
delete data;
return;
}
// Insert the data into the queue.
schedule_data.enqueue_tail (data);
}
}
}
else
{
ACE_ERROR ((LM_ERROR,
"Event_Supplier::start_generating_events: "
"could not open input file [%s].\n",
this->input_file_name_));
return;
}
}
else
{
u_long last_completion = 0;
// Just create 10 dummy scheduling records and use them.
for (int i = 0; i < 10; ++i)
{
ACE_NEW (data, Schedule_Viewer_Data);
const char *oper_name = 0;
switch (i % 4)
{
case 0:
oper_name = "high_20";
break;
case 1:
oper_name = "low_20";
break;
case 2:
oper_name = "high_10";
break;
case 3:
default:
oper_name = "low_10";
break;
}
ACE_OS::strncpy (data->operation_name,
oper_name,
BUFSIZ-1);
data->utilitzation = (double)(20.0+ACE_OS::rand() %10);
//.........这里部分代码省略.........