コード例 #1
0
void
Element::interfacesCallback (Element *elementp, ServiceCallbackKeyValue *kv)
{
    // We heard back. So the element is alive
    time_t t;
    time(&t);
    elementp->setLastUpdateTime(t);
    
    // We are only interested in collecting list of interfaces at this time
    std::string name_str("]/name");
    if (kv->key.find(name_str) == std::string::npos) {
        return;
    }
    std::string if_name = kv->str_value;
    
    // If interface already present, we are done
    if (elementp->isPresentInterface(if_name)) {
        return;
    }
    
    // Absorb this interface
    ElementInterface *ifp = new ElementInterface(if_name,
                                                 elementp->_interface_id_manager.allocate());
    if (ifp) {
        elementp->addInterface(ifp);
    }
}
コード例 #2
0
    void
    ServantRetentionStrategyRetain::strategy_init (TAO_Root_POA *poa)
    {
      poa_ = poa;

      // Create the active object map to be used
      TAO_Active_Object_Map *active_object_map = 0;
      ACE_NEW_THROW_EX (active_object_map,
                        TAO_Active_Object_Map (!poa->system_id (),
                                               !poa->allow_multiple_activations (),
                                               poa->is_persistent (),
                                               poa->orb_core().server_factory ()->active_object_map_creation_parameters ()
                                              ), CORBA::NO_MEMORY ());

      ACE_auto_ptr_reset (this->active_object_map_, active_object_map);

#if defined (TAO_HAS_MONITOR_POINTS) && (TAO_HAS_MONITOR_POINTS == 1)
      ACE_CString name_str ("Active_Object_Map_");
      name_str += poa->orb_core ().orbid ();
      name_str += '_';
      name_str += poa->the_name ();

      active_object_map->monitor_->name (name_str.c_str ());
      active_object_map->monitor_->add_to_registry ();
#endif /* TAO_HAS_MONITOR_POINTS */
    }
コード例 #3
0
void ResourceManager::load(StringId64 type, StringId64 name)
{
	ResourcePair id = { type, name };
	ResourceEntry& entry = sort_map::get(_rm, id, ResourceEntry::NOT_FOUND);

	if (entry == ResourceEntry::NOT_FOUND)
	{
		TempAllocator64 ta;
		DynamicString type_str(ta);
		DynamicString name_str(ta);
		type.to_string(type_str);
		name.to_string(name_str);

		CE_ASSERT(_loader->can_load(type, name)
			, "Can't load resource #ID(%s-%s)"
			, type_str.c_str()
			, name_str.c_str()
			);
		CE_UNUSED(type_str);
		CE_UNUSED(name_str);

		ResourceRequest rr;
		rr.type = type;
		rr.name = name;
		rr.load_function = sort_map::get(_type_data, type, ResourceTypeData()).load;
		rr.allocator = &_resource_heap;
		rr.data = NULL;

		_loader->add_request(rr);
		return;
	}

	entry.references++;
}
コード例 #4
0
const void* ResourceManager::get(StringId64 type, StringId64 name)
{
	const ResourcePair id = { type, name };
	TempAllocator128 ta;
	DynamicString type_str(ta);
	DynamicString name_str(ta);
	type.to_string(type_str);
	name.to_string(name_str);

	CE_ASSERT(can_get(type, name)
		, "Resource not loaded #ID(%s-%s)"
		, type_str.c_str()
		, name_str.c_str()
		);
	CE_UNUSED(type_str);
	CE_UNUSED(name_str);

	if (_autoload && !sort_map::has(_rm, id))
	{
		load(type, name);
		flush();
	}

	const ResourceEntry& entry = sort_map::get(_rm, id, ResourceEntry::NOT_FOUND);
	return entry.data;
}
コード例 #5
0
ファイル: rcg2xml.cpp プロジェクト: edymanoloiu/FotbalRobotic
 void printParam( const char * name,
                  const std::string & value )
   {
       std::string name_str( name );
       std::string value_str( value );
       XMLEscape( name_str );
       XMLEscape( value_str );
       std::cout << "<Param name=\"" << name_str << "\">" << value_str << "</Param>\n";
   }
