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


C++ Generator::generate方法代码示例

本文整理汇总了C++中Generator::generate方法的典型用法代码示例。如果您正苦于以下问题:C++ Generator::generate方法的具体用法?C++ Generator::generate怎么用?C++ Generator::generate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Generator的用法示例。


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

示例1: generate

    void generate(OutputIterator first,
                  OutputIterator last,
                  Generator &generator,
                  command_queue &queue)
    {
        size_t size = std::distance(first, last);
        typedef typename Generator::result_type g_result_type;

        vector<g_result_type> tmp(size, queue.get_context());
        vector<g_result_type> tmp2(size, queue.get_context());

        uint_ bound = ((uint_(-1))/(m_b-m_a+1))*(m_b-m_a+1);

        buffer_iterator<g_result_type> tmp2_iter;

        while(size>0)
        {
            generator.generate(tmp.begin(), tmp.begin() + size, queue);
            tmp2_iter = copy_if(tmp.begin(), tmp.begin() + size, tmp2.begin(),
                                _1 <= bound, queue);
            size = std::distance(tmp2_iter, tmp2.end());
        }

        BOOST_COMPUTE_FUNCTION(IntType, scale_random, (const g_result_type x),
        {
            return LO + (x % (HI-LO+1));
        });
开发者ID:Soledad89,项目名称:compute,代码行数:27,代码来源:uniform_int_distribution.hpp

示例2: startGraphConstruction

  void startGraphConstruction() {
		while (opts.freeze_after_graph_creation) {}
		CkPrintf("PageRank running...\n");
		CkPrintf("\tnumber of mpi processes is %d\n", CkNumPes());
		CkPrintf("\tgraph (s=%d, k=%d), scaling: %s\n", opts.scale, opts.K, (opts.strongscale) ? "strong" : "weak");
		CkPrintf("Start graph construction:........\n");
    starttime = CkWallTimer();

		generator->generate();

		CkStartQD(CkIndex_TestDriver::doPageRank(), &thishandle);
	}
开发者ID:DISLab,项目名称:xcharm,代码行数:12,代码来源:charm_pagerank_naive.C

示例3: generate

    void generate(OutputIterator first,
                  OutputIterator last,
                  Generator &generator,
                  command_queue &queue)
    {
        size_t count = detail::iterator_range_size(first, last);

        vector<uint_> tmp(count, queue.get_context());
        generator.generate(tmp.begin(), tmp.end(), queue);

        BOOST_COMPUTE_FUNCTION(bool, scale_random, (const uint_ x),
        {
            return (convert_RealType(x) / MAX_RANDOM) < PARAM;
        });
开发者ID:junmuz,项目名称:compute,代码行数:14,代码来源:bernoulli_distribution.hpp

示例4: generate

void EncoderGenerator::generate(Context* pCtx, Strategy* pWhere)
{
     Generator* pNext = next();

     int p2 = pow2(_preparations);
     
     for (int preparation = 0; preparation < p2; ++preparation)
     {
        StrategyPtr pPreparation = new Strategy(pCtx, this, preparation, _preparations);
        pWhere->pushBack(pPreparation);

        
        if (pNext)
            pNext->generate(pCtx, pPreparation);  

     }
}
开发者ID:amcsleite,项目名称:wit,代码行数:17,代码来源:EncoderGenerator.cpp

示例5: main

int main(int argc, char *argv[])
{
   CommandLine cmdline(argc, argv);

   std::cout << "Gen tool - Copyright 2014 - Jeroen Broekhuizen" << std::endl;

   if ( cmdline.size() == 0 )
   {
      // print help information
      std::cout << "Invalid arguments.";
   }
   else
   {
      const CommandLineArgument& argument = cmdline[0];
      ASSERT(argument.getType() == CommandLineArgument::eCommand);

      Generator* pgenerator = NULL;
      if ( argument.getName() == UTEXT("project") )
      {
         pgenerator = new ProjectGenerator();
      }
      else if ( argument.getName() == UTEXT("mod") )
      {
         pgenerator = new ModuleGenerator();
      }
      else if ( argument.getName() == UTEXT("class") )
      {
         pgenerator = new ClassGenerator();
      }
      else
      {
         std::cerr << argument.getName().toUtf8() << " is not a valid target.";
         return -1;
      }

      if ( !pgenerator->generate(cmdline) )
      {
         return -2;
      }
   }

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

示例6: generate

QString GeneratorSetD::generate() {

    // Ui conversion...
    if (do_ui_convert) {
        UiConverter converter;
        converter.setClasses(builder.classes());
        converter.convertToJui(ui_file_name, custom_widgets);
        return 0;
    } else if (!custom_widgets.isEmpty()) {
        fprintf(stderr, "NOTE: The --custom-widgets option only has an effect when used with --convert-to-jui");
    }

    // Code generation
    QList<Generator *> generators;
    PriGenerator *priGenerator = new PriGenerator;
    ContainerGenerator *cointainerGenerator;
    DGenerator *d_generator = 0;
    CppHeaderGenerator *cpp_header_generator = 0;
    CppImplGenerator *cpp_impl_generator = 0;
    MetaInfoGenerator *metainfo = 0;
    JumpTablePreprocessor *jumpTablePreprocessor = 0;
    JumpTableGenerator *jumpTableGenerator = 0;

    ClassFromEntry::construct(builder.classes());

    QStringList contexts;
    if (build_qdoc_japi) {
        generators << new QDocGenerator;
        contexts << "QDocGenerator";
    }

    if (native_jump_table) {
        jumpTablePreprocessor = new JumpTablePreprocessor();
        generators << jumpTablePreprocessor;
        contexts << "JumpTablePreprocessor";
    }

    if (!no_d) {
        d_generator = new DGenerator;
        d_generator->setDocumentationDirectory(doc_dir);
        d_generator->setDocumentationEnabled(docs_enabled);
        d_generator->setNativeJumpTable(native_jump_table);
        generators << d_generator;

        contexts << "JavaGenerator";
    }

    if (!no_cpp_h) {
        cpp_header_generator = new CppHeaderGenerator(priGenerator);
        generators << cpp_header_generator;
        contexts << "CppHeaderGenerator";
    }

    if (!no_cpp_impl) {
        cpp_impl_generator = new CppImplGenerator(priGenerator);
        cpp_impl_generator->setNativeJumpTable(native_jump_table);
        generators << cpp_impl_generator;
        contexts << "CppImplGenerator";
    }

    if (native_jump_table) {
        jumpTableGenerator = new JumpTableGenerator(jumpTablePreprocessor, priGenerator);
        generators << jumpTableGenerator;
        contexts << "JumpTableGenerator";
    }

    if (!no_metainfo) {
        metainfo = new MetaInfoGenerator(priGenerator);
        generators << metainfo;
        contexts << "MetaInfoGenerator";
    }

    if (build_class_list) {
        generators << new ClassListGenerator;
        contexts << "ClassListGenerator";
    }

    cointainerGenerator = new ContainerGenerator(cpp_impl_generator);


    generators << priGenerator;
    contexts << "PriGenerator";

    generators << cointainerGenerator;
    contexts << "cointainerGenerator";

    for (int i=0; i<generators.size(); ++i) {
        Generator *generator = generators.at(i);
        ReportHandler::setContext(contexts.at(i));

        generator->setOutputDirectory(outDir);
        generator->setClasses(builder.classes());
        if (printStdout)
            generator->printClasses();
        else
            generator->generate();
    }

    QString res;
    res = QString("Classes in typesystem: %1\n"
//.........这里部分代码省略.........
开发者ID:FrankLIKE,项目名称:qtd,代码行数:101,代码来源:generatorsetd.cpp

示例7: main

int main(int argc, char ** argv, char** envp) {

    // Global return code
    int returnCode = 0;

    string st;
    string s;
    bool c1;
    bool c2;
    bool c3;

    if (argc < 7) {
        cmdsyntaxerror();
        return -1;
    } else {

        // Determine arguments
        //-----------------------
        QStringList includeArgs;
        string projectFile;
        string vhdlDestination;
        string vplanDestination;
        string fsmToGenerate;
        bool generateMap = false;
        bool useVerilogGenerator2 = false;
        bool genverilog1RemoveIntersections = false;
        bool errorForce = false;
        bool noChecks = false;

        for (int i = 1; i < argc; i++) {

            // Project file
            if (strcmp(argv[i], "-p") == 0) {
                projectFile.append(argv[++i]);
            } else if (strcmp(argv[i], "-vhdl") == 0) {
                vhdlDestination.append(argv[++i]);
            } else if (strcmp(argv[i], "-vplan") == 0) {
                vplanDestination.append(argv[++i]);
            } else if (strcmp(argv[i], "-fsm") == 0) {
                fsmToGenerate.append(argv[++i]);
            } else if (strcmp(argv[i], "-fmap") == 0) {
                generateMap = true;
            }  else if (strcmp(argv[i], "-force") == 0) {

                errorForce = true;
            } else if (strcmp(argv[i], "-noChecks") == 0) {

                noChecks = true;
            }


        }

        // Verify all arguments where provided
        //------------
        if (projectFile.size() == 0 || fsmToGenerate.size() == 0) {
            cmdsyntaxerror();
            return -1;
        }

        // OK Proceed to generation
        //----------------------------

        //-- Load FSMs
        LoadFactory::getLoad_I().load(projectFile);

        //-- Find the right one
        Core& core = *(Core::getInstance());
        Fsm * fsm = core.getProject()->findFSM(fsmToGenerate);

        // Not found -> fail
        if (fsm == NULL) {
            cerr << "FSM to generate " << fsmToGenerate
                    << " doesn't exist in the project file" << endl;
            cmdsyntaxerror();
            return -1;
        }

        //-- Register Verilog Generator
        GeneratorFactory::getInstance()->registerGenerator("VHDL",
                new VHDLGenerator());
        GeneratorFactory::getInstance()->registerGenerator("Simvision_Mmap",new SimvisionMmapGenerator());
        GeneratorFactory::getInstance()->registerGenerator("VPlan",new VerificationPlanGenerator());

        //-- Generate Verilog
        //------------
        if (vhdlDestination.size() > 0) {

            //-- Create Generator and generate
            Generator * generator = GeneratorFactory::getInstance()->newGenerator("VHDL");
            if (generator == NULL) {
                cerr
                        << "There are no Generator registered under the 'VHDL' name. No VHDL can generated"
                        << endl;
                return -1;
            }

            //-- Set Parameters

            //-- Open File
//.........这里部分代码省略.........
开发者ID:unihd-cag,项目名称:fsmdesigner,代码行数:101,代码来源:fsmdesignerGenVHDL.cpp

示例8: generate

QString GeneratorSetDylan::generate() {

    // Code generation
    QList<Generator *> generators;
    LibraryGenerator *libraryGenerator = new LibraryGenerator;
    LidGenerator *lidGenerator = new LidGenerator;
    DylanGenerator *dylan_generator = 0;
    PlainCppHeaderGenerator *cpp_header_generator = 0;
    PlainCppImplGenerator *cpp_impl_generator = 0;

    QStringList contexts;

    dylan_generator = new DylanGenerator(libraryGenerator, lidGenerator);
    if (!javaOutDir.isNull())
        dylan_generator->setDylanOutputDirectory(javaOutDir);
    if (!outDir.isNull())
        dylan_generator->setLogOutputDirectory(outDir);
    generators << dylan_generator;

    contexts << "DylanGenerator";

    cpp_header_generator = new PlainCppHeaderGenerator(lidGenerator);
    if (!cppOutDir.isNull())
        cpp_header_generator->setCppOutputDirectory(cppOutDir);
    generators << cpp_header_generator;
    contexts << "PlainCppHeaderGenerator";

    cpp_impl_generator = new PlainCppImplGenerator(lidGenerator);
    if (!cppOutDir.isNull())
        cpp_impl_generator->setCppOutputDirectory(cppOutDir);
    generators << cpp_impl_generator;
    contexts << "PlainCppImplGenerator";

    if (!cppOutDir.isNull())
        lidGenerator->setCppOutputDirectory(cppOutDir);
    generators << lidGenerator;
    contexts << "LidGenerator";

    if (!cppOutDir.isNull())
        libraryGenerator->setOutputDirectory(cppOutDir);
    generators << libraryGenerator;
    contexts << "LibraryGenerator";

    for (int i = 0; i < generators.size(); ++i) {
        Generator *generator = generators.at(i);
        ReportHandler::setContext(contexts.at(i));

        if (generator->outputDirectory().isNull())
            generator->setOutputDirectory(outDir);
        generator->setClasses(builder.classes());
        if (printStdout)
            generator->printClasses();
        else
            generator->generate();
    }

    QString res;
    res = QString("Classes in typesystem: %1\n"
                  "Generated:\n"
                  "  - dylan.....: %2 (%3)\n"
                  "  - cpp-impl..: %4 (%5)\n"
                  "  - cpp-h.....: %6 (%7)\n"
                  "  - library...: %8 (%9)\n"
                  "  - lid.......: %10 (%11)\n"
                 )
          .arg(builder.classes().size())
          .arg(dylan_generator ? dylan_generator->numGenerated() : 0)
          .arg(dylan_generator ? dylan_generator->numGeneratedAndWritten() : 0)
          .arg(cpp_impl_generator ? cpp_impl_generator->numGenerated() : 0)
          .arg(cpp_impl_generator ? cpp_impl_generator->numGeneratedAndWritten() : 0)
          .arg(cpp_header_generator ? cpp_header_generator->numGenerated() : 0)
          .arg(cpp_header_generator ? cpp_header_generator->numGeneratedAndWritten() : 0)
          .arg(libraryGenerator->numGenerated())
          .arg(libraryGenerator->numGeneratedAndWritten())
          .arg(lidGenerator->numGenerated())
          .arg(lidGenerator->numGeneratedAndWritten());

    return res;
}
开发者ID:qt-generator,项目名称:qt-generator,代码行数:79,代码来源:generatorsetdylan.cpp


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