• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ arguments类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: do_append

void binary::do_append(arguments &arg) {
  vector_type &out = v_data;
  for (arguments::iterator it = arg.begin(); it != arg.end(); ++it) {
    value el = *it;
    if (el.is_int()) {
      int x = el.get_int();
      if (x < 0 || x > 255)
        throw exception("Outside byte range", "Range error");
      out.push_back(element_type(x));
    } else if (el.is_object()) {
      object o = el.get_object();
      if (o.is_array()) {
        array a(o);
        std::size_t n = a.length();
        out.reserve(out.size() + n);
        for (std::size_t i = 0; i < n; ++i) {
          value v = a.get_element(i);
          if (!v.is_int())
            throw exception("Must be Array of Numbers");
          int x = v.get_int();
          if (x < 0 || x > 255)
            throw exception("Outside byte range", "RangeError");
          out.push_back(element_type(x));
        }
      } else {
        binary &x = flusspferd::get_native<binary>(o);
        out.insert(out.end(), x.v_data.begin(), x.v_data.end());
      }
    }
  }
}
开发者ID:Flusspferd,项目名称:flusspferd,代码行数:31,代码来源:binary.cpp


示例2: BrdfSlice

		BrdfSlice(const arguments& args,
              int width, int height, int slice,
              double* content)
        : data(brdf_slice_parameters(args),
               width * height * slice),
          _width(width), _height(height), _slice(slice),
          _data(content)
		{
			// Allocate data
      if (args.is_defined("param") && parametrization().dimX() == 3)
          _phi = (M_PI / 180.0) * args.get_float("phi", 90);
      else
          _phi = 0.5*M_PI;

			// Is the position of the slice componnent (third coordinate)
			// reversed? This ensure that some params can be displayed.
      auto in_param = parametrization().input_parametrization();
			_reverse = in_param == params::ISOTROPIC_TL_TV_PROJ_DPHI ||
          in_param == params::SCHLICK_TL_TK_PROJ_DPHI   ||
          in_param == params::RETRO_TL_TVL_PROJ_DPHI;

			// Update the domain
			_max = max();
			_min = min();
		}
开发者ID:belcour,项目名称:alta,代码行数:25,代码来源:slice.cpp


示例3: set_parameters

void rational_fitter_parsec_multi::set_parameters(const arguments& args)
{
    _max_np = args.get_float("np", 10);
    _max_nq = args.get_float("nq", _max_np);
    _min_np = args.get_float("min-np", _max_np);
    _min_nq = args.get_float("min-nq", _min_np);
 
    _max_np = std::max<int>(_max_np, _min_np);
    _max_nq = std::max<int>(_max_nq, _min_nq);
    
    _boundary = args.get_float("boundary-constraint", 1.0f);
    _nbcores = args.get_int( "nbcores", 2 );
    _args = &args;

    {
	int argc = 1;
	char **argv = (char**)malloc((argc+1)*sizeof(char*));

	argv[0] = strdup( "./manao" );
	argv[1] = NULL;

	_dague = dague_init(_nbcores, &argc, &argv);

	free(argv[0]);
	free(argv);
    }
}
开发者ID:belcour,项目名称:alta,代码行数:27,代码来源:rational_fitter.cpp


示例4: call

        bool call(const arguments & args_, std::string & result) {
            //LOG(INFO) << "Calling [" << args_.as_string(0) << "]";

            if (_modules.find(args_.as_string(0)) == _modules.end()) {
                return false;
            }

            result = "";
            result.resize(4096);

            std::string function_str;
            std::vector<std::string> temp = ace::split(args_.get(), ',');

            if (temp.size() < 3) {
                function_str = temp[1];
            } else {
                for (int x = 1; x < temp.size(); x++)
                    function_str = function_str + temp[x] + ",";
            }
            _modules[args_.as_string(0)].function((char *)result.c_str(), 4096, (const char *)function_str.c_str());
#ifdef _DEBUG
            //if (args_.as_string(0) != "fetch_result" && args_.as_string(0) != "ready") {
            //    LOG(INFO) << "Called [" << args_.as_string(0) << "], with {" << function_str << "} result={" << result << "}";
            //}
#endif
            return true;
        }