コード例 #6
0
ファイル: xs-native.cpp プロジェクト: svn2github/ros-explorer
	 /// read attributes and values
	void get_attributes(XMLNode::AttributeMap& attributes) const
	{
		const char* p = _buffer_str.c_str();

		 // find end of tag name
		if (*p == '<')
			++p;

		if (*p == '/')
			++p;
		else if (*p == '?')
			++p;

		p = get_xmlsym_end_utf8(p);

		 // read attributes from buffer
		while(*p && *p!='>' && *p!='/') {
			while(isspace((unsigned char)*p))
				++p;

			const char* attr_name = p;

			p = get_xmlsym_end_utf8(p);

			if (*p != '=')
				break;	//@TODO error handling

			size_t attr_len = p - attr_name;

			if (*++p!='"' && *p!='\'')
				break;	//@TODO error handling

			char delim = *p;
			const char* value = ++p;

			while(*p && *p!=delim)
				++p;

			size_t value_len = p - value;

			if (*p)
				++p;	// '"'

#ifdef XS_STRING_UTF8
			XS_String name_str(attr_name, attr_len);
			XS_String value_str(value, value_len);
#else
			XS_String name_str, value_str;
			assign_utf8(name_str, attr_name, attr_len);
			assign_utf8(value_str, value, value_len);
#endif

			attributes[name_str] = DecodeXMLString(value_str);
		}
	}
コード例 #7
0
ファイル: Monitor_Query.cpp プロジェクト: elvin-du/ACE
    Monitor_Query::Monitor_Query (const char* monitor_name)
      : monitor_ (0)
    {
      ACE_CString name_str (monitor_name, 0, false);
      this->monitor_ = Monitor_Point_Registry::instance ()->get (name_str);

      if (this->monitor_ == 0)
        {
          ACELIB_ERROR ((LM_ERROR, "Monitor_Query - monitor lookup failed\n"));
        }
    }
コード例 #8
0
rc_t runChecks(const TestCase& test_case, const VCursor * cursor, uint32_t name_idx, uint32_t name_range_idx)
{
    rc_t rc;
    int64_t first_id;
    uint64_t count_id;
    
    rc = VCursorIdRange( cursor, name_idx, &first_id, &count_id );
    if (rc != 0)
    {
        LOGERR( klogInt, rc, "VCursorIdRange() failed" );
        return rc;
    }
    
    for (uint64_t row_id = first_id; row_id < first_id + count_id; ++row_id)
    {
        const char * name = NULL;
        uint32_t name_len;
        RowRange *row_range;
        
        rc = VCursorCellDataDirect( cursor, row_id, name_idx, NULL, (void const **)&name, NULL, &name_len );
        if ( rc != 0 )
            return rc;
        
        rc = VCursorParamsSet( ( struct VCursorParams const * )cursor, "QUERY_NAME", "%.*s", name_len, name );
        if ( rc != 0 )
            return rc;
        
        rc = VCursorCellDataDirect( cursor, row_id, name_range_idx, NULL, (void const **)&row_range, NULL, NULL );
        if ( rc != 0 )
            return rc;
        
        std::string name_str(name, name_len);
        
        if (test_case.key_ranges.find(name_str) == test_case.key_ranges.end())
        {
            PLOGMSG( klogInt, (klogErr, "Unexpected name '$(NAME)' in test case '$(TC_NAME)'", "TC_NAME=%s,NAME=%s", test_case_name, name_str.c_str()) );
            return 1;
        }
        
        RowRange row_range_exp = test_case.key_ranges.find(name_str)->second;
        if (row_range->start_id != row_range_exp.start_id || row_range->stop_id != row_range_exp.stop_id)
        {
            PLOGMSG( klogInt, (klogErr, "Row range for name '$(NAME)' in test case '$(TC_NAME)' does not match. Expected: $(EXP_S)-$(EXP_F), actual: $(ACT_S)-$(ACT_F)",
                               "TC_NAME=%s,NAME=%s,EXP_S=%ld,EXP_F=%ld,ACT_S=%ld,ACT_F=%ld",
                               test_case_name, name_str.c_str(), row_range_exp.start_id, row_range_exp.stop_id, row_range->start_id, row_range->stop_id) );
            return 1;
        }
    }
    
    return rc;
}
コード例 #9
0
ファイル: Hotlist.cpp プロジェクト: prestocore/browser
OpTypedObject::Type Hotlist::GetPanelTypeByName(const uni_char* name)
{
	INT32 i;
	OpStringC16 name_str(name);

	for (i = 0; name && s_panel_types[i]; i++)
	{
		if (name_str.CompareI(s_panel_types[i]) == 0)
		{
			return (Type) (PANEL_TYPE_FIRST + i);
		}
	}

	return UNKNOWN_TYPE;
}
コード例 #10
0
ファイル: ext.cpp プロジェクト: bitkeeper/sedna
PPIterator *ExtFunctionManager::make_pp_ext_func(const char *name, dynamic_context *cxt, operation_info info, arr_of_PPOpIn arr)
{
	std::string name_str(name);
	load_func_list();
	ext_function_desc *fdesc = func_list[name_str];
	if (fdesc == NULL)
		throw USER_EXCEPTION2(SE1003, (std::string("external function implementation not found: '") + name_str + "'").c_str());

	ExtFunction *fn;
	if (fdesc->fn == NULL)
		fn = se_new ExtFunction(name_str, func_list[name_str]->lib, &fdesc->fn);
	else
		fn = fdesc->fn->copy();

	return se_new PPExtFunCall(cxt, info, arr, fn, name_str);
}
コード例 #11
0
ファイル: PassManager.cpp プロジェクト: JoelMarcey/redex
void PassManager::activate_pass(const char* name, const Json::Value& cfg) {
  std::string name_str(name);

  // Names may or may not have a "#<id>" suffix to indicate their order in the
  // pass list, which needs to be removed for matching.
  std::string pass_name = name_str.substr(0, name_str.find("#"));
  for (auto pass : m_registered_passes) {
    if (pass_name == pass->name()) {
      m_activated_passes.push_back(pass);

      // Retrieving the configuration specific to this particular run
      // of the pass.
      pass->configure_pass(JsonWrapper(cfg[name_str]));
      return;
    }
  }
  always_assert_log(false, "No pass named %s!", name);
}
コード例 #12
0
    bool
    Monitor_Point_Registry::remove (const char* name)
    {
      if (name == 0)
        {
          ACE_ERROR_RETURN ((LM_ERROR,
                             "registry remove: null name\n"),
                            false);
        }

      int status = 0;
      Map::data_type mp = 0;

      {
        ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, guard, this->mutex_, false);

        ACE_CString name_str (name, 0, false);
        status = this->map_.unbind (name_str, mp);
        
        /// Temporary debugging code.
//        ACE_DEBUG ((LM_DEBUG, "removing %s\n", name_str.c_str ()));
      }

      if (status == -1)
        {
// (JP) There is a problem with this failing on a single ACE_Message_Queue
//      monitor per process. I think it is the message queue associated
//      with the default reactor, maybe because at that low level, ACE
//      is using malloc with placement, then free, which may bypass the
//      normal destructors. In any case, it happens only at shutdown
//      and there seems to be no memory leak.
//          ACE_ERROR_RETURN ((LM_ERROR,
//                             "registry remove: unbind failed for %s\n",
//                             name),
//                            false);
        }
      else
        {
          mp->remove_ref ();
        }

      return (status == 0);
    }
コード例 #13
0
ファイル: message_queue_size.cpp プロジェクト: asdlei00/ACE
  int svc (void)
  {
    /// Reconstruct the monitor's unique name using the queue's hex address.
    const int nibbles = 2 * sizeof (ptrdiff_t);
    char buf[nibbles + 1];
    ACE_OS::sprintf (buf, "%p", this->addr_);
    buf[nibbles] = '\0';
    ACE_CString name_str ("Message_Queue_");
    name_str += buf;

    /// Get an instance of the MC service singleton.
    MC_ADMINMANAGER* mgr =
      ACE_Dynamic_Service<MC_ADMINMANAGER>::instance ("MC_ADMINMANAGER");

    /// Call on the administrator class to look up the desired monitors.
    ACE::Monitor_Control::Monitor_Base *mq_monitor =
      mgr->admin ().monitor_point (name_str.c_str ());

    if (mq_monitor != 0)
      {
        ACE_OS::sleep (1);

        /// Query each monitor for its data every 2 seconds, and call the
        /// appropriate display function.
        for (int i = 0; i < 10; ++i)
          {
            ACE_OS::sleep (1);

            Monitor_Control_Types::Data data (mq_monitor->type ());
            mq_monitor->retrieve (data);
            MC_Test_Utilities::display_mq_size (data);
          }

        mq_monitor->remove_ref ();
      }

    return 0;
  }
コード例 #14
0
ファイル: Monitor_Admin.cpp プロジェクト: Arkania/ArkCORE-NG
 Monitor_Base*
 Monitor_Admin::monitor_point (const char* name)
 {
   ACE_CString name_str (name, 0, false);
   return Monitor_Point_Registry::instance ()->get (name_str);
 }