当前位置: 首页>>代码示例>>C++>>正文


C++ converter函数代码示例

本文整理汇总了C++中converter函数的典型用法代码示例。如果您正苦于以下问题:C++ converter函数的具体用法?C++ converter怎么用?C++ converter使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了converter函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ACE_TMAIN

int ACE_TMAIN(int argc, ACE_TCHAR *argv[])
{
  if (parse_args(argc, argv) != 0)
    return 1;

  try
    {
      ACE_Argv_Type_Converter converter(argc, argv);

      CORBA::ORB_var orb =
        CORBA::ORB_init(converter.get_argc(), converter.get_ASCII_argv(), "");

      CORBA::Object_var tmp =
          orb->string_to_object (ACE_TEXT_ALWAYS_CHAR(ior));
      OpenDDS::DCPS::DCPSInfo_var info =
          OpenDDS::DCPS::DCPSInfo::_narrow (tmp.in ());

      if (CORBA::is_nil(info.in()) )
        {
          ACE_ERROR_RETURN ((LM_DEBUG,
                             "Nil OpenDDS::DCPS::DCPSInfo reference <%s>\n",
                             ior),
                            1);
        }

      OPENDDS_STRING state = info->dump_to_string();

      std::cout << state.c_str() << std::endl;

      // clean up the orb
      orb->destroy ();
    }
  catch (const CORBA::Exception& ex)
    {
      ex._tao_print_exception ("Exception caught in publisher.cpp:");
      return 1;
    }

  return 0;
}
开发者ID:AndroidDev77,项目名称:OpenDDS,代码行数:40,代码来源:dump.cpp

示例2: DBG_ENTRY_LVL

int
OpenDDS::DCPS::TransportImpl::add_pending_association(
  RepoId                  local_id,
  const AssociationInfo&  info)
{
  DBG_ENTRY_LVL("TransportImpl","add_pending_association",6);

  GuardType guard(this->lock_);

  // Cache the Association data so it can be used for the callback
  // to notify datawriter on_publication_matched.

  PendingAssociationsMap::iterator iter = pending_association_sub_map_.find(local_id);

  if (iter != pending_association_sub_map_.end())
    iter->second->push_back(info);

  else {
    AssociationInfoList* infos = new AssociationInfoList;
    infos->push_back(info);

    if (OpenDDS::DCPS::bind(pending_association_sub_map_, local_id, infos) == -1) {
      OpenDDS::DCPS::RepoIdConverter converter(local_id);
      ACE_ERROR_RETURN((LM_ERROR,
                        ACE_TEXT("(%P|%t) ERROR: TransportImpl::add_pending_association: ")
                        ACE_TEXT("failed to add pending associations for pub %C\n"),
                        std::string(converter).c_str()),-1);
    }
  }

  // Acks for this new pending association may arrive at this time.
  // If check for individual association, it needs remove the association
  // from pending_association_sub_map_ so the fully_associated won't be
  // called multiple times. To simplify, check by pub id since the
  // check_fully_association overloaded function clean the pending list
  // after calling fully_associated.
  check_fully_association(local_id);

  return 0;
}
开发者ID:svn2github,项目名称:OpenDDS,代码行数:40,代码来源:TransportImpl.cpp

示例3: do_GetService

nsresult
nsGopherChannel::PushStreamConverters(nsIStreamListener *listener, nsIStreamListener **result)
{
    nsresult rv;
    nsCOMPtr<nsIStreamListener> converterListener;
    
    nsCOMPtr<nsIStreamConverterService> StreamConvService = 
             do_GetService(kStreamConverterServiceCID, &rv);
    if (NS_FAILED(rv)) return rv;
 
    // What we now do depends on what type of file we have
    if (mType=='1' || mType=='7') {
        // Send the directory format back for a directory
        rv = StreamConvService->AsyncConvertData("text/gopher-dir", 
               APPLICATION_HTTP_INDEX_FORMAT,
               listener,
               mUrl,
               getter_AddRefs(converterListener));
        if (NS_FAILED(rv)) return rv;
    } else if (mType=='0') {
        // Convert general file
        rv = StreamConvService->AsyncConvertData("text/plain",
                                                 "text/html",
                                                 listener,
                                                 mListenerContext,
                                                 getter_AddRefs(converterListener));
        if (NS_FAILED(rv)) return rv;
        
        nsCOMPtr<nsITXTToHTMLConv> converter(do_QueryInterface(converterListener));
        if (converter) {
            nsCAutoString spec;
            rv = mUrl->GetSpec(spec);
            converter->SetTitle(NS_ConvertUTF8toUCS2(spec).get());
            converter->PreFormatHTML(PR_TRUE);
        }
    }

    NS_IF_ADDREF(*result = converterListener);
    return NS_OK;
}
开发者ID:rn10950,项目名称:RetroZilla,代码行数:40,代码来源:nsGopherChannel.cpp

