本文整理汇总了C++中ACE_CString类的典型用法代码示例。如果您正苦于以下问题:C++ ACE_CString类的具体用法?C++ ACE_CString怎么用?C++ ACE_CString使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ACE_CString类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ACE_TMAIN
int ACE_TMAIN (int argc, ACE_TCHAR *argv[])
{
try {
// Initialize orb
CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);
if (parse_args (argc, argv) != 0)
return 1;
//Get reference to Root POA
CORBA::Object_var obj = orb->resolve_initial_references("RootPOA");
PortableServer::POA_var poa = PortableServer::POA::_narrow(obj.in());
// Activate POA Manager
PortableServer::POAManager_var mgr = poa->the_POAManager();
mgr->activate();
// Find the Naming Service
obj = orb->resolve_initial_references("NameService");
CosNaming::NamingContextExt_var root =
CosNaming::NamingContextExt::_narrow(obj.in());
if (CORBA::is_nil(root.in())) {
std::cerr << "Nil Naming Context reference" << std::endl;
return 1;
}
// Bind a new context.
CosNaming::Name name;
name.length( 1 );
name[0].id = CORBA::string_dup( "root.esc-dot" );
name[0].kind = CORBA::string_dup( "kind1" );
try {
obj = root->resolve(name);
}
catch(const CosNaming::NamingContext::NotFound&) {
CosNaming::NamingContext_var dummy = root->bind_new_context(name);
}
name.length( 2 );
name[1].id = CORBA::string_dup( "leaf/esc-slash" );
name[1].kind = CORBA::string_dup( "kind2" );
// Create an object
PortableServer::Servant_var<Messenger_i> servant = new Messenger_i;
PortableServer::ObjectId_var oid = poa->activate_object(servant.in());
CORBA::Object_var messenger_obj = poa->id_to_reference(oid.in());
root->rebind(name, messenger_obj.in());
// Also try rebinding to a simple path.
CosNaming::Name_var simp_name = root->to_name("Simple");
try {
obj = root->resolve(simp_name.in());
}
catch(const CosNaming::NamingContext::NotFound&) {
CosNaming::NamingContext_var dummy =
root->bind_new_context(simp_name.in());
}
simp_name = root->to_name("Simple/Messenger");
root->rebind(simp_name.in(), messenger_obj.in());
// Convert Name to String Name.
CORBA::String_var str_name = root->to_string(name);
std::cout << "str_name: " << str_name.in() << std::endl;
CORBA::String_var str_simple = root->to_string(simp_name.in());
std::cout << "simple: " << str_simple.in() << std::endl;
// Convert String Name to Name.
CosNaming::Name_var tname = root->to_name(str_name.in());
std::cout << "converted back to a CosNaming::Name: " << std::endl;
std::cout << " name[0] = " << (* tname)[0].id.in() << " , "
<< (* tname)[0].kind.in() << std::endl;
std::cout << " name[1] = " << (* tname)[1].id.in() << " , "
<< (* tname)[1].kind.in() << std::endl;
// Find the application object by resolve_str.
try {
obj = root->resolve_str(str_name.in());
}
catch(const CosNaming::NamingContext::NotFound&) {
std::cerr<<"Couldn't resolve the string name: " << str_name << std::endl;
return 1;
}
ACE_CString base_address (":");
base_address += ACE_TEXT_ALWAYS_CHAR (hostname);
base_address += ":";
base_address += ACE_TEXT_ALWAYS_CHAR (port);
ACE_CString addr ("");
addr = base_address + "/key/str";
// Create an URL string for application object.
CORBA::String_var address = CORBA::string_dup (addr.c_str());
std::cout << "call to_url(\"" << address.in() << "\"" << std::endl;
std::cout << " ,\"" << str_simple.in() << "\")"<< std::endl;
CORBA::String_var url_string = root->to_url(address.in(), str_simple.in());
//.........这里部分代码省略.........
示例2: DSUI_EVENT_LOG
void
EDF_Scheduler::receive_reply (PortableInterceptor::ClientRequestInfo_ptr ri)
{
int int_guid;
DSUI_EVENT_LOG (EDF_SCHED_FAM, ENTER_RECEIVE_REPLY, 0, 0, 0);
RTScheduling::Current::IdType guid;
CORBA::String_var operation = ri->operation ();
CORBA::Object_var target = ri->target ();
ACE_CString opname = operation.in ();
#ifdef KOKYU_DSRT_LOGGING
ACE_DEBUG ((LM_DEBUG,
"(%t|%T):receive_reply from "
"\"%s\"\n",
opname.c_str ()));
#endif
// Check that the reply service context was received as
// expected.
IOP::ServiceContext_var sc =
ri->get_reply_service_context (Client_Interceptor::SchedulingInfo);
CORBA::Long importance;
TimeBase::TimeT deadline;
if (sc.ptr () == 0)
{
ACE_DEBUG ((LM_DEBUG, "service context was not filled\n"));
//24 hrs from now - infinity
ACE_Time_Value deadline_tv = ACE_OS::gettimeofday () + ACE_Time_Value (24*60*60,0);
deadline = deadline_tv.sec ()*1000000 + deadline_tv.usec ()*10; //100s of nanoseconds for TimeBase::TimeT
importance = 0;
}
else
{
CORBA::OctetSeq oc_seq = CORBA::OctetSeq (sc->context_data.length (),
sc->context_data.length (),
sc->context_data.get_buffer (),
0);
//Don't store in a _var, since >>= returns a pointer to an internal buffer
//and we are not supposed to free it.
Kokyu::Svc_Ctxt_DSRT_QoS* sc_qos_ptr;
CORBA::Any sc_qos_as_any;
CORBA::Any_var scqostmp = codec_->decode (oc_seq);
sc_qos_as_any = scqostmp.in ();
sc_qos_as_any >>= sc_qos_ptr;
deadline = sc_qos_ptr->deadline;
importance = sc_qos_ptr->importance;
guid.length (sc_qos_ptr->guid.length ());
guid_copy (guid, sc_qos_ptr->guid);
ACE_DEBUG ((LM_DEBUG,
"(%t|%T):Importance = %d in recvd service context\n",
importance));
}
ACE_OS::memcpy (&int_guid,
guid.get_buffer (),
guid.length ());
EDF_Scheduler_Traits::QoSDescriptor_t qos;
qos.deadline_ = qos.importance_ = importance;
qos.deadline_ = deadline;
this->kokyu_dispatcher_->schedule (guid, qos);
DSUI_EVENT_LOG (EDF_SCHED_FAM, EXIT_RECEIVE_REPLY, int_guid, 0, 0);
}
示例3: name
UTL_ScopedName *
be_visitor_xplicit_pre_proc::xplicit_iface_rel_name (AST_Decl *d)
{
AST_Decl *tmp = d;
ACE_CString name (d->full_name ());
while (tmp != 0)
{
if (be_home::narrow_from_decl (tmp) != 0)
{
ACE_CString head (tmp->local_name ()->get_string ());
ACE_CString::size_type start = name.find (head) + 2;
ACE_CString tail (name.substr (start + head.length ()));
return FE_Utils::string_to_scoped_name (tail.c_str ());
}
tmp = ScopeAsDecl (tmp->defined_in ());
}
return 0;
}
示例4: while
bool
ImR_Locator_i::split_key (ACE_CString &full, ACE_CString &key, Server_Info_Ptr &si)
{
key = full;
if (this->get_info_for_name (full.c_str(), si))
{
return true;
}
ACE_CString::size_type pos = full.rfind ('/');
while (pos != ACE_CString::npos)
{
ACE_CString server = full.substring (0, pos);
if (this->get_info_for_name (server.c_str (), si))
{
return true;
}
pos = server.rfind ('/');
}
return false;
}
示例5: ACE_TMAIN
int
ACE_TMAIN (int argc, ACE_TCHAR* argv[])
{
#if defined (TAO_HAS_MONITOR_FRAMEWORK) && (TAO_HAS_MONITOR_FRAMEWORK == 1)
try
{
CORBA::ORB_var orb = CORBA::ORB_init (argc, argv);
CORBA::Object_var obj = orb->resolve_initial_references ("RootPOA");
PortableServer::POA_var poa =
PortableServer::POA::_narrow (obj.in ());
PortableServer::POAManager_var poa_manager = poa->the_POAManager ();
poa_manager->activate ();
TAO_Notify_Service* notify_service =
TAO_Notify_Service::load_default ();
if (notify_service == 0)
{
error ("Unable to load the Notify Service");
}
notify_service->init_service (orb.in ());
ACE_OS::sleep (1);
const ACE_CString ecf_name ("MonitoringEventChannelFactory");
CosNotifyChannelAdmin::EventChannelFactory_var ecf =
notify_service->create (poa.in (), ecf_name.c_str ());
NotifyMonitoringExt::EventChannelFactory_var monitor_ec_factory =
NotifyMonitoringExt::EventChannelFactory::_narrow (ecf.in ());
if (CORBA::is_nil (monitor_ec_factory.in ()))
{
error ("Unable to create the Monitoring Event Channel Factory");
}
CosNotification::QoSProperties qos_prop;
CosNotification::AdminProperties admin_prop;
CosNotifyChannelAdmin::ChannelID id;
const ACE_CString ec_name ("test1");
CosNotifyChannelAdmin::EventChannel_var ec =
monitor_ec_factory->create_named_channel (qos_prop,
admin_prop,
id,
ec_name.c_str ());
NotifyMonitoringExt::EventChannel_var mec =
NotifyMonitoringExt::EventChannel::_narrow (ec.in ());
if (CORBA::is_nil (mec.in ()))
{
error ("Unable to narrow the event channel");
}
try
{
CosNotifyChannelAdmin::ChannelID fake_id;
CosNotifyChannelAdmin::EventChannel_var fake =
monitor_ec_factory->create_named_channel (qos_prop,
admin_prop,
fake_id,
"test1");
error ("Expected a NotifyMonitoringExt::"
"NameAlreadyUsed exception");
}
catch (const NotifyMonitoringExt::NameAlreadyUsed&)
{
// This is expected.
}
Monitor_Point_Registry* instance = Monitor_Point_Registry::instance ();
ACE_CString stat_name =
ecf_name
+ "/"
+ ACE_CString (NotifyMonitoringExt::InactiveEventChannelCount);
Monitor_Base* stat = instance->get (stat_name);
if (stat == 0)
{
error ("Could not find InactiveEventChannelCount statistic");
}
stat->update ();
double count = stat->last_sample ();
if (!ACE::is_equal (count, 1.0))
{
error ("Invalid inactive event channel count");
}
stat_name =
ecf_name
+ "/"
+ ACE_CString (NotifyMonitoringExt::ActiveEventChannelCount);
stat = instance->get (stat_name);
//.........这里部分代码省略.........
示例6: DANCE_TRACE
CORBA::Object_ptr
Plan_Launcher_Base_Impl< Manager, AppManager, Application>
::prepare_plan (const ::Deployment::DeploymentPlan &plan)
{
DANCE_TRACE ("Plan_Launcher_Base_Impl::prepare_plan");
#ifdef GEN_OSTREAM_OPS
if (DAnCE_debug_level >= DANCE_LOG_DETAILED_TRACE)
{
std::ostringstream plan_stream;
plan_stream << plan << std::endl;
DANCE_TRACE_LOG (DANCE_LOG_DETAILED_TRACE,
(LM_TRACE, DLINFO "Convert_Plan - Input plan: %C\n",
plan_stream.str ().c_str ()));
}
#endif /* GEN_OSTREAM_OPS */
typename AppManager::_var_type app_manager;
try
{
::Deployment::ApplicationManager_var l_manager =
this->manager_->preparePlan (plan, 0);
app_manager = app_manager = AppManager::_narrow (l_manager.in ());
}
catch (::Deployment::PlanError &ex)
{
ACE_CString error ("Caught PlanError exception while invoking preparePlan: ");
error += ex.name.in ();
error += ", ";
error += ex.reason.in ();
DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR,
(LM_ERROR, DLINFO
ACE_TEXT("Plan_Launcher_Base_Impl::prepare_plan - %C\n"),
error.c_str ()));
throw Deployment_Failure (error);
}
catch (::Deployment::StartError &ex)
{
ACE_CString error ("Caught StartError exception while invoking preparePlan: ");
error += ex.name.in ();
error += ", " ;
error += ex.reason.in ();
DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR,
(LM_ERROR, DLINFO
ACE_TEXT("Plan_Launcher_Base_Impl::prepare_plan - %C\n"),
error.c_str ()));
throw Deployment_Failure (error);
}
catch (::CORBA::Exception &ex)
{
ACE_CString error;
error += "Caught CORBA exception while invoking preparePlan: ";
error += ex._info ();
DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR,
(LM_ERROR, DLINFO
ACE_TEXT("Plan_Launcher_Base_Impl::prepare_plan - %C\n"),
error.c_str ()));
throw Deployment_Failure (error);
}
catch(...)
{
DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR,
(LM_ERROR, DLINFO ACE_TEXT("Plan_Launcher_Base_Impl::prepare_plan - ")
ACE_TEXT("An exception was thrown during EM->preparePlan.\n")));
throw Deployment_Failure ("An unexpected C++ exception was caught while invoking preparePlan");
}
DANCE_DEBUG (DANCE_LOG_EVENT_TRACE,
(LM_DEBUG, DLINFO
ACE_TEXT ("Plan_Launcher_Base_Impl::launch_plan - ")
ACE_TEXT ("after to call preparePlan\n")));
if (CORBA::is_nil (app_manager.in ()))
{
DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR,
(LM_ERROR, DLINFO ACE_TEXT("Plan_Launcher_Base_Impl::prepare_plan - ")
ACE_TEXT("preparePlan call failed: ")
ACE_TEXT("nil ApplicationManager reference\n")));
return 0;
}
else
{
DANCE_DEBUG (DANCE_LOG_MINOR_EVENT,
(LM_DEBUG, DLINFO ACE_TEXT("Plan_Launcher_Base_Impl::prepare_plan - ")
ACE_TEXT("ApplicationMAnager was received from preparePlan.\n")));
}
return app_manager._retn ();
}
示例7: return
int
TAO::HTIOP::Protocol_Factory::match_prefix (const ACE_CString &prefix)
{
// Check for the proper prefix for this protocol.
return (ACE_OS::strcasecmp (prefix.c_str (), ::the_prefix) == 0);
}
示例8: holder
int
be_visitor_servant_svh::visit_consumes (be_consumes *node)
{
if(!be_global->gen_noeventccm ())
{
const char *obj_name = node->consumes_type ()->full_name ();
const char *port_name = node->local_name ()->get_string ();
ACE_CString holder (obj_name);
ACE_CString::size_type pos = holder.rfind (':');
const char *ev_lname = 0;
if (pos == ACE_CString::npos)
{
ev_lname = obj_name;
}
else
{
holder = holder.substr (pos + 1);
ev_lname = holder.c_str ();
}
os_ << be_uidt_nl << be_nl
<< "public:" << be_idt_nl;
os_ << "// Servant class for the " << port_name
<< " consumer." << be_nl
<< "class " << export_macro_.c_str () << " " << ev_lname
<< "Consumer_" << port_name << "_Servant" << be_idt_nl
<< ": public virtual ::POA_" << obj_name << "Consumer"
<< be_uidt_nl
<< "{" << be_nl
<< "public:" << be_idt_nl;
ACE_CString sname_str (
ScopeAsDecl (node_->defined_in ())->full_name ());
const char *sname = sname_str.c_str ();
const char *lname = node_->local_name ();
const char *global = (sname_str == "" ? "" : "::");
os_ << ev_lname << "Consumer_" << port_name
<< "_Servant (" << be_idt_nl
<< global << sname << "::CCM_" << lname
<< "_ptr executor," << be_nl
<< global << sname << "::CCM_" << lname
<< "_Context_ptr c);" << be_uidt_nl << be_nl;
os_ << "virtual ~" << ev_lname << "Consumer_" << port_name
<< "_Servant (void);";
os_ << be_nl_2
<< "virtual void" << be_nl
<< "push_" << ev_lname << " (" << be_idt_nl
<< "::" << obj_name << " * evt);" << be_uidt;
os_ << be_nl_2
<< "/// Inherited from ::Components::EventConsumerBase." << be_nl
<< "virtual void" << be_nl
<< "push_event ( ::Components::EventBase * ev);";
os_ << be_nl_2
<< "/// Get component implementation." << be_nl
<< "virtual ::CORBA::Object_ptr" << be_nl
<< "_get_component (void);";
os_ << be_uidt_nl << be_nl
<< "protected:" << be_idt_nl;
os_ << global << sname << "::CCM_" << lname << "_var" << be_nl
<< "executor_;";
os_ << be_nl_2
<< global << sname << "::CCM_"
<< lname << "_Context_var" << be_nl
<< "ctx_;";
os_ << be_uidt_nl
<< "};";
if (!be_global->gen_lwccm ())
{
os_ << be_nl_2
<< "virtual ::" << obj_name << "Consumer_ptr" << be_nl
<< "get_consumer_" << port_name << " (void);";
}
os_ << be_uidt_nl << be_nl
<< "private:" << be_idt_nl;
os_ << "void" << be_nl
<< "setup_consumer_" << port_name << "_i (void);";
os_ << be_uidt_nl << be_nl
<< "private:" << be_idt_nl;
os_ << "::" << obj_name << "Consumer_var" << be_nl
<< "consumes_" << port_name << "_;";
}
return 0;
}
示例9: path
void
Obj_Module::add_source(const char *p, int imports_only)
{
ACE_Process nmproc;
ACE_Process_Options nm_opts;
ACE_CString path (p);
ACE_CString::size_type pathsep = path.rfind('/');
ACE_CString src_name;
ACE_CString workpath;
if (pathsep == ACE_CString::npos) {
src_name = path;
workpath = ".";
} else {
src_name = path.substr(pathsep+1);
workpath= path.substr(0,pathsep);
}
ACE_HANDLE pipe[2];
ACE_Pipe io(pipe);
nm_opts.working_directory (workpath.c_str());
nm_opts.set_handles (ACE_STDIN,pipe[1]);
// Options for the command line shown here are for the GNU nm 2.9.5
int result = nm_opts.command_line ("nm -C %s",src_name.c_str());
// Prevent compiler warning about "unused variable" if ACE_ASSERT is
// an empty macro.
ACE_UNUSED_ARG (result);
ACE_ASSERT (result == 0);
nmproc.spawn (nm_opts);
if (ACE_OS::close(pipe[1]) == -1)
ACE_DEBUG ((LM_DEBUG, "%p\n", "close"));
nm_opts.release_handles();
int import_lines = 0;
int export_lines = 0;
ACE_Message_Block im_buffer (102400);
ACE_Message_Block ex_buffer (102400);
ACE_Message_Block *im_buf_cur = &im_buffer;
ACE_Message_Block *ex_buf_cur = &ex_buffer;
char dummy;
int eoln = 1;
// ACE_Time_Value timeout (1,0);
int is_import = 1;
int is_export = 1;
while (eoln == 1) {
for (int i = 0; i < 10; i++) {
if (ACE_OS::read(pipe[0],&dummy,1) != 1) {
eoln = 2;
break;
}
}
if (eoln == 2)
break;
is_import = dummy == 'U';
is_export = !imports_only && (ACE_OS::strchr("BCDRTVW",dummy) != 0);
// if (ACE::recv(pipe[0],&dummy,1,&timeout) != 1)
if (ACE_OS::read(pipe[0],&dummy,1) != 1)
break;
eoln = this->read_line (pipe[0], is_import ? &im_buf_cur :
(is_export ? &ex_buf_cur : 0));
import_lines += is_import;
export_lines += is_export;
}
// ACE_DEBUG ((LM_DEBUG, "read %d import lines and %d export lines\n",
// import_lines, export_lines));
nmproc.wait ();
ACE_OS::close (pipe[0]);
this->populate_sig_list (imports_,import_lines,&im_buffer);
if (!imports_only)
this->populate_sig_list (exports_,export_lines,&ex_buffer);
}
示例10: comp_sname_str
int
be_visitor_servant_svs::visit_consumes (be_consumes *node)
{
AST_Type *obj = node->consumes_type ();
const char *port_name = node->local_name ()->get_string ();
const char *comp_lname = node_->local_name ();
ACE_CString comp_sname_str (
ScopeAsDecl (node_->defined_in ())->full_name ());
const char *comp_sname = comp_sname_str.c_str ();
const char *global = (comp_sname_str == "" ? "" : "::");
const char *lname = obj->local_name ()->get_string ();
const char *fname = obj->full_name ();
os_ << be_nl_2
<< comp_lname << "_Servant::" << lname << "Consumer_"
<< port_name << "_Servant::" << lname << "Consumer_"
<< port_name << "_Servant (" << be_idt << be_idt_nl
<< global << comp_sname << "::CCM_" << comp_lname
<< "_ptr executor," << be_nl
<< global << comp_sname << "::CCM_" << comp_lname
<< "_Context_ptr c)" << be_uidt_nl
<< ": executor_ ( " << global << comp_sname << "::CCM_"
<< comp_lname << "::_duplicate (executor))," << be_idt_nl
<< "ctx_ ( " << global << comp_sname
<< "::CCM_" << comp_lname
<< "_Context::_duplicate (c))" << be_uidt << be_uidt_nl
<< "{" << be_nl
<< "}";
os_ << be_nl_2
<< comp_lname << "_Servant::" << lname << "Consumer_"
<< port_name << "_Servant::~" << lname << "Consumer_"
<< port_name << "_Servant (void)" << be_nl
<< "{" << be_nl
<< "}";
os_ << be_nl_2
<< "::CORBA::Object_ptr" << be_nl
<< comp_lname << "_Servant::" << lname << "Consumer_"
<< port_name << "_Servant::_get_component (void)" << be_nl
<< "{" << be_idt_nl;
if (ACE_OS::strcmp (be_global->ciao_container_type (), "Session") == 0)
{
os_ << "return this->ctx_->get_CCM_object ();";
}
else
{
os_ << "return ::CORBA::Object::_nil ();";
}
os_ << be_uidt_nl << "}";
os_ << be_nl_2
<< "void" << be_nl
<< comp_lname << "_Servant::" << lname << "Consumer_"
<< port_name << "_Servant::push_" << lname
<< " (" << be_idt_nl
<< "::" << fname << " * evt)" << be_uidt_nl
<< "{" << be_idt_nl
<< "this->executor_->push_" << port_name
<< " (evt);" << be_uidt_nl
<< "}";
os_ << be_nl_2
<< "/// Inherited from ::Components::EventConsumerBase."
<< be_nl
<< "void" << be_nl
<< comp_lname << "_Servant::" << lname << "Consumer_"
<< port_name << "_Servant::push_event (" << be_idt_nl
<< "::Components::EventBase * ev)" << be_uidt_nl
<< "{" << be_idt_nl
<< "::" << fname << " * ev_type =" << be_idt_nl
<< "::" << fname << "::_downcast (ev);"
<< be_uidt_nl << be_nl
<< "if (ev_type != 0)" << be_idt_nl
<< "{" << be_idt_nl
<< "this->push_" << lname << " (ev_type);" << be_nl
<< "return;" << be_uidt_nl
<< "}" << be_uidt_nl << be_nl
<< "throw ::Components::BadEventType ();" << be_uidt_nl
<< "}";
if (!be_global->gen_lwccm ())
{
os_ << be_nl_2
<< "::" << fname << "Consumer_ptr" << be_nl
<< node_->local_name () << "_Servant::get_consumer_"
<< port_name << " (void)" << be_nl
<< "{" << be_idt_nl
<< "return" << be_idt_nl
<< "::" << fname << "Consumer::_duplicate (" << be_idt_nl
<< "this->consumes_" << port_name << "_.in ());"
<< be_uidt << be_uidt << be_uidt_nl
<< "}";
}
os_ << be_nl_2
//.........这里部分代码省略.........
示例11: prefix
int
be_visitor_servant_svs::visit_uses (be_uses *node)
{
if (node->uses_type ()->is_local () || be_global->gen_lwccm ())
{
return 0;
}
ACE_CString prefix (this->ctx_->port_prefix ());
prefix += node->local_name ()->get_string ();
const char *port_name = prefix.c_str ();
const char *obj_name = node->uses_type ()->full_name ();
bool const is_multiple = node->is_multiple ();
os_ << be_nl_2
<< (is_multiple ? "::Components::Cookie *" : "void")
<< be_nl
<< node_->local_name () << "_Servant::connect_"
<< port_name << " (" << be_idt_nl
<< "::" << obj_name << "_ptr c)" << be_uidt_nl
<< "{" << be_idt_nl;
if (is_multiple)
{
os_ << "return ";
}
os_ << "this->context_->connect_" << port_name
<< " (c);" << be_uidt_nl
<< "}";
os_ << be_nl_2
<< "::" << obj_name << "_ptr" << be_nl
<< node_->local_name () << "_Servant::disconnect_"
<< port_name << " (";
if (is_multiple)
{
os_ << be_idt_nl
<< "::Components::Cookie * ck" << be_uidt;
}
else
{
os_ << "void";
}
os_ << ")" << be_nl
<< "{" << be_idt_nl
<< "return this->context_->disconnect_"
<< port_name << " (" << (is_multiple ? "ck" : "")
<< ");" << be_uidt_nl
<< "}";
os_ << be_nl_2
<< "::";
if (is_multiple)
{
os_ << node_->full_name () << "::" << port_name
<< "Connections *";
}
else
{
os_ << obj_name << "_ptr";
}
os_ << be_nl
<< node_->local_name () << "_Servant::get_connection"
<< (is_multiple ? "s" : "") << "_"
<< port_name << " (void)" << be_nl
<< "{" << be_idt_nl
<< "return this->context_->get_connection"
<< (is_multiple ? "s" : "") << "_"
<< port_name << " ();" << be_uidt_nl
<< "}";
return 0;
}
示例12: ACE_TMAIN
int
ACE_TMAIN(int argc, ACE_TCHAR* argv[]){
u_long priority_mask =
ACE_LOG_MSG->priority_mask (ACE_Log_Msg::PROCESS);
ACE_CLR_BITS (priority_mask,
LM_DEBUG|LM_TRACE);
ACE_LOG_MSG->priority_mask (priority_mask,
ACE_Log_Msg::PROCESS);
ACE_CString* e = new ACE_CString("1000100000000000");
bn* _pq = new bn(0x10);/*
*/
_pq->addat(0, 0x3021802f);
_pq->addat(1, 0x4c5faba9);
_pq->addat(2, 0x18f820dc);
_pq->addat(3, 0xc8a28aab);
_pq->addat(4, 0x02de8542);
_pq->addat(5, 0x8e301566);
_pq->addat(6, 0xce281be5);
_pq->addat(7, 0x346b2199);
_pq->addat(8, 0xd8335836);
_pq->addat(9, 0x59cebc36);
_pq->addat(10, 0x4b768f8d);
_pq->addat(11, 0xda316c22);
_pq->addat(12, 0xd6c0f9f4);
_pq->addat(13, 0xc46b3a0e);
_pq->addat(14, 0x045015c0);
_pq->addat(15, 0xbf78c2f6);
// _pq->subat(0,0x1);
bn* _e = from_hex(e);
bn* _d = new bn(0x10);
_d->addat(0, 0xf4e5789b);
_d->addat(1, 0x27c688d4);
_d->addat(2, 0x40cb88fd);
_d->addat(3, 0xe8c4c59d);
_d->addat(4, 0x6b611a0e);
_d->addat(5, 0x4493cfe9);
_d->addat(6, 0x6a4d2e51);
_d->addat(7, 0x58e231d1);
_d->addat(8, 0xafefffe3);
_d->addat(9, 0xae1d348b);
_d->addat(10, 0x8d147a03);
_d->addat(11, 0xddd6a6c5);
_d->addat(12, 0x95749cf1);
_d->addat(13, 0x5790ba88);
_d->addat(14, 0x327997a7);
_d->addat(15, 0x8f07aed1);
bn* _jg = new bn(0xa);
_jg->addat(0, 0xa3e6f7bb);
_jg->addat(1, 0xb4594256);
_jg->addat(2, 0x059555cf);
_jg->addat(3, 0x503806c8);
_jg->addat(4, 0x1d775b9f);
_jg->addat(5, 0x0667d89e);
_jg->addat(6, 0x52ff1ca5);
_jg->addat(7, 0x37cd8aa6);
_jg->addat(8, 0xf92ec894);
_jg->addat(9, 0x674e57d3);
_jg->addat(10, 0x1e8516);
bn* tmp = new bn(1);
tmp->addat(0,0x12345678);
bn* _ed = mul(_e, _d);
bn* _fv = mul(_ed, _jg);
// bn* v = (tmp, _fv, _pq);
ACE_CString* str = v->to_hex();
ACE_DEBUG((LM_INFO,
"%s\n", str->c_str()));
delete str;
delete v;
delete _ed;
delete _pq;
delete _e;
delete _d;
delete tmp;
// delete pq;
delete e;
// delete d;
delete _jg;
delete _fv;
}
示例13: ACE_TMAIN
int
ACE_TMAIN(int argc, ACE_TCHAR *argv[])
{
int status = 0;
bool set_cert_file = true;
try
{
// This has to be done before calling CORBA::ORB_init() and
// parse_args() has to be called after CORBA::ORB_init(), so we
// will look at argv manually.
for(int i = 0; i < argc; i++)
{
if (ACE_OS::strcmp(argv[i], ACE_TEXT("-n")) == 0)
{
set_cert_file = false;
break;
}
}
ACE_CString env ("SSL_CERT_FILE=");
env += cert_file;
if (set_cert_file)
{
ACE_OS::putenv (env.c_str ());
}
CORBA::ORB_var orb =
CORBA::ORB_init (argc, argv);
if (parse_args (argc, argv) != 0)
return 1;
CORBA::Object_var object =
orb->string_to_object (ior);
if (set_cert_file)
{
// This test sets creates a Security::QOPPolicy with the
// Quality-of-Protection set to "no protection." It then
// invokes a method on the server (insecurely), which should
// then result in a CORBA::NO_PERMISSION exception.
//
// The server is not shutdown by this test.
status = insecure_invocation_test (orb.in (), object.in ());
ACE_DEBUG ((LM_DEBUG,
"insecure_invocation_test returned <%d>\n",
status));
}
// This test uses the default secure SSLIOP settings to securely
// invoke a method on the server. No exception should occur.
//
// The server *is* shutdown by this test.
try
{
status = secure_invocation_test (object.in ());
ACE_DEBUG ((LM_DEBUG,
"secure_invocation_test returned <%d>\n",
status));
}
catch (const CORBA::Exception &ex)
{
if (set_cert_file)
{
ex._tao_print_exception ("Caught unexpected exception "
"(probable failure):");
status = 1;
}
else
{
ACE_DEBUG ((LM_DEBUG,
"Caught an exception as expected due "
"to the SSL_CERT_FILE environment "
"variable not being set.\n"));
}
}
orb->destroy ();
}
catch (const CORBA::Exception& ex)
{
ex._tao_print_exception ("Exception in main:");
return 1;
}
if (status == 0)
{
ACE_DEBUG ((LM_DEBUG,
"\n"
"Bug_1107_Regression test passed.\n"));
}
return status;
}
示例14: launch_plan
int
launch_plan (const Options &opts,
DAnCE::Plan_Launcher_Base *pl_base,
const ::Deployment::DeploymentPlan *plan,
CORBA::ORB_ptr orb)
{
DANCE_TRACE ("launch_plan");
try
{
CORBA::Object_var app_mgr, app;
CORBA::String_var
uuid_safe (pl_base->launch_plan (*plan, app_mgr.out () , app.out ()));
ACE_CString uuid = uuid_safe.in ();
DANCE_DEBUG (DANCE_LOG_MAJOR_EVENT,
(LM_NOTICE, DLINFO
ACE_TEXT ("Plan_Launcher::launch_plan - ")
ACE_TEXT ("Successfully deployed plan ")
ACE_TEXT ("with UUID: <%C>\n"),
uuid.c_str ()));
if (!opts.output_)
return 0;
ACE_TString am_output, app_output;
if (opts.output_prefix_)
am_output = app_output = opts.output_prefix_;
else
am_output = app_output = ACE_TEXT_CHAR_TO_TCHAR (uuid.c_str ());
am_output += ACE_TEXT ("_AM.ior");
app_output += ACE_TEXT ("_APP.ior");
DANCE_DEBUG (DANCE_LOG_MINOR_EVENT,
(LM_DEBUG, DLINFO
ACE_TEXT ("Plan_Launcher::launch_plan - ")
ACE_TEXT ("Writing Application Manager IOR to <%s>\n"),
am_output.c_str ()));
CORBA::String_var tmp = orb->object_to_string (app_mgr.in ());
write_IOR (am_output.c_str (),
tmp.in ());
DANCE_DEBUG (DANCE_LOG_MINOR_EVENT,
(LM_DEBUG, DLINFO
ACE_TEXT ("Plan_Launcher::launch_plan - ")
ACE_TEXT ("Writing Application IOR to <%s>\n"),
am_output.c_str ()));
tmp = orb->object_to_string (app.in ());
write_IOR (app_output.c_str (),
tmp.in ());
}
catch (const DAnCE::Deployment_Failure &ex)
{
if (!opts.quiet_)
{
DANCE_ERROR (DANCE_LOG_EMERGENCY,
(LM_ERROR, DLINFO ACE_TEXT ("Plan_Launcher::launch_plan - ")
ACE_TEXT ("Deployment failed, exception: %C\n"),
ex.ex_.c_str ()));
}
return 1;
}
catch (const Deployment::PlanError &ex)
{
if (!opts.quiet_)
{
DANCE_ERROR (DANCE_LOG_EMERGENCY,
(LM_ERROR, DLINFO ACE_TEXT ("Plan_Launcher::launch_plan - ")
ACE_TEXT ("Caught PlanError exception: %C, %C\n"),
ex.name.in (),
ex.reason.in ()
));
}
return 1;
}
catch (const Deployment::StartError &ex)
{
if (!opts.quiet_)
{
DANCE_ERROR (DANCE_LOG_EMERGENCY,
(LM_ERROR, DLINFO ACE_TEXT ("Plan_Launcher::launch_plan - ")
ACE_TEXT ("Caught PlanError exception: %C, %C\n"),
ex.name.in (),
ex.reason.in ()
));
}
return 1;
}
catch (const Deployment::StopError &ex)
{
if (!opts.quiet_)
{
DANCE_ERROR (DANCE_LOG_EMERGENCY,
(LM_ERROR, DLINFO ACE_TEXT ("Plan_Launcher::launch_plan - ")
//.........这里部分代码省略.........
示例15: teardown_plan
int
teardown_plan (const Options &opts,
DAnCE::Plan_Launcher_Base *pl_base,
const ::Deployment::DeploymentPlan *plan,
CORBA::ORB_ptr orb)
{
DANCE_TRACE ("teardown_plan");
int rc = 0;
try
{
CORBA::Object_var am;
CORBA::Object_var app;
if (opts.am_ior_ && opts.app_ior_)
{
DANCE_DEBUG (DANCE_LOG_MAJOR_EVENT,
(LM_DEBUG, DLINFO
ACE_TEXT ("Plan_Launcher::teardown_plan - ")
ACE_TEXT ("Tearing down plan with explicitly ")
ACE_TEXT ("nominated App and AM IORs.\n")));
am = orb->string_to_object (opts.am_ior_);
app = orb->string_to_object (opts.app_ior_);
}
else
{
// Need to perform lookup by uuid,
// either explicitly provided or in plan.
ACE_CString uuid;
if (plan)
uuid = plan->UUID.in ();
else
uuid = ACE_TEXT_ALWAYS_CHAR (opts.uuid_);
DAnCE::EM_Launcher *em_launcher =
dynamic_cast <DAnCE::EM_Launcher *> (pl_base);
if (!em_launcher)
{
DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR,
(LM_ERROR, DLINFO
ACE_TEXT ("Plan_Launcher::teardown_plan - ")
ACE_TEXT ("Error: Attempting UUID lookup on non")
ACE_TEXT ("-EM managed plan not supported\n")));
return 1;
}
if (em_launcher->lookup_by_uuid (uuid.c_str (),
am.out (),
app.out ()))
{
DANCE_DEBUG (DANCE_LOG_MAJOR_EVENT,
(LM_DEBUG, DLINFO
ACE_TEXT ("Plan_Launcher::teardown_plan - ")
ACE_TEXT ("Tearing down plan with UUID %C\n"),
uuid.c_str ()));
}
else
{
DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR,
(LM_ERROR, DLINFO
ACE_TEXT ("Plan_Launcher::teardown_plan - ")
ACE_TEXT ("Error: Lookup by UUID failed\n")));
return 1;
}
}
try
{
pl_base->teardown_application (am, app);
}
catch (const DAnCE::Deployment_Failure &ex)
{
if (!opts.quiet_)
{
DANCE_ERROR (DANCE_LOG_EMERGENCY, (LM_ERROR, DLINFO
ACE_TEXT ("Plan_Launcher::teardown_plan - ")
ACE_TEXT ("Application Teardown failed, exception: %C\n"),
ex.ex_.c_str ()));
}
rc = 1;
}
catch (const CORBA::Exception &ex)
{
if (!opts.quiet_)
{
DANCE_ERROR (DANCE_LOG_EMERGENCY, (LM_ERROR, DLINFO
ACE_TEXT ("Plan_Launcher::teardown_plan - ")
ACE_TEXT ("Application Teardown failed, ")
ACE_TEXT ("caught CORBA exception %C\n"),
ex._info ().c_str ()));
}
rc = 1;
}
catch (...)
{
if (!opts.quiet_)
{
DANCE_ERROR (DANCE_LOG_EMERGENCY, (LM_ERROR, DLINFO
ACE_TEXT ("Plan_Launcher::teardown_plan - ")
ACE_TEXT ("Application Teardown failed, ")
//.........这里部分代码省略.........