FILE * FE_Utils::open_included_file (char const * filename, char const *& directory) { FILE * f = 0; ACE_CString const the_file (ACE_CString ('/') + ACE_CString (filename)); for (IDL_GlobalData::Unbounded_Paths_Queue_Iterator i ( idl_global->include_paths ()); !i.done () && f == 0; i.advance ()) { IDL_GlobalData::Include_Path_Info *path_info = 0; (void) i.next (path_info); if (path_info->path_ != 0) { ACE_CString const complete_filename (ACE_CString (path_info->path_) + the_file); f = ACE_OS::fopen (complete_filename.c_str (), "r"); if (f != 0) directory = path_info->path_; } } return f; }
ActorStrt(const DActor& actor, PersistenceUpdater::ALLOCATOR* allocator) : domainId(actor.domainId), actorId(actor.actorId), topicId(actor.topicId), participantId(actor.participantId), type(actor.type) { assign(callback, actor.callback.c_str(), allocator); pubsubQos.first = actor.pubsubQos.first; assign(pubsubQos.second, actor.pubsubQos.second, allocator); drdwQos.first = actor.drdwQos.first; assign(drdwQos.second, actor.drdwQos.second, allocator); assign(transportInterfaceInfo, actor.transportInterfaceInfo, allocator); contentSubscriptionProfile.filterClassName = ACE_CString(actor.contentSubscriptionProfile.filterClassName.c_str(), allocator); contentSubscriptionProfile.filterExpr = ACE_CString(actor.contentSubscriptionProfile.filterExpr.c_str(), allocator); assign(contentSubscriptionProfile.exprParams, actor.contentSubscriptionProfile.exprParams, allocator); }
template <ACE_PEER_STREAM_1, class COUNTER, ACE_SYNCH_DECL, class LMR> int ACE_Server_Logging_Handler_T<ACE_PEER_STREAM_2, COUNTER, ACE_SYNCH_USE, LMR>::open_common (void) { // Shut off non-blocking IO if it was enabled... if (this->peer ().disable (ACE_NONBLOCK) == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "disable"), -1); ACE_PEER_STREAM_ADDR client_addr; // Determine the address of the client and display it. if (this->peer ().get_remote_addr (client_addr) == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "get_remote_addr"), -1); #if !defined (ACE_HAS_BROKEN_HPUX_TEMPLATES) && !defined (__GNUG__) this->receiver_.m_ = ACE_CString (client_addr.get_host_name ()); #else this->host_name_ = ACE_CString (client_addr.get_host_name ()); #endif /* ! ACE_HAS_BROKEN_HPUX_TEMPLATES && ! __GNUG__ */ ACE_DEBUG ((LM_DEBUG, "(%t) accepted connection from host %s on fd %d\n", client_addr.get_host_name (), this->peer ().get_handle ())); return 0; }
TAO_BEGIN_VERSIONED_NAMESPACE_DECL TAO_Log_Constraint_Visitor::TAO_Log_Constraint_Visitor (const DsLogAdmin::LogRecord &rec) : property_lookup_ (property_lookup_size_) { CORBA::Any val_id; val_id <<= static_cast<ACE_UINT32> (rec.id); this->property_lookup_.bind (ACE_CString("id", 0, false), val_id); CORBA::Any val_time; val_time <<= static_cast<ACE_UINT32> (rec.time); this->property_lookup_.bind (ACE_CString ("time", 0, false), val_time); this->property_lookup_.bind (ACE_CString ("info", 0, false), rec.info); // Bind an entry for each item in the record's attribute list. CORBA::Long len = rec.attr_list.length (); for (CORBA::Long i = 0; i < len; ++i) { this->property_lookup_.bind (ACE_CString (rec.attr_list[i].name, 0, false), rec.attr_list[i].value); } }
ACE_CString ACSServiceController::getServiceName() { if (desc->getName()) { return ACE_CString("'") + desc->getACSServiceName() + "' with name '" + desc->getName() + "'"; } else { return ACE_CString("'") + desc->getACSServiceName() + "'"; } }
int ACE_TMAIN(int argc, ACE_TCHAR* argv[]){ /* ACE_LOG_MSG->set_flags (ACE_Log_Msg::OSTREAM); ACE_LOG_MSG->clr_flags (ACE_Log_Msg::STDERR); */ /* bn* a = new bn(3); a->addat(2,1); a->subat(0,1); a->print(); bn* b = NULL; for(int i=1 ; i< 100; i++){ ACE_DEBUG((LM_DEBUG, "-----%d\n", i)); b = a->rightpush(); b->print(); delete a; a = b; } delete b; bn* a, *b,*c; a = new bn(1); a->addat(0,1); b = new bn(2); b->addat(0,0xffffffffffffffff); b->addat(1,0x7fffffffffffffff); c = add(a,b); c->print(); delete a; delete b; delete c; return 0; */ /* p is d0bcc8024fefcb29$$90f175728db803ee$$b0d43aa25e06dcad$$421cffe943b64f56$$d79c5cd16064ee84$$726f7ed87d68574$$b21a83413d91e62b$$aff6bd3613fa217b$$4895394c5d1710e5$$19438fe7046f80bc$$d665488bdd013fb5$$d3f42a6bb5f7b3c3$$48d6e399065c0630$$7027886933c53771$$dca309be76c46df8$$d100c0cbb7a6bc84$$ ..................................................................+++ */ ACE_CString ps("d0bcc8024fefcb29$$90f175728db803ee$$b0d43aa25e06dcad$$421cffe943b64f56$$d79c5cd16064ee84$$726f7ed87d68574$$b21a83413d91e62b$$aff6bd3613fa217b$$4895394c5d1710e5$$19438fe7046f80bc$$d665488bdd013fb5$$d3f42a6bb5f7b3c3$$48d6e399065c0630$$7027886933c53771$$dca309be76c46df8$$d100c0cbb7a6bc84$$"); bn* p = new bn(16); parse(ps,ACE_CString("$$"), p); p->print(); ACE_CString qs("74f9224de5fc4137$$22609a9741c44ccc$$1a5f6dccce29d54b$$c6fe6b1d3de6ba36$$96d19ffed6c0431c$$95e0c985e32cebd8$$fd8cc0b803ba19b6$$cceb9042b44b89cc$$25943c8bd23a8053$$59332cd399544397$$600360a8cd193b6d$$b952f0d370c0a95c$$9947923340d4d7ca$$46acced9d9a46360$$2b9d6476d510031e$$dfaf80e46338b482$$"); bn* q = new bn(16); parse(qs, ACE_CString("$$"), q); q->print(); bn* r = mul(p,q); r->print(); return 0; }
ACE_CString ErrorTraceHelper::getData (const char* name) { if (name==NULL) return ACE_CString(); int i=0, length = m_current->data.length(); while (i<length && ACE_OS::strcmp(name, m_current->data[i].name) != 0) i++; if (i<length) // have we reached the end ? return ACE_CString( m_current->data[i].value); else return ACE_CString(); }//getData
void Obj_Module::populate_sig_list (Sig_List &siglist, int lines, ACE_Message_Block *buf) { char *c; ACE_CString temp; for (int i = 0; i < lines; i++) { for (c = buf->rd_ptr (); c != buf->wr_ptr () && *c != '\n'; ++c) { // No action. } temp += ACE_CString (buf->rd_ptr (), (c - buf->rd_ptr ())); buf->rd_ptr (c + 1); if (*c == '\n') { // ACE_DEBUG ((LM_DEBUG, "%s\n",temp.c_str())); siglist.add (temp); temp.clear (); } else { buf = buf->cont (); if (buf == 0) { siglist.add (temp); } } } }
be_operation * be_visitor_amh_pre_proc::generate_get_operation (be_attribute *node) { ACE_CString original_op_name ( node->name ()->last_component ()->get_string () ); ACE_CString new_op_name = ACE_CString ("get_") + original_op_name; UTL_ScopedName *get_name = static_cast<UTL_ScopedName *> (node->name ()-> copy ()); get_name->last_component ()->replace_string (new_op_name.c_str ()); be_operation *operation = 0; ACE_NEW_RETURN (operation, be_operation (node->field_type (), AST_Operation::OP_noflags, get_name, 1, 0), 0); operation->set_name (get_name); operation->set_defined_in (node->defined_in ()); return operation; }
ACSServiceController::ACSServiceController(ACSDaemonContext *icontext, ACSServiceRequestDescription *idesc, bool iautostart) : ServiceController(icontext, iautostart), desc(idesc), alarmSystemInitialized(false), alarmService(::alarmsystem::AlarmService::_nil()) { char str[256]; const ACSService *service = &acsServices[idesc->getACSService()]; std::string port = service->svcport == NULL ? service->namedsvcport(idesc->getInstanceNumber(), idesc->getName()) : service->svcport(idesc->getInstanceNumber()); const char * cname = idesc->getCorbalocName() == NULL ? idesc->getName() : idesc->getCorbalocName(); snprintf(str, 256, service->svccorbaurl, ACSPorts::getIP(), port.c_str(), cname == NULL ? "" : cname); corbaloc = ACE_CString(str); }
ACE_Server_Logging_Handler_T<ACE_PEER_STREAM_2, COUNTER, ACE_SYNCH_USE, LMR>::ACE_Server_Logging_Handler_T (ACE_Thread_Manager *, LMR const &receiver) // Initialize the CString to something that is not the empty string // to avoid problems when calling fast_rep() #if !defined (ACE_HAS_BROKEN_HPUX_TEMPLATES) && !defined (__GNUG__) : receiver_ (receiver, ACE_CString (" ", 1)) #else : receiver_ (receiver),
int Activator_Options::init (int argc, ACE_TCHAR *argv[]) { // Make an initial pass through and grab the arguments that we recognize. // This may also run the commands to install or remove the nt service. int result = this->parse_args (argc, argv); if (result != 0) { return result; } for (int i = 0; i < argc; ++i) { this->cmdline_ += ACE_CString (ACE_TEXT_ALWAYS_CHAR(argv[i])) + ACE_CString (" "); } return 0; }
// // visit_eventtype // int Upcall_Event::visit_eventtype (AST_EventType * node) { if (!be_global->is_wrapper_eventtype (node)) return 0; const char * local_name = node->local_name ()->get_string (); const char * full_name = node->full_name (); this->upcall_event_ = ACE_CString (local_name) + "Upcall"; ACE_CString dds_event; be_global->get_wrapper_eventtype (node, dds_event); this->hfile_ << "class "; if (!be_global->stub_export_macro_.empty ()) this->hfile_ << be_global->stub_export_macro_ << " "; this->hfile_ << this->upcall_event_ << " :" << std::endl << " public virtual " << local_name << "," << std::endl << " public virtual ::CORBA::DefaultValueRefCountBase" << std::endl << "{" << "public:" << std::endl << this->upcall_event_ << " (" << dds_event << " & dds_event);" << "virtual ~" << this->upcall_event_ << " (void);" << std::endl; this->sfile_ << this->upcall_event_ << "::" << this->upcall_event_ << " (" << dds_event << " & dds_event)" << std::endl << ": dds_event_ (dds_event)" << "{" << "}" << this->upcall_event_ << "::~" << this->upcall_event_ << " (void)" << "{" << "}"; this->visit_scope (node); this->hfile_ << "private:" << std::endl << dds_event << " & dds_event_;" << std::endl << "::CORBA::Boolean _tao_marshal__" << this->marshal_scope_ << local_name << " (TAO_OutputCDR &, TAO_ChunkInfo &) const;" << "::CORBA::Boolean _tao_unmarshal__" << this->marshal_scope_ << local_name << " (TAO_InputCDR &, TAO_ChunkInfo &);" << "};"; this->sfile_ << "::CORBA::Boolean " << this->upcall_event_ << "::_tao_marshal__" << this->marshal_scope_ << local_name << " (TAO_OutputCDR &, TAO_ChunkInfo &) const{return false;}" << "::CORBA::Boolean " << this->upcall_event_ << "::_tao_unmarshal__" << this->marshal_scope_ << local_name << " (TAO_InputCDR &, TAO_ChunkInfo &){return false;}"; return 0; }
void createPOAs(ACE_CString &base) { PortableServer::LifespanPolicy_var life = root_poa->create_lifespan_policy(PortableServer::PERSISTENT); PortableServer::IdAssignmentPolicy_var assign = root_poa->create_id_assignment_policy(PortableServer::USER_ID); CORBA::PolicyList pols; pols.length(2); pols[0] = PortableServer::LifespanPolicy::_duplicate(life.in()); pols[1] = PortableServer::IdAssignmentPolicy::_duplicate(assign.in()); PortableServer::POAManager_var mgr = PortableServer::POAManager::_nil(); ACE_CString poa_name = base + ACE_CString ("_a"); poa_a = root_poa->create_POA(poa_name.c_str(), mgr.in(), pols); poa_name = base + ACE_CString ("_b"); poa_b = root_poa->create_POA(poa_name.c_str(), mgr.in(), pols); }
ACE_CString TAO_Notify_POA_Helper::get_unique_id (void) { /// Factory for generating unique ids for the POAs. static TAO_Notify_ID_Factory poa_id_factory; char buf[32]; ACE_OS::itoa (poa_id_factory.id (), buf, 10); return ACE_CString (buf); }
virtual int call (void) { ACE_TRACE ("LongWork::call"); ACE_DEBUG ((LM_INFO, ACE_TEXT ("(%t) Attempting long work task\n"))); ACE_OS::sleep (1); char buf[1024]; ACE_OS::strcpy (buf, "Completed assigned task\n"); ACE_CString *msg; ACE_NEW_RETURN (msg, ACE_CString (buf, ACE_OS::strlen (buf) + 1), -1); result_.set (msg); return 0; }
ACE_CString TAO_Object_Adapter::poa_name_iterator::operator* () const { CORBA::ULong start_at = this->last_separator_ + TAO_Root_POA::name_separator_length (); CORBA::ULong how_many = this->position_ - this->last_separator_ - TAO_Root_POA::name_separator_length (); return ACE_CString (reinterpret_cast <const char *> (&this->folded_buffer_[start_at]), how_many); }
// // parse_args // int System_Probe_Daemon::parse_args (int argc, char * argv []) { const char * optstr = "c:h"; ACE_Get_Opt get_opt (argc, argv, optstr); get_opt.long_option ("config", 'c', ACE_Get_Opt::ARG_REQUIRED); get_opt.long_option ("help", 'h', ACE_Get_Opt::NO_ARG); get_opt.long_option ("debug", ACE_Get_Opt::NO_ARG); get_opt.long_option ("hertz", ACE_Get_Opt::ARG_REQUIRED); get_opt.long_option ("disable", ACE_Get_Opt::ARG_REQUIRED); get_opt.long_option ("dump", ACE_Get_Opt::ARG_REQUIRED); // Parse the remaining command-line arguments int opt = 0; while ((opt = get_opt ()) != EOF) { switch (opt) { case 0: if (0 == ACE_OS::strcmp ("help", get_opt.long_option ())) this->print_help (); else if (0 == ACE_OS::strcmp ("debug", get_opt.long_option ())) this->enable_log_level (LM_DEBUG); else if (0 == ACE_OS::strcmp ("hertz", get_opt.long_option ())) this->hertz_ = ACE_CString ("--hertz=") + get_opt.opt_arg (); else if (0 == ACE_OS::strcmp ("disable", get_opt.long_option ())) this->disabled_ = get_opt.opt_arg (); else if (0 == ACE_OS::strcmp ("config", get_opt.long_option ())) this->config_file_ = get_opt.opt_arg (); else if (0 == ACE_OS::strcmp ("dump", get_opt.long_option ())) this->dump_ = get_opt.opt_arg (); break; case 'h': this->print_help (); break; case 'c': this->config_file_ = get_opt.opt_arg (); break; } } return 0; }
void Log::get_timestamp (void) { const char *time_tok = ACE_OS::strchr (this->line_,'@'); size_t len = (size_t)(time_tok - this->line_); if (time_tok != 0 && len < 30) { this->timestamp_ = ACE_CString (this->line_, len); #if 0 int year, mon, day; int hr, min, sec, msec; ::sscanf (hms+1,"%d-%d-%d %d:%d:%d.%d", &year, &mon, &day, &hr, &min, &sec, &msec); time = (hr * 3600 + min *60 + sec) * 1000 + msec; if (this->time_ > time) time += 24 * 3600 * 1000; #endif } }
void Library::load_modules () { ACE_CString subdir = path_ + "/.shobj"; struct dirent **dent; num_modules_ = ACE_OS::scandir(ACE_TEXT_CHAR_TO_TCHAR (subdir.c_str()), &dent,selector,comparator); if (num_modules_ > 0) { modules_ = new Obj_Module * [num_modules_]; for (int i = 0; i < num_modules_; i++) { ACE_CString ent_name (ACE_TEXT_ALWAYS_CHAR (dent[i]->d_name)); modules_[i] = new Obj_Module(ent_name); modules_[i]->add_source (ACE_CString(subdir + "/" + ent_name).c_str()); ACE_OS::free(dent[i]); }; } if (num_modules_ > -1) ACE_OS::free(dent); }
be_operation * be_visitor_amh_pre_proc::generate_set_operation (be_attribute *node) { ACE_CString original_op_name ( node->name ()->last_component ()->get_string () ); ACE_CString new_op_name = ACE_CString ("set_") + original_op_name; UTL_ScopedName *set_op_name = dynamic_cast<UTL_ScopedName *> (node->name ()-> copy ()); set_op_name->last_component ()->replace_string (new_op_name.c_str ()); // argument type is the same as the attribute type be_argument *arg = 0; ACE_NEW_RETURN (arg, be_argument (AST_Argument::dir_IN, node->field_type (), set_op_name), 0); arg->set_name (dynamic_cast<UTL_ScopedName *> (node->name ()->copy ())); // create the operation be_operation *operation = 0; ACE_NEW_RETURN (operation, be_operation (be_global->void_type (), AST_Operation::OP_noflags, set_op_name, 0, 0), 0); operation->set_name (set_op_name); operation->set_defined_in (node->defined_in ()); operation->be_add_argument (arg); return operation; }
int MCT_Event_Handler::join (const ACE_INET_Addr &mcast_addr, int reuse_addr, const ACE_TCHAR *net_if) { char buf[MAX_STRING_SIZE]; ACE_OS::sprintf (buf, "%s/%d", mcast_addr.get_host_addr (), mcast_addr.get_port_number ()); if (this->mcast_.join (mcast_addr, reuse_addr, net_if) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("MCT_Event_Handler::join %C %p\n"), buf, ACE_TEXT ("failed")), -1); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Joined %C\n"), buf)); ACE_CString *str = 0; ACE_NEW_RETURN (str, ACE_CString (buf), -1); this->address_vec_.push_back (str); return 0; }
int Server_i::run (void) { try { PortableServer::POAManager_var poa_manager = this->root_poa_->the_POAManager (); poa_manager->activate (); // We have potentially lots of IORs, so just write out a simple text // file that the run_test.pl can use to know we're done. { ACE_CString status = this->server_name_ + ACE_CString(".status"); ofstream out(status.c_str()); out << "started" << endl; } ACE_DEBUG ((LM_DEBUG, "\n Started Server %s with %d imr-ified objects.\n\n", this->server_name_.c_str(), this->count_)); this->orb_->run (); this->root_poa_->destroy(1, 1); this->orb_->destroy(); } catch (const CORBA::Exception& ex) { ex._tao_print_exception ("Server_i::run"); throw; } return 0; }
int Config_Backing_Store::persistent_update (const Server_Info_Ptr& info, bool ) { ACE_Configuration_Section_Key key; int err = get_key(this->config_, info->key_name_, SERVERS_ROOT_KEY, key); if (err != 0) { ORBSVCS_ERROR((LM_ERROR, ACE_TEXT ("ERROR: could not get key for %C\n"), info->key_name_.c_str ())); return err; } if (this->opts_.debug() > 9) { ORBSVCS_DEBUG((LM_INFO, ACE_TEXT ("updating %C\n"), info->poa_name.c_str())); } ACE_CString envstr = ImR_Utils::envListToString (info->env_vars); ACE_CString peerstr = ImR_Utils::peerListToString (info->peers); this->config_.set_string_value (key, POA, info->poa_name); this->config_.set_string_value (key, SERVER_ID, info->server_id); this->config_.set_string_value (key, JACORB_SERVER, info->is_jacorb ? "1" : "0"); this->config_.set_string_value (key, ACTIVATOR, info->activator); this->config_.set_string_value (key, STARTUP_COMMAND, info->cmdline); this->config_.set_string_value (key, WORKING_DIR, info->dir); this->config_.set_string_value (key, ENVIRONMENT, envstr); this->config_.set_integer_value (key, ACTIVATION, info->activation_mode_); this->config_.set_integer_value (key, START_LIMIT, info->start_limit_); this->config_.set_string_value (key, PARTIAL_IOR, info->partial_ior); this->config_.set_string_value (key, IOR, info->ior); this->config_.set_integer_value (key, PID, info->pid); this->config_.set_string_value (key, ALTKEY, info->alt_info_.null () ? ACE_CString("") : info->alt_info_->key_name_); this->config_.set_string_value (key, PEERS, peerstr); return 0; }
static int init (void) { char entry[MAX_STRING_SIZE]; ACE_CString *cString_ptr; Element *element_ptr; ACE_NEW_RETURN (linked_list_ptr, Linked_List, -1); for (u_int i = 0; i < n_entries; i++) { ACE_OS::sprintf (entry, "%d", i); ACE_NEW_RETURN (cString_ptr, ACE_CString (entry), -1); ACE_NEW_RETURN (element_ptr, Element (cString_ptr), -1); linked_list_ptr->insert_tail (element_ptr); } return 0; }
static ACE_CString getHostName () { char host_name[MAXHOSTNAMELEN]; ACE_OS::hostname (host_name, MAXHOSTNAMELEN); return ACE_CString (host_name); }
bool STD_CID_Handler::component_impl_descr ( const ComponentImplementationDescription &desc, ::Deployment::ComponentImplementationDescription &toconfig) { toconfig.label = desc.label ().c_str (); toconfig.UUID = desc.UUID ().c_str (); if (desc.assemblyImpl_p ()) { Deployment::ComponentAssemblyDescription idl_cad; ComponentAssemblyDescription cad = desc.assemblyImpl (); // @@: handle <assemblyImpl> for (ComponentAssemblyDescription::instance_const_iterator iter = cad.begin_instance (); iter != cad.end_instance (); iter++) { CORBA::ULong len = idl_cad.instance.length (); idl_cad.instance.length (len + 1); idl_cad.instance [len].name = (*iter).name ().c_str (); // Bind the instance id with the index if ((*iter).id_p ()) { ACE_CString cstr ((*iter).id ().c_str ()); STD_CID_Handler::IDREF.bind_ref (cstr,len); } if (!this->xml_helper_->is_initialized ()) return false; // parse the .cpd (ComponentPackageDescription) file // that <package> links to xercesc::DOMDocument* dom = this->xml_helper_->create_dom (((*iter).package ()).href ().c_str ()); if (!dom) return false; ComponentPackageDescription cpd = componentPackageDescription (dom); Deployment::ComponentPackageDescription idl_cpd; STD_CPD_Handler cpd_handler (this->xml_helper_); cpd_handler.component_package_descr (cpd, idl_cpd); idl_cad.instance [len].package.length (1); idl_cad.instance [len].package [0] = idl_cpd; } // @@: handle <connection> for (ComponentAssemblyDescription::connection_const_iterator conn_iter = cad.begin_connection (); conn_iter != cad.end_connection (); conn_iter++) { CORBA::ULong conn_len = idl_cad.connection.length (); idl_cad.connection.length (conn_len + 1); idl_cad.connection [conn_len].name = (*conn_iter).name ().c_str (); for (AssemblyConnectionDescription::internalEndpoint_const_iterator ep_iter = (*conn_iter).begin_internalEndpoint (); ep_iter != (*conn_iter).end_internalEndpoint (); ep_iter++) { CORBA::ULong endp_len = idl_cad.connection [conn_len].internalEndpoint.length (); idl_cad.connection [conn_len].internalEndpoint.length (endp_len + 1); idl_cad.connection [conn_len].internalEndpoint [endp_len].portName = (*ep_iter).portName ().c_str (); CORBA::ULong tmp = 0; STD_CID_Handler::IDREF.find_ref (ACE_CString ((((*ep_iter).instance ()).id ()).c_str ()), tmp); CORBA::ULong ref = tmp; idl_cad.connection[conn_len].internalEndpoint [endp_len].instanceRef = ref; } } toconfig.assemblyImpl.length (1); toconfig.assemblyImpl [0] = idl_cad; } // handle <monolithicImpl> if (desc.monolithicImpl_p ()) { Deployment::MonolithicImplementationDescription idl_mid; MonolithicImplementationDescription mid = desc.monolithicImpl (); for (MonolithicImplementationDescription::primaryArtifact_const_iterator iter = mid.begin_primaryArtifact (); iter != mid.end_primaryArtifact (); iter++) { CORBA::ULong len = idl_mid.primaryArtifact.length (); idl_mid.primaryArtifact.length (len + 1); idl_mid.primaryArtifact [len].name = (*iter).name ().c_str (); if (!this->xml_helper_->is_initialized ()) return false; // parse the .iad (ImplementationArtifactDescription) file // that the <referencedArtifact> links to xercesc::DOMDocument* dom = this->xml_helper_->create_dom (((*iter).referencedArtifact ()).href ().c_str ()); // here location indicates .iad file if (!dom) return false; ImplementationArtifactDescription iad = implementationArtifactDescription (dom); Deployment::ImplementationArtifactDescription idl_iad; STD_IAD_Handler::impl_artifact_descr (iad, idl_iad); idl_mid.primaryArtifact [len].referencedArtifact = idl_iad; } toconfig.monolithicImpl.length (1); toconfig.monolithicImpl [0] = idl_mid; } // handle <configProperty> if (desc.configProperty_p ()) { Property p = desc.configProperty (); Deployment::Property idl_p; Property_Handler::get_property (p, idl_p); toconfig.configProperty.length (1); toconfig.configProperty [0] = idl_p; } return true; }
/******************************************************************************************* * main ********************************************************************************************/ int main(int argc, char* argv[]) { if (argc<2) { ACE_OS::printf ("usage: %s <object_name>\n", argv[0]); return -1; } try { ACE_CString g_strCmdLn; for (int i=argc-1; i>=0; i--) g_strCmdLn = ACE_CString(argv[i])+ " " + g_strCmdLn; if (g_strCmdLn.find("-ORBDottedDecimalAddresses")==ACE_CString::npos) g_strCmdLn += " -ORBDottedDecimalAddresses 1"; ACE_TCHAR **m_argv = argv; int m_argc = argc; ACE_OS::string_to_argv((ACE_TCHAR*)g_strCmdLn.c_str(), m_argc, m_argv); BACI_CORBA::InitCORBA(m_argc, m_argv); LoggingProxy EP_log (0, 0, 31, 0, 0, 1); LoggingProxy::init (&EP_log); /** * Get reference to a device */ char fileName[64]; sprintf(fileName, "file://%s.ior", argv[1]); CORBA::Object_var object = BACI_CORBA::getORB()->string_to_object (fileName); if (CORBA::is_nil(object.in())) { ACE_DEBUG ((LM_DEBUG, "Cannot get Object")); return -1; } // Try to narrow the object reference to a PowerSupply reference. ENUMPROP_TEST::enumpropTestDevice_var dev = ENUMPROP_TEST::enumpropTestDevice::_narrow (object.in ()); if (CORBA::is_nil(dev.in())) { ACS_SHORT_LOG((LM_DEBUG, "Failed to narrow enumnTestDevice ")); return 0; } ACS_SHORT_LOG((LM_DEBUG, "Device narrowed.")); //dev->off(); // Get current stat ENUMPROP_TEST::ROStates_var currentState = dev->currentState(); // get states description ACS::stringSeq_var description = currentState->statesDescription( ); AlarmCBpattern alarmCB (currentState.in()); ACS::Alarmpattern_var alarmCBObj = alarmCB._this(); ACS::CBDescIn desc; desc.id_tag = 1; ACS::Subscription_var monitor = currentState->new_subscription_AlarmEnum(alarmCBObj.in(), desc); // monitor->set_timer_trigger(10000000); SetterThread setterThread("setter thread", dev); setterThread.resume(); ACS_SHORT_LOG((LM_DEBUG, "(main thread) Going in main loop sleep...")); ACE_Time_Value tv(20); BACI_CORBA::getORB()->run(tv); ACS_SHORT_LOG((LM_DEBUG, "(main thread) Exit ... ")); monitor->destroy(); /* Allow time for the done() callback to come back */ BACI_CORBA::getORB()->run(tv); dev->serverShutdown(); ACS_SHORT_LOG((LM_INFO, "Exiting ....")); /*EP_log.flush(); LoggingProxy::done(); delete &EP_log;*/ BACI_CORBA::DoneCORBA(); } catch( CORBA::Exception &ex ) { ex._tao_print_exception("Error!"); return -1; } return 0; }
int Task_Entry::conjunctive_merge (Dependency_Type dt, ACE_Unbounded_Set <Dispatch_Entry *> &dispatch_entries, ACE_CString &unresolved_locals, ACE_CString &unresolved_remotes) { int result = 0; char string_buffer [BUFSIZ]; // Iterate over the dependencies, and determine the total frame // size. u_long frame_size = 1; ACE_Unbounded_Set_Iterator <Task_Entry_Link *> dep_iter (callers_); for (dep_iter.first (); dep_iter.done () == 0; dep_iter.advance ()) { Task_Entry_Link **link; if (dep_iter.next (link) == 0 || link == 0 || *link == 0) return -1; // The link matches the dependency type given. if ((*link)->dependency_type () == dt) { // Check for and warn about unresolved remote dependencies // in the ONE_WAY call graph. if ((*link)->dependency_type () == RtecBase::ONE_WAY_CALL && (*link)->caller ().has_unresolved_remote_dependencies () && ! this->has_unresolved_remote_dependencies ()) { // Propagate the unresolved remote dependency flag, and // issue a debug scheduler warning. this->has_unresolved_remote_dependencies (1); ORBSVCS_DEBUG ((LM_DEBUG, "Warning: an operation identified by " "\"%s\" has unresolved remote dependencies.\n", (const char*) this->rt_info ()->entry_point)); // Record entry point in list of unresolved remote // dependencies ACE_OS::sprintf (string_buffer, "// %s\n", (const char*) this->rt_info ()->entry_point); unresolved_remotes += ACE_CString (string_buffer); } // Check for and warn about unresolved local dependencies in // the ONE_WAY call graph. if ((*link)->dependency_type () == RtecBase::ONE_WAY_CALL && (*link)->caller ().has_unresolved_local_dependencies () && ! this->has_unresolved_local_dependencies ()) { // Propagate the unresolved local dependency flag, and // issue a debug scheduler warning. this->has_unresolved_local_dependencies (1); ORBSVCS_DEBUG ((LM_DEBUG, "Warning: an operation identified by " "\"%s\" has unresolved local dependencies.\n", (const char*) this->rt_info ()->entry_point)); // Record entry point in list of unresolved local dependencies ACE_OS::sprintf (string_buffer, "// %s\n", (const char*) this->rt_info ()->entry_point); unresolved_locals += ACE_CString (string_buffer); } frame_size = ACE::minimum_frame_size (frame_size, (*link)->caller ().effective_period_); } } // Reframe dispatches in the set to the new frame size (expands the // set's effective period to be the new enclosing frame). if (reframe (dispatch_entries, *this, dispatches_, effective_period_, frame_size) < 0) return -1; // A container and iterator for virtual dispatch sets over which the // conjunction will operate ACE_Ordered_MultiSet <Dispatch_Proxy_Iterator *> conj_set; ACE_Ordered_MultiSet_Iterator <Dispatch_Proxy_Iterator *> conj_set_iter (conj_set); // Iterate over the dependencies, and for each of the given call // type, create a Dispatch_Proxy_Iterator for the caller's dispatch // set, using the caller's period, the total frame size, and the // number of calls: if any of the sets is empty, just return 0; for (dep_iter.first (); dep_iter.done () == 0; dep_iter.advance ()) { Task_Entry_Link **link; if (dep_iter.next (link) == 0 || link == 0 || *link == 0) return -1; // The link matches the dependency type given. if ((*link)->dependency_type () == dt) { Dispatch_Proxy_Iterator *proxy_ptr; ACE_NEW_RETURN (proxy_ptr, Dispatch_Proxy_Iterator ((*link)->caller ().dispatches_, (*link)->caller ().effective_period_, frame_size, (*link)->number_of_calls ()), -1); // If there are no entries in the virtual set, we're done. if (proxy_ptr->done ()) return 0; else if (conj_set.insert (proxy_ptr, conj_set_iter) < 0) return -1; } } // loop, adding conjunctive dispatches, until one of the conjunctive // dispatch sources runs out of entries over the total frame conj_set_iter.first (); int more_dispatches = (conj_set_iter.done ()) ? 0 : 1; while (more_dispatches) { Time arrival = 0; Time deadline = 0; Preemption_Priority priority = 0; OS_Priority OS_priority = 0; for (conj_set_iter.first (); conj_set_iter.done () == 0; conj_set_iter.advance ()) { // initialize to earliest arrival and deadline, and highest priority arrival = 0; deadline = 0; priority = 0; OS_priority = 0; // Policy: conjunctively dispatched operations get the // latest deadline of any of the dispatches in the // conjunction at the time they were dispatched - when and // if it is useful to change any of the merge policies, this // should be one of the decisions factored out into the // conjunctive merge strategy class. // Policy: conjunctively dispatched operations get the // lowest priority of any of the dispatches in the // conjunction at the time they were dispatched - when and // if it is useful to change any of the merge policies, this // should be one of the decisions factored out into the // conjunctive merge strategy class. // Obtain a pointer to the current dispatch proxy iterator. Dispatch_Proxy_Iterator **proxy_iter; if (conj_set_iter.next (proxy_iter) == 0 || proxy_iter == 0 || *proxy_iter == 0) return -1; // Use latest arrival, latest deadline, lowest priority (0 is highest). if (arrival <= (*proxy_iter)->arrival ()) arrival = (*proxy_iter)->arrival (); if (deadline <= (*proxy_iter)->deadline ()) deadline = (*proxy_iter)->deadline (); if (priority <= (*proxy_iter)->priority ()) { priority = (*proxy_iter)->priority (); OS_priority = (*proxy_iter)->OS_priority (); } (*proxy_iter)->advance (); if ((*proxy_iter)->done ()) more_dispatches = 0; } Dispatch_Entry *entry_ptr; ACE_NEW_RETURN (entry_ptr, Dispatch_Entry (arrival, deadline, priority, OS_priority, *this), -1); // If even one new dispatch was inserted, result is "something // happened". result = 1; // Add the new dispatch entry to the set of all dispatches, and // a link to it to the dispatch links for this task entry. if (dispatch_entries.insert (entry_ptr) < 0) return -1; // Use iterator for efficient insertion into the dispatch set. ACE_Ordered_MultiSet_Iterator <Dispatch_Entry_Link> insert_iter (dispatches_); if (dispatches_.insert (Dispatch_Entry_Link (*entry_ptr), insert_iter) < 0) return -1; // TBD - Clients are not assigned priority, but rather obtain it // from their call dependencies. We could complain here if // there is a priority specified that doesn't match (or is lower // QoS?) } return result; }
int Task_Entry::disjunctive_merge (Dependency_Type dt, ACE_Unbounded_Set <Dispatch_Entry *> &dispatch_entries, ACE_CString &unresolved_locals, ACE_CString &unresolved_remotes) { char string_buffer[BUFSIZ]; // Iterate over the set of dependencies, merging dispatches of the // callers over the enclosing frame size. for (ACE_Unbounded_Set_Iterator <Task_Entry_Link *> iter (callers_); ! iter.done (); iter.advance ()) { Task_Entry_Link **link; if (iter.next (link) == 0 || link == 0 || *link == 0) return -1; // The link matches the dependency type given if ((*link)->dependency_type () == dt) { // Check for and warn about unresolved remote dependencies // in the ONE_WAY call graph. if ((*link)->dependency_type () == RtecBase::ONE_WAY_CALL && (*link)->caller ().has_unresolved_remote_dependencies () && ! this->has_unresolved_remote_dependencies ()) { // Propagate the unresolved remote dependency flag, and // issue a debug scheduler warning. this->has_unresolved_remote_dependencies (1); ORBSVCS_DEBUG ((LM_DEBUG, "Warning: an operation identified by " "\"%s\" has unresolved remote dependencies.\n", (const char*) this->rt_info ()->entry_point)); // Record entry point in list of unresolved remote // dependencies ACE_OS::sprintf (string_buffer, "// %s\n", (const char*) this->rt_info ()->entry_point); unresolved_remotes += ACE_CString (string_buffer); } // Check for and warn about unresolved local dependencies in // the ONE_WAY call graph. if ((*link)->dependency_type () == RtecBase::ONE_WAY_CALL && (*link)->caller ().has_unresolved_local_dependencies () && ! this->has_unresolved_local_dependencies ()) { // Propagate the unresolved local dependency flag, and // issue a debug scheduler warning. this->has_unresolved_local_dependencies (1); ORBSVCS_DEBUG ((LM_DEBUG, "Warning: an operation identified by " "\"%s\" has unresolved local dependencies.\n", (const char*) this->rt_info ()->entry_point)); // Record entry point in list of unresolved local // dependencies ACE_OS::sprintf (string_buffer, "// %s\n", (const char*) this->rt_info ()->entry_point); unresolved_locals += ACE_CString (string_buffer); } // Merge the caller's dispatches into the current set. if (merge_frames (dispatch_entries, *this, dispatches_, (*link)->caller ().dispatches_, effective_period_, (*link)->caller ().effective_period_, (*link)->number_of_calls ()) < 0) return -1; } } return 0; }