开发者ID:AgentRev,项目名称:ACE3,代码行数:27,代码来源:dynloader.hpp


示例5: createFile

void FileSystem::createFile(arguments str, outputStream out)
{
    checkArgumentsCount(str, 2);
    std::ofstream::pos_type  size = std::stoll(str.at(1));     // 1234asd321 -> 1234, its ok?
    if(_fsFile->create(str.at(0), size)) {
        out << "File created";
    } else {
        out << "file not created";
    }
    out << "\n";
}
开发者ID:valsid,项目名称:FileSystemForFile,代码行数:11,代码来源:filesystem.cpp


示例6: load

        bool load(const arguments & args_, std::string & result) {
            HMODULE dllHandle;
            RVExtension function;

            LOG(INFO) << "Load requested [" << args_.as_string(0) << "]";

            if (_modules.find(args_.as_string(0)) != _modules.end()) {
                LOG(ERROR) << "Module already loaded [" << args_.as_string(0) << "]";
                return true;
            }

#ifdef _WINDOWS
            // Make a copy of the file to temp, and load it from there, referencing the current path name
            char tmpPath[MAX_PATH +1], buffer[MAX_PATH + 1];

            if(!GetTempPathA(MAX_PATH, tmpPath)) {
                LOG(ERROR) << "GetTempPath() failed, e=" << GetLastError();
                return false;
            }
            if(!GetTempFileNameA(tmpPath, "ace_dynload", TRUE, buffer)) {
                LOG(ERROR) << "GetTempFileName() failed, e=" << GetLastError();
                return false;
            }
            std::string temp_filename = buffer;
            if (!CopyFileA(args_.as_string(0).c_str(), temp_filename.c_str(), FALSE)) {
                DeleteFile(temp_filename.c_str());
                if (!CopyFileA(args_.as_string(0).c_str(), temp_filename.c_str(), FALSE)) {
                    LOG(ERROR) << "CopyFile() , e=" << GetLastError();
                    return false;
                }
            }
#else
            std::string temp_filename = args_.as_string(0);
#endif

            dllHandle = LoadLibrary(temp_filename.c_str());
            if (!dllHandle) {
                LOG(ERROR) << "LoadLibrary() failed, e=" << GetLastError() << " [" << args_.as_string(0) << "]";
                return false;
            }

            function = (RVExtension)GetProcAddress(dllHandle, "[email protected]");
            if (!function) {
                LOG(ERROR) << "GetProcAddress() failed, e=" << GetLastError() << " [" << args_.as_string(0) << "]";
                FreeLibrary(dllHandle);
                return false;
            }

            LOG(INFO) << "Load completed [" << args_.as_string(0) << "]";

            _modules[args_.as_string(0)] = module(args_.as_string(0), dllHandle, function, temp_filename);

            return false;
        }
开发者ID:AgentRev,项目名称:ACE3,代码行数:54,代码来源:dynloader.hpp


示例7: cd

void FileSystem::cd(arguments arg)
{
    checkArgumentsCount(arg, 1);
    _currentFolder = getLastPathElementHandle(arg.at(0))
            .descriptorHandle();
//    auto v = p.getParsedPath();
}
开发者ID:valsid,项目名称:FileSystemForFile,代码行数:7,代码来源:filesystem.cpp


示例8: debug_script

void debug_script( const arguments &args )
{
    const path script( absolute( path( args[ 2 ] ), cwd() ) );

    Config config( get_config() );

    const string exe( get_executable( config, script, debug ).string() );

    const string debug_script( debug_script_path( config, script ).string() );

    ofstream stream( debug_script.c_str() );

    stream << "file " << exe << endl
                 << "r ";
    for ( size_t i = 3; i < args.size(); ++i )
    {
        stream << args[ i ] << ' ';
    }
    stream << endl << "q" << endl;

    stream.close();

    // for some reason, lldb won't start in execv
    exit( system( ( config.debugCommand() + " -s " + debug_script ).c_str() ) );
//	execv( config.debugCommand().c_str(), argv + 1 );
}
开发者ID:arjanhouben,项目名称:nativescript,代码行数:26,代码来源:nativescript.cpp


示例9: filestat

