本文整理汇总了C++中ACE_NEW函数的典型用法代码示例。如果您正苦于以下问题:C++ ACE_NEW函数的具体用法?C++ ACE_NEW怎么用?C++ ACE_NEW使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ACE_NEW函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: create_reactor
static void
create_reactor (void)
{
ACE_Reactor_Impl *impl = 0;
if (opt_wfmo_reactor)
{
#if defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)
ACE_NEW (impl, ACE_WFMO_Reactor);
#endif /* ACE_WIN32 */
}
else if (opt_select_reactor)
{
ACE_NEW (impl, ACE_Select_Reactor);
}
ACE_Reactor *reactor = 0;
ACE_NEW (reactor, ACE_Reactor (impl));
ACE_Reactor::instance (reactor);
}
示例2: name_options_
ACE_Naming_Context::ACE_Naming_Context (void)
: name_options_ (0),
name_space_ (0),
netnameserver_host_ (0)
{
ACE_TRACE ("ACE_Naming_Context::ACE_Naming_Context");
ACE_NEW (this->name_options_,
ACE_Name_Options);
}
示例3: test_caching_strategy_type
void
test_caching_strategy_type (void)
{
HASH_MAP_CACHING_STRATEGY *hash_map_caching_strategy = 0;
MAP_CACHING_STRATEGY *map_caching_strategy = 0;
switch (caching_strategy_type)
{
case ACE_NULL:
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nNull_Caching_Strategy\n\n")));
ACE_NEW (map_caching_strategy,
MAP_NULL_ADAPTER);
ACE_NEW (hash_map_caching_strategy,
HASH_MAP_NULL_ADAPTER);
break;
case ACE_LRU:
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nLRU_Caching_Strategy\n\n")));
ACE_NEW (map_caching_strategy,
MAP_LRU_ADAPTER);
ACE_NEW (hash_map_caching_strategy,
HASH_MAP_LRU_ADAPTER);
break;
case ACE_LFU:
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nLFU_Caching_Strategy\n\n")));
ACE_NEW (map_caching_strategy,
MAP_LFU_ADAPTER);
ACE_NEW (hash_map_caching_strategy,
HASH_MAP_LFU_ADAPTER);
break;
case ACE_FIFO:
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nFIFO_Caching_Strategy\n\n")));
ACE_NEW (map_caching_strategy,
MAP_FIFO_ADAPTER);
ACE_NEW (hash_map_caching_strategy,
HASH_MAP_FIFO_ADAPTER);
break;
case ACE_ALL: // Just to remove warnings!
break;
}
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("map cache\n")));
functionality_test_cache (*map_caching_strategy);
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nhash map cache\n")));
functionality_test_hash_cache (*hash_map_caching_strategy);
delete map_caching_strategy;
delete hash_map_caching_strategy;
}
示例4: ACE_NEW
void
TAO_LF_Multi_Event::add_event (TAO_Connection_Handler *ev)
{
Event_Node *node = 0;
ACE_NEW (node, Event_Node);
node->next_ = this->events_;
node->ptr_ = ev;
this->events_ = node;
}
示例5: proxy_addr_
//----------------------------------------------------------------------------
ACE::HTBP::Session::Session (void)
: proxy_addr_ (0),
destroy_proxy_addr_ (0),
inbound_ (0),
outbound_ (0),
closed_ (false),
handler_ (0),
reactor_(0),
stream_ (0),
sock_flags_(0)
{
ACE::HTBP::ID_Requestor req;
ACE_TCHAR * htid = req.get_HTID();
ACE_Auto_Array_Ptr<ACE_TCHAR> guard (htid);
session_id_.local_ = ACE_TEXT_ALWAYS_CHAR(htid);
session_id_.id_ = ACE::HTBP::Session::next_session_id();
ACE_NEW (inbound_, ACE::HTBP::Channel (this));
ACE_NEW (outbound_, ACE::HTBP::Channel (this));
}
示例6: iostream
ACE_IOStream<STREAM>::ACE_IOStream (STREAM &stream,
u_int streambuf_size)
: iostream (0),
STREAM (stream)
{
ACE_NEW (streambuf_,
ACE_Streambuf_T<STREAM> ((STREAM *) this,
streambuf_size));
iostream::init (this->streambuf_);
}
示例7: ACE_NEW
ACE_TSS_Guard<ACE_LOCK>::ACE_TSS_Guard (ACE_LOCK &lock, bool block)
{
this->init_key ();
Guard_Type *guard = 0;
ACE_NEW (guard,
Guard_Type (lock, block));
#if defined (ACE_HAS_THR_C_DEST)
ACE_TSS_Adapter *tss_adapter = 0;
ACE_NEW (tss_adapter,
ACE_TSS_Adapter ((void *) guard,
ACE_TSS_Guard<ACE_LOCK>::cleanup));
ACE_Thread::setspecific (this->key_,
(void *) tss_adapter);
#else
ACE_Thread::setspecific (this->key_,
(void *) guard);
#endif /* ACE_HAS_THR_C_DEST */
}
示例8: mutex_
TAO_Condition<MUTEX>::TAO_Condition (MUTEX &m)
: mutex_ (&m),
delete_lock_ (false),
cond_ (0)
{
// @todo: Need to add the allocatore here..
ACE_NEW (this->cond_,
TAO_SYNCH_CONDITION (*this->mutex_));
}
示例9: is_active_
//
// Standard_EINode
//
Standard_EINode::Standard_EINode (void)
: is_active_ (false),
reconnect_timeout_ (1),
connect_task_ (this)
{
Local_Data_Channel_i * channel = 0;
ACE_NEW (channel,
Local_Data_Channel_i (this));
this->local_channel_.reset (channel);
}
示例10: once_
ACE_TSS<TYPE>::ACE_TSS (TYPE *ts_obj)
: once_ (false),
key_ (ACE_OS::NULL_key)
{
// If caller has passed us a non-NULL TYPE *, then we'll just use
// this to initialize the thread-specific value. Thus, subsequent
// calls to operator->() will return this value. This is useful
// since it enables us to assign objects to thread-specific data
// that have arbitrarily complex constructors!
if (ts_obj != 0)
{
if (this->ts_init () == -1)
{
// Save/restore errno.
ACE_Errno_Guard error (errno);
// What should we do if this call fails?!
#if defined (ACE_HAS_WINCE)
::MessageBox (0,
ACE_TEXT ("ACE_Thread::keycreate() failed!"),
ACE_TEXT ("ACE_TSS::ACE_TSS"),
MB_OK);
#else
ACE_OS::fprintf (stderr,
"ACE_Thread::keycreate() failed!");
#endif /* ACE_HAS_WINCE */
return;
}
#if defined (ACE_HAS_THR_C_DEST)
// Encapsulate a ts_obj and it's destructor in an
// ACE_TSS_Adapter.
ACE_TSS_Adapter *tss_adapter = 0;
ACE_NEW (tss_adapter,
ACE_TSS_Adapter ((void *) ts_obj,
ACE_TSS<TYPE>::cleanup));
// Put the adapter in thread specific storage
if (ACE_Thread::setspecific (this->key_,
(void *) tss_adapter) != 0)
{
delete tss_adapter;
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("%p\n"),
ACE_TEXT ("ACE_Thread::setspecific() failed!")));
}
#else
if (ACE_Thread::setspecific (this->key_,
(void *) ts_obj) != 0)
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("%p\n"),
ACE_TEXT ("ACE_Thread::setspecific() failed!")));
#endif /* ACE_HAS_THR_C_DEST */
}
}
示例11: create_reactor
static void
create_reactor (void)
{
ACE_Reactor_Impl *impl = 0;
#if defined (TEST_CAN_USE_WFMO_REACTOR)
if (opt_wfmo_reactor)
ACE_NEW (impl,
ACE_WFMO_Reactor);
#endif /* TEST_CAN_USE_WFMO_REACTOR */
if (impl == 0 && opt_select_reactor)
ACE_NEW (impl,
ACE_Select_Reactor);
ACE_Reactor *reactor = 0;
ACE_NEW (reactor,
ACE_Reactor (impl));
ACE_Reactor::instance (reactor);
}
示例12: ACE_DEBUG
TimeStamp_Protocol_Object::TimeStamp_Protocol_Object (TAO_AV_Callback *callback,
TAO_AV_Transport *transport)
:TAO_AV_Protocol_Object (callback,transport)
{
ACE_DEBUG ((LM_DEBUG,
"TimeStamp_Protocol_Object::TimeStamp_Protocol_Object\n"));
ACE_NEW (this->frame_,
ACE_Message_Block);
this->frame_->size (4 * this->transport_->mtu ());
}
示例13: the_qos
void
Connection_Manager::connect_to_receivers (void)
{
// Connect to all receivers that we know about.
for (Receivers::iterator iterator = this->receivers_.begin ();
iterator != this->receivers_.end ();
++iterator)
{
// Initialize the QoS
AVStreams::streamQoS_var the_qos (new AVStreams::streamQoS);
ACE_CString flowname =
(*iterator).ext_id_;
// Create the forward flow specification to describe the flow.
TAO_Forward_FlowSpec_Entry sender_entry (flowname.c_str (),
"IN",
"USER_DEFINED",
"",
"UDP",
0);
// Set the flow specification for the stream between receiver
// and distributer
AVStreams::flowSpec flow_spec (1);
flow_spec.length (1);
flow_spec [0] =
CORBA::string_dup (sender_entry.entry_to_string ());
// Create the stream control for this stream.
TAO_StreamCtrl *streamctrl;
ACE_NEW (streamctrl,
TAO_StreamCtrl);
// Servant Reference Counting to manage lifetime
PortableServer::ServantBase_var safe_streamctrl =
streamctrl;
// Register streamctrl.
AVStreams::StreamCtrl_var streamctrl_object =
streamctrl->_this ();
// Bind the flowname and the corresponding stream controller to
// the stream controller map
this->streamctrls_.bind (flowname,
streamctrl_object);
// Bind the sender and receiver MMDevices.
(void) streamctrl->bind_devs (this->sender_.in (),
(*iterator).int_id_.in (),
the_qos.inout (),
flow_spec);
}
}
示例14: it
void
AsyncListManager::init_list (void)
{
CORBA::ULong len =
static_cast<CORBA::ULong> (this->repo_->servers ().current_size ());
Locator_Repository::SIMap::ENTRY* entry = 0;
Locator_Repository::SIMap::CONST_ITERATOR it (this->repo_->servers ());
this->server_list_.length (len);
this->waiters_ = 0;
for (CORBA::ULong i = 0; i < len; i++)
{
it.next (entry);
it.advance ();
Server_Info_Ptr info = entry->int_id_;
info->setImRInfo (&this->server_list_[i]);
if (this->pinger_ != 0)
{
ListLiveListener *l = 0;
ACE_NEW (l, ListLiveListener (info->ping_id (),
info->pid,
i,
this,
*this->pinger_));
LiveListener_ptr llp (l);
if (!l->start ())
{
this->server_list_[i].activeStatus =
ImplementationRepository::ACTIVE_NO;
l->cancel ();
}
else
{
if (!evaluate_status (i, l->status(), info->pid))
{
this->waiters_++;
}
else
{
l->cancel ();
}
}
}
}
if (ImR_Locator_i::debug() > 4)
{
ORBSVCS_DEBUG ((LM_DEBUG,
ACE_TEXT ("(%P|%t) AsyncListManager(%@)::init_list, %d waiters")
ACE_TEXT (" out of %d regsitered servers\n"),
this, this->waiters_, len));
}
}
示例15: ACE_NEW
void
TAO_ECG_Mcast_EH::add_new_subscriptions (Address_Set& multicast_addresses)
{
typedef ACE_Unbounded_Set_Iterator<ACE_INET_Addr> Address_Iterator;
for (Address_Iterator k = multicast_addresses.begin ();
k != multicast_addresses.end ();
++k)
{
Subscription new_subscription;
new_subscription.mcast_addr = *k;
ACE_NEW (new_subscription.dgram, ACE_SOCK_Dgram_Mcast);
size_t const subscriptions_size = this->subscriptions_.size ();
this->subscriptions_.size (subscriptions_size + 1);
this->subscriptions_[subscriptions_size] = new_subscription;
ACE_SOCK_Dgram_Mcast *socket = new_subscription.dgram;
if (socket->open (new_subscription.mcast_addr, this->net_if_, 1) == -1) {
ORBSVCS_ERROR ((LM_ERROR,
"Error: %d - Unable to open multicast socket\n",
ACE_ERRNO_GET));
}
if ( socket->enable (ACE_NONBLOCK) != 0 ) {
ORBSVCS_ERROR ((LM_ERROR,
"Error: %d - Unable to enable nonblocking on mcast_eh\n",
ACE_ERRNO_GET));
}
if (socket->join (new_subscription.mcast_addr, 1, this->net_if_) == -1) {
ORBSVCS_ERROR ((LM_ERROR,
"Error: %d - Unable to join multicast group\n",
ACE_ERRNO_GET));
}
if (this->recvbuf_size_ != 0
&& (((ACE_SOCK_Dgram *)socket)->set_option(SOL_SOCKET,
SO_RCVBUF,
(void *) &this->recvbuf_size_,
sizeof (this->recvbuf_size_)) == -1)
&& errno != ENOTSUP )
{
ORBSVCS_ERROR ((LM_ERROR,
"Error: %d - Unable to set mcast_eh recvbuf_size:%d\n",
ACE_ERRNO_GET,
this->recvbuf_size_));
}
(void) this->reactor ()->register_handler (
socket->get_handle (),
this,
ACE_Event_Handler::READ_MASK);
}
}