示例4: TestMeshalyzerConversionLotsOfVariables

    // This test covers the case when the hdf5 file contains more than 3 variables
    void TestMeshalyzerConversionLotsOfVariables() throw(Exception)
    {
        std::string output_dir = "TestHdf5Converters_TestMeshalyzerConversionLotsOfVariables";

        /*
         * Firstly, copy the .h5 file to CHASTE_TEST_OUTPUT/TestHdf5ToMeshalyzerConverter,
         * as that is where the reader reads from.
         */
        CopyToTestOutputDirectory("heart/test/data/many_variables/many_variables.h5", output_dir);

        TrianglesMeshReader<1,1> mesh_reader("heart/test/data/many_variables/1D_65_elements");
        TetrahedralMesh<1,1> mesh;
        mesh.ConstructFromMeshReader(mesh_reader);

        // Convert
        Hdf5ToMeshalyzerConverter<1,1> converter(FileFinder(output_dir, RelativeTo::ChasteTestOutput),
                                                 "many_variables", &mesh, true);

        std::vector<std::string> variable_names;
        variable_names.push_back("V");
        variable_names.push_back("I_ks");
        variable_names.push_back("I_kr");
        variable_names.push_back("I_Ca_tot");
        variable_names.push_back("I_tot");
        variable_names.push_back("I_Na_tot");

        std::string test_output_directory = OutputFileHandler::GetChasteTestOutputDirectory();
        for (unsigned i=0; i<variable_names.size(); i++)
        {
            // Compare the results files
            FileComparison(test_output_directory + "/" + output_dir + "/output/many_variables_"
                           + variable_names[i] + ".dat",
                           "heart/test/data/many_variables/many_variables_"
                           + variable_names[i] + ".dat").CompareFiles();
        }

        // Compare the time information file
        FileComparison(test_output_directory + output_dir + "/output/many_variables_times.info",
                       "heart/test/data/many_variables/many_variables_times.info").CompareFiles();
    }
开发者ID:ktunya,项目名称:ChasteMod,代码行数:41,代码来源:TestHdf5Converters.hpp

示例5: pcmreader_error_read

static unsigned
pcmreader_error_read(struct PCMReader *self,
                     unsigned pcm_frames,
                     int *pcm_data)
{
    if (self->input.error.total_pcm_frames) {
        const register unsigned bytes_per_sample = self->bits_per_sample / 8;

        pcm_to_int_f converter = self->input.error.converter;

        const unsigned pcm_frames_to_read =
            MIN(pcm_frames, self->input.error.total_pcm_frames);

        const unsigned bytes_to_read =
            pcm_frames_to_read * bytes_per_sample * self->channels;

        unsigned char buffer[bytes_to_read];

        const size_t bytes_read =
            fread(buffer,
                  sizeof(unsigned char),
                  bytes_to_read,
                  self->input.error.file);

        const unsigned pcm_frames_read =
            bytes_read / bytes_per_sample / self->channels;

        /*cull partial PCM frames*/
        const unsigned samples_read = pcm_frames_read * self->channels;

        converter(samples_read, buffer , pcm_data);

        self->input.error.total_pcm_frames -= pcm_frames_to_read;

        return pcm_frames_read;
    } else {
        self->status = PCM_READ_ERROR;
        return 0;
    }
}
开发者ID:KristoforMaynard,项目名称:python-audio-tools,代码行数:40,代码来源:pcmreader.c

示例6: tr

/**
 * Loads the specified save.
 * @param action Pointer to an action.
 */