void FileSystem::filestat(arguments arg, outputStream out)
{
    checkArgumentsCount(arg, 1);
    uint64_t descriptorId = std::stoll(arg.at(0));

    FSDescriptor descriptor;
    try {
        descriptor = _descriptors.getDescriptor(descriptorId);
    } catch(const std::invalid_argument &) {
        out << "Bad descriptor\n";
        return;
    }

    if(descriptor.type == DescriptorVariant::None) {
        out << "Descriptor does not exist\n";
        return;
    }

    using std::to_string;

    out << "File statistic: \n\tid: " << descriptorId;
    if(descriptor.type == DescriptorVariant::File) {
        out << descriptor.fileSize;
    }
    out << "\n\tType: "     << to_string(descriptor.type) <<
           "\n\tReferences: " << descriptor.referencesCount <<
           "\n\tHas extended blocks: " << (descriptor.nextDataSegment == Constants::HEADER_ADDRESS() ? "false" : "true") << "\n";
}
开发者ID:valsid,项目名称:FileSystemForFile,代码行数:28,代码来源:filesystem.cpp


示例10: brdf_slice_parameters

// Allow for a different parametrization depending on the arguments provided.
static const alta::parameters
brdf_slice_parameters(const arguments& args)
{
    auto result = alta::parameters(2, 3,
                                   params::STARK_2D, params::RGB_COLOR);

    if(args.is_defined("param")) {
				params::input param = params::parse_input(args["param"]);

				// The param is a 2D param
				if(params::dimension(param) == 2) {
            std::cout << "<<INFO>> Specified param \"" << args["param"] << "\"" << std::endl;
            result = alta::parameters(result.dimX(), result.dimY(),
                                      param, result.output_parametrization());

            // The oaram is a 3D param
				} else if(params::dimension(param) == 3) {
            std::cout << "<<INFO>> Specified param \"" << args["param"] << "\"" << std::endl;
            result = alta::parameters(3, result.dimY(),
                                      param, result.output_parametrization());

				} else {
            std::cout << "<<ERROR>> Invalid specified param \"" << args["param"] << "\"" << std::endl;
            std::cout << "<<ERROR>> Must have 2D input dimension" << std::endl;
				}
    }

    return result;
}
开发者ID:belcour,项目名称:alta,代码行数:30,代码来源:slice.cpp


示例11: call

        bool call(const std::string & name_, arguments & args_, std::string & result_, bool threaded) {
            if (_methods.find(name_) == _methods.end()) {
                // @TODO: Exceptions
                return false;
            }
            if (threaded) {
                std::lock_guard<std::mutex> lock(_messages_lock);
                _messages.push(dispatch_message(name_, args_, _message_id));
                
                // @TODO: We should provide an interface for this serialization.
                std::stringstream ss;
                ss << "[\"result_id\", " << _message_id << "]";
                result_ = ss.str();

                _message_id = _message_id + 1;
            } else {
#ifdef _DEBUG
                if (name_ != "fetch_result") {
                    LOG(TRACE) << "dispatch[immediate]:\t[" << name_ << "] { " << args_.get() << " }";
                }
#endif
                return dispatcher::call(name_, args_, result_);
            }

            return true;
        }
开发者ID:IDI-Systems,项目名称:acre2,代码行数:26,代码来源:dispatch.hpp


示例12: create

void FileSystem::create(arguments arg)
{
    checkArgumentsCount(arg, 1);
    FSDescriptor fileDescriptor;
    fileDescriptor.initFile();
    allocAndAppendDescriptorToCurrentFolder(fileDescriptor, arg.at(0));
}
开发者ID:valsid,项目名称:FileSystemForFile,代码行数:7,代码来源:filesystem.cpp


示例13: mkdir

void FileSystem::mkdir(arguments arg)
{
    checkArgumentsCount(arg, 1);
    FSDescriptor fileDescriptor;
    fileDescriptor.initDirectory(currentDirectory());
    string name = arg.at(0);
    allocAndAppendDescriptorToCurrentFolder(fileDescriptor, name);
}
开发者ID:valsid,项目名称:FileSystemForFile,代码行数:8,代码来源:filesystem.cpp


示例14: standard_arguments