void ListLoadOriginalState::btnSlotClick(Action *action)
{
	int n = 0;
	for (int i = 0; i < SaveConverter::NUM_SAVES; ++i)
	{
		if (action->getSender() == _btnSlot[i])
		{
			n = i;
			break;
		}
	}
	if (_saves[n].id > 0)
	{
		if (_saves[n].tactical)
		{
			std::wostringstream error;
			error << tr("STR_LOAD_UNSUCCESSFUL") << L'\x02' << L"Battlescape saves aren't supported yet.";
			_game->pushState(new ErrorMessageState(error.str(), _palette, Palette::blockOffset(8) + 10, "BACK01.SCR", 6));
		}
		else
		{
			SaveConverter converter(_saves[n].id, _game->getRuleset());
			_game->setSavedGame(converter.loadXcom1());
			Options::baseXResolution = Options::baseXGeoscape;
			Options::baseYResolution = Options::baseYGeoscape;
			_game->getScreen()->resetDisplay(false);
			_game->setState(new GeoscapeState);
			if (_game->getSavedGame()->getSavedBattle() != 0)
			{
				_game->getSavedGame()->getSavedBattle()->loadMapResources(_game);
				Options::baseXResolution = Options::baseXBattlescape;
				Options::baseYResolution = Options::baseYBattlescape;
				_game->getScreen()->resetDisplay(false);
				BattlescapeState *bs = new BattlescapeState;
				_game->pushState(bs);
				_game->getSavedGame()->getSavedBattle()->setBattleState(bs);
			}
		}
	}
}
开发者ID:bslaveboy,项目名称:OpenXcom,代码行数:44,代码来源:ListLoadOriginalState.cpp

示例7: converter

int DCPS_IR_Domain::add_participant(DCPS_IR_Participant* participant)
{
  OpenDDS::DCPS::RepoId participantId = participant->get_id();
  OpenDDS::DCPS::RepoIdConverter converter(participantId);

  DCPS_IR_Participant_Map::iterator where
  = this->participants_.find(participantId);

  if (where == this->participants_.end()) {
    this->participants_.insert(
      DCPS_IR_Participant_Map::value_type(participantId, participant));

    // Publish the BIT information
    publish_participant_bit(participant);

    if (OpenDDS::DCPS::DCPS_debug_level > 0) {
      ACE_DEBUG((LM_DEBUG,
                 ACE_TEXT("(%P|%t) DCPS_IR_Domain::add_participant: ")
                 ACE_TEXT("added participant %C in domain %d ")
                 ACE_TEXT("at 0x%x.\n"),
                 std::string(converter).c_str(),
                 id_,
                 participant));
    }

  } else {
    if (OpenDDS::DCPS::DCPS_debug_level > 0) {
      ACE_DEBUG((LM_NOTICE,
                 ACE_TEXT("(%P|%t) NOTICE: DCPS_IR_Domain::add_participant: ")
                 ACE_TEXT("attempt to add already existing participant %C in domain %d.\n"),
                 std::string(converter).c_str(),
                 id_));
    }

    return 1;
  }

  return 0;
}
开发者ID:tornadoxutao,项目名称:OpenDDS,代码行数:39,代码来源:DCPS_IR_Domain.cpp

示例8: fFilter

VSysLogOutput::VSysLogOutput( const VString& inIdentifier)
: fFilter((1<<EML_Trace) | (1<<EML_Information) | (1<<EML_Warning) | (1<<EML_Error) | (1<<EML_Fatal))
, fIdentifier( NULL)
{
	if (!inIdentifier.IsEmpty())
	{
		// SysLog retain the identifier buffer pointer until closelog() is called
		StStringConverter<char> converter( inIdentifier, VTC_StdLib_char);
		if (converter.GetSize() > 0)
		{
			fIdentifier = VMemory::NewPtrClear( converter.GetSize() + 1, 'SYSL');
			if (fIdentifier != NULL)
			{
				VMemory::CopyBlock( converter.GetCPointer(), fIdentifier, converter.GetSize());
			}
		}
		
	}
	
	// the facility may have to be changed according to the context (user process, daemon...)
	openlog( fIdentifier, LOG_CONS | LOG_PID | LOG_NDELAY, LOG_USER);
}
开发者ID:sanyaade-iot,项目名称:core-XToolbox,代码行数:22,代码来源:VSysLogOutput.cpp

示例9: wxLogUsrMsg

bool wxWebUpdateActionMkfile::Run() const
{
	wxArrayString orig, output;
	wxLogUsrMsg(_("wxWebUpdateActionMkfile::Run - going to make the file [%s]"), m_strTarget.c_str());

	// do we have to create a folder ?
	wxFileName f(m_strTarget);
	if (f.FileExists()) {

		if (m_bOverwrite)
			wxLogAdvMsg(wxS("wxWebUpdateActionMkfile::Run - the file \"") + m_strTarget +
			wxS("\" already exist... proceeding anyway (overwrite=1)"));
		else
			return TRUE;		// exit
	}

	// create it !
	wxFileOutputStream out(f.GetFullPath());

	// do the encoding conversion
	wxCSConv converter(m_strEncoding);
	wxCharBuffer buf = m_strContent.mb_str(converter);
	const char *data = (const char*) buf;
	size_t bytes = strlen(data)*sizeof(char);

	// write
	if (out.Write(data, bytes).LastWrite() != bytes) {
		wxLogUsrMsg(_("wxWebUpdateActionMkfile::Run - could not create the [%s] file"),
			        f.GetFullPath().c_str());
		//wxDELETEA(data);
		return FALSE;
	}

	//wxDELETEA(data);
	wxLogUsrMsg(_("wxWebUpdateActionMkfile::Run - created the [%1$s] file with content [%2$s]..."),
                f.GetFullPath().c_str(), m_strContent.c_str());

	return TRUE;
}
开发者ID:stahta01,项目名称:wxCode_components,代码行数:39,代码来源:stdactions.cpp

示例10: TestMonodomainMeshalyzerConversion

    void TestMonodomainMeshalyzerConversion() throw(Exception)
    {
        // Firstly, copy ./heart/test/data/MonoDg01d/*.h5 to CHASTE_TEST_OUTPUT/TestHdf5ToMeshalyzerConverter,
        // as that is where the reader reads from.
        std::string output_folder("TestHdf5Converters_TestMonodomainMeshalyzerConversion");
        CopyToTestOutputDirectory("heart/test/data/Monodomain1d/MonodomainLR91_1d.h5", output_folder);

        TrianglesMeshReader<1,1> mesh_reader("mesh/test/data/1D_0_to_1_100_elements");
        TetrahedralMesh<1,1> mesh;
        mesh.ConstructFromMeshReader(mesh_reader);

        // Convert
        Hdf5ToMeshalyzerConverter<1,1> converter(FileFinder(output_folder,RelativeTo::ChasteTestOutput),
                                                 "MonodomainLR91_1d", &mesh, true, 10 /* precision specified for coverage */);

        // Compare the voltage file with a correct version
        std::string test_output_directory = OutputFileHandler::GetChasteTestOutputDirectory();
        FileComparison(test_output_directory + output_folder + "/output/MonodomainLR91_1d_V.dat",
                       "heart/test/data/Monodomain1d/MonodomainLR91_1d_V.dat").CompareFiles();
        FileComparison(test_output_directory + output_folder + "/output/MonodomainLR91_1d_times.info",
                       "heart/test/data/Monodomain1d/MonodomainLR91_1d_times.info").CompareFiles();
    }
开发者ID:ktunya,项目名称:ChasteMod,代码行数:22,代码来源:TestHdf5Converters.hpp

示例11: main

int main(void) {
	float c;
	int temp_type;

	printf("---------------------------------------------------\n");
	printf("celciusconv.c\n");
	printf("Convert Celcius temperature to Reamur or Fahrenheit\n");
	printf("Coded By slac3dork\n");
	printf("---------------------------------------------------\n\n");
	printf("Celcius temperature: ");
	scanf("%f", &c);
	printf("Convert to Reamur/Fahrenheit (1 / 2): ");
	scanf("%d", &temp_type);

	if ((temp_type == 1) || (temp_type == 2)) {
		converter(c, temp_type);
	} else {
		printf("\nUnknown...Plase input 1 or 2");
	}

	return 0;
}
开发者ID:slac3dork,项目名称:SnipL0g,代码行数:22,代码来源:celciusconv.c

示例12: T3D_LOG_ERROR

    bool FbxSerializer::load(const String &path, void *&pData)
    {
        if (mFbxManager == nullptr)
        {
            T3D_LOG_ERROR("FBX Manager haven't been initialized !");
            return false;
        }

        // Create an importer
        FbxImporter *pFbxImporter = FbxImporter::Create(mFbxManager, "");

        // Initialize the importer by providing a filename.
        bool bImportStatus = pFbxImporter->Initialize(path.c_str(), -1, mFbxManager->GetIOSettings());

        if (!bImportStatus)
        {
            T3D_LOG_ERROR("Unable to initialize FBX importer !");
            return false;
        }

        // Import the scene
        bool bStatus = pFbxImporter->Import(mFbxScene);

        // Destroy the importer
        pFbxImporter->Destroy();

        // 统一切换成OpenGL的右手坐标系和以米为单位的坐标系
        FbxAxisSystem::OpenGL.ConvertScene(mFbxScene);
        // 统一以1米为单位
        FbxSystemUnit::m.ConvertScene(mFbxScene);

        // 不是三角形为面的mesh,统一转换成三角形为面的mesh
        FbxGeometryConverter converter(mFbxManager);
        converter.Triangulate(mFbxScene, true);

        pData = mFbxScene;

        return bStatus;
    }
开发者ID:asnwerear,项目名称:Tiny3D,代码行数:39,代码来源:mconv_fbxserializer.cpp

示例13: main

int main(int argc, const char * argv [])
{
  if (argc < 2)
  {
    std::cout << "Specify path to mapcss and correction parameters" << std::endl;
    return -1;
  }

  try
  {
    std::string const file = argv[1];
    std::cout << "Input mapcss project: " << file << std::endl;

    TCoefficientTable table;
    InitCoefficientTable(table, argc, argv);

    for (auto const & kv : table)
      std::cout << "Correction: " << kv.first << " x " << kv.second << std::endl;

    MapcssConverter converter(move(table));
    mapcss::ReadProject(file, std::bind(&MapcssConverter::Process, &converter, std::placeholders::_1, std::placeholders::_2));

    auto const & affectedFiles = converter.GetAffectedFiles();
    std::cout << affectedFiles.size() << " files has been affected" << (affectedFiles.empty() ? "" : ":") << std::endl;
    for (auto const & f : affectedFiles)
      std::cout << "  " << f << std::endl;

    converter.Flush();

    std::cout << "Done." << std::endl;
  }
  catch (std::exception & e)
  {
    std::cout << "Something went wrong. " << e.what() << std::endl;
  }

  return 0;
}
开发者ID:kshalnev,项目名称:mapcssfixup,代码行数:38,代码来源:main.cpp

示例14: m_obj

/**
 * Construct the converter object with the given Python object
 * @param p :: A boost::python object is either a wrapped Kernel::Matrix
 * or 2D numpy array
 * Throws std::invalid_argument if not
 * if that is not the case.
 */
PyObjectToMatrix::PyObjectToMatrix(const boost::python::object &p)
    : m_obj(p), m_alreadyMatrix(false) {
  // Is it an already wrapped V3D ?
  extract<Kernel::Matrix<double>> converter(p);
  if (converter.check()) {
    m_alreadyMatrix = true;
    return;
  }
  // Is it a 2D numpy array
  if (!NumPy::NdArray::check(p)) {
    std::ostringstream msg;
    msg << "Cannot convert object to Matrix. Expected numpy array, found "
        << p.ptr()->ob_type->tp_name;
    throw std::invalid_argument(msg.str());
  }
  const auto ndim = PyArray_NDIM((PyArrayObject *)p.ptr());
  if (ndim != 2) {
    std::ostringstream msg;
    msg << "Error converting numpy array to Matrix. Expected ndim=2, found "
           "ndim=" << ndim << " dimensions.";
    throw std::invalid_argument(msg.str());
  }
}
开发者ID:DanNixon,项目名称:mantid,代码行数:30,代码来源:PyObjectToMatrix.cpp

示例15: UTF8ToNewUnicode

PRUnichar*
UTF8ToNewUnicode( const nsACString& aSource, PRUint32 *aUTF16Count )
  {
    nsACString::const_iterator start, end;
    CalculateUTF8Length calculator;
    copy_string(aSource.BeginReading(start), aSource.EndReading(end),
                calculator);

    if (aUTF16Count)
      *aUTF16Count = calculator.Length();

    PRUnichar *result = static_cast<PRUnichar*>
                                   (nsMemory::Alloc(sizeof(PRUnichar) * (calculator.Length() + 1)));
    if (!result)
      return nsnull;

    ConvertUTF8toUTF16 converter(result);
    copy_string(aSource.BeginReading(start), aSource.EndReading(end),
                converter).write_terminator();
    NS_ASSERTION(calculator.Length() == converter.Length(), "length mismatch");

    return result;
  }
开发者ID:lofter2011,项目名称:Icefox,代码行数:23,代码来源:nsReadableUtils.cpp


注:本文中的converter函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。