void fostlib::standard_arguments(
    const loaded_settings &settings,
    ostream &out,
    arguments &args
) {
    args.commandSwitch( L"b", settings.name, L"Banner" );
    if ( settings.c_banner.value() )
        out << settings.banner << std::endl;

    args.commandSwitch( L"s", settings.name, L"Settings" );
    if ( settings.c_settings.value() )
        setting< json >::printAllOn( out );

    args.commandSwitch( L"e", settings.name, L"Environment" );
    if ( settings.c_environment.value() )
        args.printOn( out );
}
开发者ID:KayEss,项目名称:fost-base,代码行数:17,代码来源:main_exec.cpp


示例15: mount

void FileSystem::mount(arguments str)
{
    checkArgumentsCount(str, 1);
    _fsFile->open(str.at(0));
    if(_fsFile->isFormatedFS()) {
        fileFormatChanged();
    } else {
    }
}
开发者ID:valsid,项目名称:FileSystemForFile,代码行数:9,代码来源:filesystem.cpp


示例16: rmdir

void FileSystem::rmdir(arguments arg, outputStream out)
{
    checkArgumentsCount(arg, 1);
    string name = arg.at(0);
    if(removeDescriptorFromDirectory(currentDirectory(), DescriptorVariant::Directory, name)) {
        out << "Directory deleted\n";
    } else {
        out << "Directory not found\n";
    }
}
开发者ID:valsid,项目名称:FileSystemForFile,代码行数:10,代码来源:filesystem.cpp


示例17: unlink

void FileSystem::unlink(arguments arg, outputStream out)
{
    checkArgumentsCount(arg, 1);
    string name = arg.at(0);
    descriptorIndex_tp dir = currentDirectory();
    if(removeDescriptorFromDirectory(dir, DescriptorVariant::File | DescriptorVariant::SymLink, name)) {
        out << "Descriptor deleted\n";
    } else {
        out << "Descriptor not found\n";
    }
}
开发者ID:valsid,项目名称:FileSystemForFile,代码行数:11,代码来源:filesystem.cpp


示例18: close

void FileSystem::close(arguments arg)
{
    checkArgumentsCount(arg, 1);
    uint64_t openedDescriptor = std::stoull(arg.at(1));

    auto findResult = _opennedFiles.find(openedDescriptor);
    if(findResult  == _opennedFiles.end()) {
        throw file_system_exception("Descriptor currently not open.");
    } else {
        _opennedFiles.erase(findResult);
    }
}
开发者ID:valsid,项目名称:FileSystemForFile,代码行数:12,代码来源:filesystem.cpp


示例19: link

void FileSystem::link(arguments arg)
{
    checkArgumentsCount(arg, 2);
    string srcName  = arg.at(0);
    string destName = arg.at(1);

    descriptorIndex_tp destDir = currentDirectory();

    descriptorIndex_tp srcDir = currentDirectory();
    auto it = getDirectoryDescriptorIterator(srcDir);
    while(it.hasNext()) {
        ++it;
        if(it->name(header().filenameLength) == srcName) {
            addDescriptorToDirectory(destDir, it->descriptor, destName);
        }
    }
}
开发者ID:valsid,项目名称:FileSystemForFile,代码行数:17,代码来源:filesystem.cpp


示例20: unload

        bool unload(const arguments & args_, std::string & result) {

            LOG(INFO) << "Unload requested [" << args_.as_string(0) << "]";

            if (_modules.find(args_.as_string(0)) == _modules.end()) {
                LOG(INFO) << "Unload failed, module not loaded [" << args_.as_string(0) << "]";
                return true;
            }

            if (!FreeLibrary(_modules[args_.as_string(0)].handle)) {
                LOG(INFO) << "FreeLibrary() failed during unload, e=" << GetLastError();
                return false;
            }
            //if (!DeleteFileA(_modules[args_.as_string(0)].temp_filename.c_str())) {
            //    LOG(INFO) << "DeleteFile() failed during unload, e=" << GetLastError();
            //    return false;
            //}

            _modules.erase(args_.as_string(0));

            LOG(INFO) << "Unload complete [" << args_.as_string(0) << "]";

            return true;
        }
开发者ID:AgentRev,项目名称:ACE3,代码行数:24,代码来源:dynloader.hpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ arith_util类代码示例发布时间:2022-05-31
下一篇:
C++ argument_type类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap