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

C++ description函数代码示例

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

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



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

示例1: description

  bool OBMoleculeFormat::ReadChemObjectImpl(OBConversion* pConv, OBFormat* pFormat)
  {
    std::istream &ifs = *pConv->GetInStream();
    if (!ifs.good()) //Possible to omit? ifs.peek() == EOF || 
      return false;

    OBMol* pmol = new OBMol;

    std::string auditMsg = "OpenBabel::Read molecule ";
    std::string description(pFormat->Description());
    auditMsg += description.substr(0,description.find('\n'));
    obErrorLog.ThrowError(__FUNCTION__,
                          auditMsg,
                          obAuditMsg);

    if(pConv->IsOption("C",OBConversion::GENOPTIONS))
      return DeferMolOutput(pmol, pConv, pFormat);

    bool ret;
   if(pConv->IsOption("separate",OBConversion::GENOPTIONS))
   {
     //On first call, separate molecule and put fragments in MolArray.
     //On subsequent calls, remove a fragment from MolArray and send it for writing
     //Done this way so that each fragment can be written to its own file (with -m option)
     if(!StoredMolsReady)
     {
       ret = pFormat->ReadMolecule(pmol,pConv); 
       if(ret && (pmol->NumAtoms() > 0 || (pFormat->Flags()&ZEROATOMSOK)))
         MolArray = pmol->Separate(); //use un-transformed molecule
       //Add an appropriate title to each fragment
       for(int i=0;i<MolArray.size();++i)
       {
         stringstream ss;
         ss << pmol->GetTitle() << '#' << i+1;
         string title = ss.str();
         MolArray[i].SetTitle(title);
       }
       reverse(MolArray.begin(),MolArray.end());
       StoredMolsReady = true;
       //Clear the flags of the input stream(which may have found eof) to ensure will
       //try to read anothe molecule and allow the stored ones to be sent for output.
       pConv->GetInStream()->clear();
     }

     if(MolArray.empty()) //normal end of fragments
       ret =false;
     else
     {
       // Copying is needed because the OBMol passed to AddChemObject will be deleted.
       // The OBMol in the vector is deleted here.
       OBMol* pMolCopy = new OBMol( MolArray.back());
       MolArray.pop_back();
       ret = pConv->AddChemObject(
           pMolCopy->DoTransformations(pConv->GetOptions(OBConversion::GENOPTIONS)))!=0;
     }
     if(!ret)
       StoredMolsReady = false;

     delete pmol;
     return ret;
   }

    ret=pFormat->ReadMolecule(pmol,pConv); 

    OBMol* ptmol = NULL;
    //Molecule is valid if it has some atoms 
    //or the format allows zero-atom molecules and it has a title
    if(ret && (pmol->NumAtoms() > 0 || (pFormat->Flags()&ZEROATOMSOK && *pmol->GetTitle())))
    {
      ptmol = static_cast<OBMol*>(pmol->DoTransformations(pConv->GetOptions(OBConversion::GENOPTIONS)));
      if(ptmol && (pConv->IsOption("j",OBConversion::GENOPTIONS) 
                || pConv->IsOption("join",OBConversion::GENOPTIONS)))
      {
        //With j option, accumulate all mols in one stored in this class
        if(pConv->IsFirstInput())
          _jmol = new OBMol;
        pConv->AddChemObject(_jmol);
        //will be discarded in WriteChemObjectImpl until the last input mol. This complication
        //is needed to allow joined molecules to be from different files. pOb1 in AddChem Object
        //is zeroed at the end of a file and _jmol is in danger of not being output.
        *_jmol += *ptmol;
        delete ptmol;
        return true;
      }
    }
    else
      delete pmol;

    // Normal operation - send molecule to be written
    ret = ret && (pConv->AddChemObject(ptmol)!=0); //success of both writing and reading
    return ret;
  }
开发者ID:baoilleach,项目名称:obstereo-2-2-x,代码行数:92,代码来源:obmolecformat.cpp


示例2: getDescriptionCallback

static JSValueRef getDescriptionCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
{
    JSRetainPtr<JSStringRef> description(Adopt, toAXElement(thisObject)->description());
    return JSValueMakeString(context, description.get());
}
开发者ID:acss,项目名称:owb-mirror,代码行数:5,代码来源:AccessibilityUIElement.cpp


示例3: description

LinearAdv2D::LinearAdv2D(const std::string& name) : VariablesT<LinearAdv2D>(name)
{
  description().set_variables("U",MODEL::_ndim);
}
开发者ID:Peita,项目名称:coolfluid3,代码行数:4,代码来源:LinearAdv2D.cpp


示例4: main

// Entry Point
int main(int argc,	char* argv[])
{  
    bool verbose = false;
    std::vector<std::string> material_fields;
    std::string output_path = kDefaultOutputName;
    double scale      = kDefaultScale;
    double lipschitz  = kDefaultLipschitz;
    double multiplier = kDefaultMultiplier;
    int    padding    = kDefaultPadding;

    //-------------------------------
    //  Parse Command Line Params
    //-------------------------------
    try{
        po::options_description description("Command line flags");
        description.add_options()
                ("help,h", "display help message")
                ("verbose,v", "enable verbose output")
                ("version", "display version information")
                ("material_fields", po::value<std::vector<std::string> >()->multitoken(), "material field paths")
                ("grading", po::value<double>(&lipschitz)->default_value(kDefaultLipschitz, kDefaultLipschitzString), "sizing field grading")
                ("multiplier", po::value<double>(&multiplier)->default_value(kDefaultMultiplier), "sizing field multiplier")
                ("scale", po::value<double>(&scale)->default_value(kDefaultScale), "sizing field scale")
                ("output", po::value<std::string>()->default_value(kDefaultOutputName, "sizingfield"), "output path")
                ("padding", po::value<int>()->default_value(kDefaultPadding), "padding")
        ;

        boost::program_options::variables_map variables_map;
        boost::program_options::store(boost::program_options::parse_command_line(argc, argv, description), variables_map);
        boost::program_options::notify(variables_map);

        // print version info
        if (variables_map.count("version")) {
            std::cout << cleaver::Version << std::endl;
            return 0;
        }
        // print help
        else if (variables_map.count("help") || (argc ==1)) {
            std::cout << description << std::endl;
            return 0;
        }

        // enable verbose mode
        if (variables_map.count("verbose")) {
            verbose = true;
        }

        // parse the material field input file names
        if (variables_map.count("material_fields")) {
            material_fields = variables_map["material_fields"].as<std::vector<std::string> >();
            int file_count = material_fields.size();
        }
        else{
            std::cout << "Error: At least one material field file must be specified." << std::endl;
            return 0;
        }       

        // set output path
        if (variables_map.count("output")) {
            output_path = variables_map["output"].as<std::string>();
        }
    }
    catch (std::exception& e) {
        std::cerr << "Error: " << e.what() << std::endl;
        return 0;
    }
    catch(...) {
        std::cerr << "Unhandled exception caught. Terminating." << std::endl;
        return 0;
    }

    //-----------------------------------
    //  Load Data & Construct  Volume
    //-----------------------------------
    std::cout << " Loading input fields:" << std::endl;
    for (size_t i=0; i < material_fields.size(); i++) {
        std::cout << " - " << material_fields[i] << std::endl;
    }

    std::vector<cleaver::AbstractScalarField*> fields = NRRDTools::loadNRRDFiles(material_fields);
    if(fields.empty()){
        std::cerr << "Failed to load image data. Terminating." << std::endl;
        return 0;
    }
    else if(fields.size() == 1) {
        fields.push_back(new cleaver::InverseScalarField(fields[0]));
    }

    cleaver::Volume *volume = new cleaver::Volume(fields);

    //------------------------------------------------------------
    // Construct Sizing Field
    //------------------------------------------------------------
    cleaver::FloatField *sizingField =
            cleaver::SizingFieldCreator::createSizingFieldFromVolume(
                volume,
                (float)(1.0/lipschitz),
                (float)scale,
                (float)multiplier,
//.........这里部分代码省略.........
开发者ID:zaracay,项目名称:Cleaver2,代码行数:101,代码来源:main.cpp


示例5: dprintf

void
SwapClaimsMsg::cancelMessage(char const *reason) {
	dprintf(D_ALWAYS,"Canceling swap claims request for claim %s %s\n", description(),reason ? reason : "");
	DCMsg::cancelMessage(reason);
}
开发者ID:zzxuanyuan,项目名称:htcondor,代码行数:5,代码来源:dc_startd.cpp


示例6: main

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

	int resultCode = EXIT_SUCCESS;

	std::string input;
	std::string output;
	unsigned int iterations;

	boost::program_options::options_description description( "Allowed options" );
	description.add_options()
		( "help,h", "display this help" )
		( "input,i", boost::program_options::value< std::string >( &input ), "input model file" )
		( "output,o", boost::program_options::value< std::string >( &output ), "output model file" )
		( "iterations,n", boost::program_options::value< unsigned int >( &iterations ), "number of iterations" )
	;

	try {

		boost::program_options::variables_map variables;
		boost::program_options::store( boost::program_options::command_line_parser( argc, argv ).options( description ).run(), variables );
		boost::program_options::notify( variables );

		if ( variables.count( "help" ) ) {

			std::cout <<
				"Optimizes the SVM problem contained in the input model file, saving the result" << std::endl <<
				"to the output model file. Optimization will continue until the maximum number" << std::endl <<
				"of iterations has been exceeded." << std::endl <<
				std::endl <<
				description << std::endl;
		}
		else {

			if ( ! variables.count( "input" ) )
				throw std::runtime_error( "You must provide an input file" );
			if ( ! variables.count( "output" ) )
				throw std::runtime_error( "You must provide an output file" );
			if ( ! variables.count( "iterations" ) )
				throw std::runtime_error( "You must provide an iterations parameter" );

			boost::shared_ptr< SVM::Optimizer::Base > pOptimizer;
			{	std::ifstream inputFile( input.c_str(), std::ios::in | std::ios::binary );
				if ( inputFile.fail() )
					throw std::runtime_error( "Unable to open input file" );
				boost::iostreams::filtering_streambuf< boost::iostreams::input > inputStream;
				inputStream.push( inputFile );
				boost::archive::binary_iarchive inputArchive( inputStream );
				inputArchive >> pOptimizer;
			}

			Random::Generator::LaggedFibonacci4<> generator;
			{	Random::Generator::LinearCongruential<> seedGenerator;
				seedGenerator.Seed();
				generator.Seed( seedGenerator );
			}

			for ( unsigned int ii = 0; ii < iterations; ++ii ){
				pOptimizer->Iterate( generator );
				//std::cout << "1 IT" << std::endl;
			}

			{	std::ofstream outputFile( output.c_str(), std::ios::out | std::ios::binary | std::ios::trunc );
				if ( outputFile.fail() )
					throw std::runtime_error( "Unable to open output file" );
				boost::iostreams::filtering_streambuf< boost::iostreams::output > outputStream;
				outputStream.push( outputFile );
				boost::archive::binary_oarchive outputArchive( outputStream );
				outputArchive << pOptimizer;
			}

			pOptimizer->WriteSupport(output+"-SupportSet.txt");
		}
	}
	catch( std::exception& error ) {

		std::cerr << "Error: " << error.what() << std::endl << std::endl << description << std::endl;
		resultCode = EXIT_FAILURE;
	}

	return resultCode;
}
开发者ID:maliq,项目名称:issvm,代码行数:81,代码来源:issvm_optimize.cpp


示例7: main

int main(int argc, char* argv[])
{
    try
    {
        unsigned int size;
        double wait_after_connect = 0.0;
        std::size_t hwm;
        std::string server;
        boost::program_options::options_description description( "options" );
        description.add_options()
            ( "help,h", "display help message; --help --verbose for more help" )
            ( "publish", "use bind and publish (as opposed to connect and subscribe)" )
            ( "connect", "use connect instead of bind" )
            ( "bind", "use bind instead of connect" )
            ( "request", "request/reply client" )
            ( "reply", "request/reply server" )
            ( "size,s", boost::program_options::value< unsigned int >( &size ), "packet size in bytes, in publish, request, or reply mode; if not present, data is line-based ascii" )
            ( "buffer,b", boost::program_options::value< std::size_t >( &hwm )->default_value( 1024 ), "set buffer size in packets (high water mark in zmq)" )
            ( "server", boost::program_options::value< std::string >( &server ), "in subscribe mode, republish the data on a socket, eg tcp:1234" )
            ( "wait-after-connect,conwait", boost::program_options::value< double >( &wait_after_connect ), "time to wait, in seconds, after initial connection before attempting to read or write" )
            ( "quiet-interrupt", "suppress error messages due to interrupt" )
            ( "verbose,v", "more output" );

        boost::program_options::variables_map vm;
        boost::program_options::store( boost::program_options::parse_command_line( argc, argv, description), vm );
        boost::program_options::parsed_options parsed = boost::program_options::command_line_parser(argc, argv).options( description ).allow_unregistered().run();
        boost::program_options::notify( vm );
        if( vm.count( "help" ) )
        {
            usage( description, !vm.count( "verbose" ) );
            return 0;
        }
        const std::vector< std::string >& endpoints = boost::program_options::collect_unrecognized( parsed.options, boost::program_options::include_positional );
        if( endpoints.empty() ) { std::cerr << "zero-cat: please provide at least one endpoint" << std::endl; return 1; }
        bool binary = vm.count( "size" );
        quiet_interrupt = vm.count( "quiet-interrupt" );
        comma::signal_flag is_shutdown;
        zmq::context_t context( 1 );
        const bool is_request = vm.count( "request" );
        const bool is_reply = vm.count( "reply" );
        const bool is_publisher = bool( vm.count( "publish" ) );
        if( is_request + is_reply + is_publisher > 1 ) { std::cerr << "zero-cat: expected only one of: --publisher, --request, --reply; got " << ( is_request + is_reply + is_publisher ) << std::endl; return 1; }
        if( is_request || is_reply )
        {
            #ifdef WIN32
            if( binary ) { _setmode( _fileno( stdin ), _O_BINARY ); _setmode( _fileno( stdout ), _O_BINARY ); }
            #endif
            zmq::socket_t socket( context, is_request ? ZMQ_REQ : ZMQ_REP );
            #if ZMQ_VERSION_MAJOR == 2
            socket.setsockopt( ZMQ_HWM, &hwm, sizeof( hwm ) );
            #endif
            if( endpoints.size() != 1 ) { std::cerr << "zero-cat: request/reply server/client expected 1 endpoint, got " << endpoints.size() << ": " << comma::join( endpoints, ',' ) << std::endl; return 1; }
            if( is_request || vm.count( "connect" ) ) { socket.connect( &endpoints[0][0] ); }
            else if( is_reply || vm.count( "bind" ) ) { socket.bind( &endpoints[0][0] ); }
            if( is_request )
            {
                std::string buffer;
                if( binary ) { buffer.resize( size ); }
                while( !is_shutdown && std::cin.good() )
                {
                    
                    if( binary )
                    {
                        std::cin.read( &buffer[0], size );
                        int count = std::cin.gcount();
                        if( count == 0 ) { break; }
                        if( count < int( size ) ) { std::cerr << "zero-cat: expected " << size << " byte(s), got: " << count << std::endl; return 1; }
                    }
                    else
                    {
                        std::getline( std::cin, buffer );
                        if( buffer.empty() ) { break; }
                        buffer += endl;
                    }
                    zmq::message_t request( buffer.size() );
                    ::memcpy( ( void * )request.data(), &buffer[0], buffer.size() );
                    #if ZMQ_VERSION_MAJOR == 2
                    if( !socket.send( request ) ) { std::cerr << "zero-cat: failed to send " << buffer.size() << " bytes; zmq errno: EAGAIN" << std::endl; return 1; }
                    #else // ZMQ_VERSION_MAJOR == 2
                    if( !socket.send( &buffer[0], buffer.size() ) ) { std::cerr << "zero-cat: failed to send " << buffer.size() << " bytes; zmq errno: EAGAIN" << std::endl; return 1; }
                    #endif // ZMQ_VERSION_MAJOR == 2
                    zmq::message_t reply;
                    if( !socket.recv( &reply ) ) { break; }
                    std::cout.write( reinterpret_cast< const char* >( reply.data() ), reply.size() );
                    if( binary ) { std::cout.flush(); }
                }
            }
            else
            {
                std::string buffer;
                if( binary ) { buffer.resize( size ); }
                while( !is_shutdown && std::cin.good() )
                {
                    zmq::message_t request;
                    if( !socket.recv( &request ) ) { break; }
                    std::cout.write( reinterpret_cast< const char* >( request.data() ), request.size() );
                    if( binary ) { std::cout.flush(); }
                    if( binary )
                    {
                        std::cin.read( &buffer[0], size );
//.........这里部分代码省略.........
开发者ID:sheenzhaox,项目名称:comma,代码行数:101,代码来源:zero-cat.cpp


示例8: wxgtk_webview_webkit_error

static gboolean
wxgtk_webview_webkit_error(WebKitWebView*,
                           WebKitWebFrame*,
                           gchar *uri,
                           gpointer web_error,
                           wxWebViewWebKit* webKitWindow)
{
    webKitWindow->m_busy = false;
    wxWebViewNavigationError type = wxWEB_NAV_ERR_OTHER;

    GError* error = (GError*)web_error;
    wxString description(error->message, wxConvUTF8);

    if (strcmp(g_quark_to_string(error->domain), "soup_http_error_quark") == 0)
    {
        switch (error->code)
        {
            case SOUP_STATUS_CANCELLED:
                type = wxWEB_NAV_ERR_USER_CANCELLED;
                break;

            case SOUP_STATUS_CANT_RESOLVE:
            case SOUP_STATUS_NOT_FOUND:
                type = wxWEB_NAV_ERR_NOT_FOUND;
                break;

            case SOUP_STATUS_CANT_RESOLVE_PROXY:
            case SOUP_STATUS_CANT_CONNECT:
            case SOUP_STATUS_CANT_CONNECT_PROXY:
            case SOUP_STATUS_SSL_FAILED:
            case SOUP_STATUS_IO_ERROR:
                type = wxWEB_NAV_ERR_CONNECTION;
                break;

            case SOUP_STATUS_MALFORMED:
            //case SOUP_STATUS_TOO_MANY_REDIRECTS:
                type = wxWEB_NAV_ERR_REQUEST;
                break;

            //case SOUP_STATUS_NO_CONTENT:
            //case SOUP_STATUS_RESET_CONTENT:

            case SOUP_STATUS_BAD_REQUEST:
                type = wxWEB_NAV_ERR_REQUEST;
                break;

            case SOUP_STATUS_UNAUTHORIZED:
            case SOUP_STATUS_FORBIDDEN:
                type = wxWEB_NAV_ERR_AUTH;
                break;

            case SOUP_STATUS_METHOD_NOT_ALLOWED:
            case SOUP_STATUS_NOT_ACCEPTABLE:
                type = wxWEB_NAV_ERR_SECURITY;
                break;

            case SOUP_STATUS_PROXY_AUTHENTICATION_REQUIRED:
                type = wxWEB_NAV_ERR_AUTH;
                break;

            case SOUP_STATUS_REQUEST_TIMEOUT:
                type = wxWEB_NAV_ERR_CONNECTION;
                break;

            //case SOUP_STATUS_PAYMENT_REQUIRED:
            case SOUP_STATUS_REQUEST_ENTITY_TOO_LARGE:
            case SOUP_STATUS_REQUEST_URI_TOO_LONG:
            case SOUP_STATUS_UNSUPPORTED_MEDIA_TYPE:
                type = wxWEB_NAV_ERR_REQUEST;
                break;

            case SOUP_STATUS_BAD_GATEWAY:
            case SOUP_STATUS_SERVICE_UNAVAILABLE:
            case SOUP_STATUS_GATEWAY_TIMEOUT:
                type = wxWEB_NAV_ERR_CONNECTION;
                break;

            case SOUP_STATUS_HTTP_VERSION_NOT_SUPPORTED:
                type = wxWEB_NAV_ERR_REQUEST;
                break;
            //case SOUP_STATUS_INSUFFICIENT_STORAGE:
            //case SOUP_STATUS_NOT_EXTENDED:
        }
    }
    else if (strcmp(g_quark_to_string(error->domain),
                    "webkit-network-error-quark") == 0)
    {
        switch (error->code)
        {
            //WEBKIT_NETWORK_ERROR_FAILED:
            //WEBKIT_NETWORK_ERROR_TRANSPORT:

            case WEBKIT_NETWORK_ERROR_UNKNOWN_PROTOCOL:
                type = wxWEB_NAV_ERR_REQUEST;
                break;

            case WEBKIT_NETWORK_ERROR_CANCELLED:
                type = wxWEB_NAV_ERR_USER_CANCELLED;
                break;

//.........这里部分代码省略.........
开发者ID:Richard-Ni,项目名称:wxWidgets,代码行数:101,代码来源:webview_webkit.cpp


示例9: ndnsec_get_default

int
ndnsec_get_default(int argc, char** argv)
{
  namespace po = boost::program_options;

  bool wantDefaultKey = false;
  bool wantDefaultCert = false;
  bool isQuiet = false;
  Name identityName;
  Name keyName;

  po::options_description description(
    "Usage: ndnsec get-default [-h] [-k|-c] [-i ID|-K KEY] [-q]\n"
    "\n"
    "Options");
  description.add_options()
    ("help,h", "produce help message")
    ("default-key,k",  po::bool_switch(&wantDefaultKey), "show default key, instead of identity")
    ("default-cert,c", po::bool_switch(&wantDefaultCert), "show default certificate, instead of identity")
    ("identity,i",     po::value<Name>(&identityName), "target identity")
    ("key,K",          po::value<Name>(&keyName), "target key")
    ("quiet,q",        po::bool_switch(&isQuiet), "do not print trailing newline")
    ;

  po::variables_map vm;
  try {
    po::store(po::parse_command_line(argc, argv, description), vm);
    po::notify(vm);
  }
  catch (const std::exception& e) {
    std::cerr << "ERROR: " << e.what() << "\n\n"
              << description << std::endl;
    return 2;
  }

  if (vm.count("help") > 0) {
    std::cout << description << std::endl;
    return 0;
  }

  if (wantDefaultKey && wantDefaultCert) {
    std::cerr << "ERROR: cannot specify both '--default-key' and '--default-cert'" << std::endl;
    return 2;
  }

  if (vm.count("identity") && vm.count("key")) {
    std::cerr << "ERROR: cannot specify both '--identity' and '--key'" << std::endl;
    return 2;
  }

  security::v2::KeyChain keyChain;

  if (vm.count("key") > 0) {
    if (wantDefaultCert) {
      auto cert = keyChain.getPib()
                  .getIdentity(security::v2::extractIdentityFromKeyName(keyName))
                  .getKey(keyName)
                  .getDefaultCertificate();
      std::cout << cert.getName();
      if (!isQuiet) {
        std::cout << std::endl;
      }
      return 0;
    }
    return 2;
  }
  else if (vm.count("identity") > 0) {
    auto key = keyChain.getPib()
               .getIdentity(identityName)
               .getDefaultKey();
    if (wantDefaultKey) {
      std::cout << key.getName();
      if (!isQuiet)
        std::cout << std::endl;
      return 0;
    }
    if (wantDefaultCert) {
      std::cout << key.getDefaultCertificate().getName();
      if (!isQuiet)
        std::cout << std::endl;
      return 0;
    }
    return 2;
  }
  else {
    auto identity = keyChain.getPib()
                    .getDefaultIdentity();
    if (wantDefaultKey) {
      std::cout << identity.getDefaultKey().getName();
    }
    else if (wantDefaultCert) {
      std::cout << identity.getDefaultKey().getDefaultCertificate().getName();
    }
    else {
      std::cout << identity.getName();
    }
    if (!isQuiet)
      std::cout << std::endl;
    return 0;
  }
//.........这里部分代码省略.........
开发者ID:named-data,项目名称:ndn-cxx,代码行数:101,代码来源:get-default.cpp


示例10: main

int main(int argc, char** argv)
{
    try
    {
        namespace po = boost::program_options;
        po::options_description description("=== intersects ===\nAllowed options");

        int width_x = 7;
        int count = 1;
        int count_x = 10;
        int count_y = 10;
        bool ccw = false;
        bool open = false;
        p_q_settings settings;

        description.add_options()
            ("help", "Help message")
            ("count", po::value<int>(&count)->default_value(1), "Number of tests")
            ("count_x", po::value<int>(&count_x)->default_value(10), "Triangle count in x-direction")
            ("count_y", po::value<int>(&count_y)->default_value(10), "Triangle count in y-direction")
            ("width_x", po::value<int>(&width_x)->default_value(7), "Width of triangle in x-direction")
            ("ccw", po::value<bool>(&ccw)->default_value(false), "Counter clockwise polygons")
            ("open", po::value<bool>(&open)->default_value(false), "Open polygons")
            ("wkt", po::value<bool>(&settings.wkt)->default_value(false), "Create a WKT of the inputs, for all tests")
            ("svg", po::value<bool>(&settings.svg)->default_value(false), "Create a SVG for all tests")
        ;

        po::variables_map varmap;
        po::store(po::parse_command_line(argc, argv, description), varmap);
        po::notify(varmap);

        if (varmap.count("help"))
        {
            std::cout << description << std::endl;
            return 1;
        }

        if (ccw && open)
        {
            test_all<double, false, false>(count, count_x, count_y, width_x, settings);
        }
        else if (ccw)
        {
            test_all<double, false, true>(count, count_x, count_y, width_x, settings);
        }
        else if (open)
        {
            test_all<double, true, false>(count, count_x, count_y, width_x, settings);
        }
        else
        {
            test_all<double, true, true>(count, count_x, count_y, width_x, settings);
        }

#if defined(HAVE_TTMATH)
        // test_all<ttmath_big, true, true>(seed, count, max, svg, level);
#endif
    }
    catch(std::exception const& e)
    {
        std::cout << "Exception " << e.what() << std::endl;
    }
    catch(...)
    {
        std::cout << "Other exception" << std::endl;
    }

    return 0;
}
开发者ID:bstrong,项目名称:boost-mirror,代码行数:69,代码来源:intersects.cpp


示例11: description

void Kopete::Transfer::emitCopying(const KUrl &src, const KUrl &dest)
{
    emit description(this, i18n("Copying"),
                     qMakePair(i18n("Source"), src.prettyUrl()),
                     qMakePair(i18n("Destination"), dest.prettyUrl()));
}
开发者ID:Jtalk,项目名称:kopete-fork-xep0136,代码行数:6,代码来源:kopetetransfermanager.cpp


示例12: mes

  bool FastSearchFormat::WriteChemObject(OBConversion* pConv)
  {
    //Prepares or updates an index file. Called for each molecule indexed
    bool update = pConv->IsOption("u")!=NULL;

    static ostream* pOs;
    static bool NewOstreamUsed;
    if(fsi==NULL)
      {
        //First pass sets up FastSearchIndexer object
        pOs = pConv->GetOutStream();// with named index it is already open
        NewOstreamUsed=false;
        string mes("prepare an");
        if(update)
          mes = "update the";
        clog << "This will " << mes << " index of " << pConv->GetInFilename()
             <<  " and may take some time..." << flush;

        if(!pConv->IsLastFile())
        {
          obErrorLog.ThrowError(__FUNCTION__,
            "There should not be multiple input files. A .fs file is an index of a single datafile.",
            obError);
          return false;
        }

        std::string auditMsg = "OpenBabel::Write fastsearch index ";
        std::string description(Description());
        auditMsg += description.substr( 0, description.find('\n') );
        obErrorLog.ThrowError(__FUNCTION__,auditMsg,obAuditMsg);

        FptIndex* pidx=NULL; //used with update

        //if(pOs==&cout) did not work with GUI
        if(!dynamic_cast<ofstream*>(pOs))
          {
            //No index filename specified
            //Derive index name from datafile name
            string indexname=pConv->GetInFilename();
            string::size_type pos=indexname.find_last_of('.');
            if(pos!=string::npos)
              indexname.erase(pos);
            indexname += ".fs";

            bool idxok=true;
            if(update)
              {
                LastSeekpos = 0;

                //Read in existing index
                idxok=false;
                ifstream ifs(indexname.c_str(),ifstream::binary);
                if(ifs.good())
                  {
                    pidx = new FptIndex;
                    idxok = pidx->Read(&ifs);
                  }
              }//ifs closed here

            pOs = new ofstream(indexname.c_str(),ofstream::binary);

            if(!pOs->good() || !idxok)
              {
                stringstream errorMsg;
                errorMsg << "Trouble opening or reading " << indexname << endl;
                obErrorLog.ThrowError(__FUNCTION__, errorMsg.str(), obError);
                static_cast<ofstream *>(pOs)->close(); // close the file before quitting
                delete pOs;
                delete pidx; // remove possible memory leak
                return false;
              }
            NewOstreamUsed=true;
          }
        else // not cout
          {
            if(update)
              {
                obErrorLog.ThrowError(__FUNCTION__,
                  "Currently, updating is only done on index files that"
                  "have the same name as the datafile.\n"
                  "Do not specify an output file; use the form:\n"
	                "   babel datafile.xxx -ofs -xu", obError);
                return false;
              }
          }

        int nbits = 0;
        const char* p = pConv->IsOption("N");
        if(p)
          nbits = atoi(p);

        string fpid; //fingerprint type
        p=pConv->IsOption("f");
        if(p)
          fpid=p;

        //Prepare name without path
        string datafilename = pConv->GetInFilename();
        if(datafilename.empty())
          {
//.........这里部分代码省略.........
开发者ID:Acpharis,项目名称:openbabel,代码行数:101,代码来源:fastsearchformat.cpp


示例13: description

  bool FastSearchFormat::ReadChemObject(OBConversion* pConv)
  {
    //Searches index file for structural matches
    //This function is called only once per search

    std::string auditMsg = "OpenBabel::Read fastsearch index ";
    std::string description(Description());
    auditMsg += description.substr(0,description.find('\n'));
    obErrorLog.ThrowError(__FUNCTION__,
                          auditMsg,
                          obAuditMsg);

    //Derive index name
    string indexname = pConv->GetInFilename();
    string::size_type pos=indexname.find_last_of('.');
    if(pos!=string::npos)
      {
        indexname.erase(pos);
        indexname += ".fs";
      }

    //Have to open input stream again because needs to be in binary mode
    ifstream ifs;
    stringstream errorMsg;
    if(!indexname.empty())
      ifs.open(indexname.c_str(),ios::binary);
    if(!ifs)
      {
        errorMsg << "Couldn't open " << indexname << endl;
        obErrorLog.ThrowError(__FUNCTION__, errorMsg.str(), obError);
        return false;
      }

    string datafilename = fs.ReadIndex(&ifs);
    if(datafilename.empty())
      {
        errorMsg << "Difficulty reading from index " << indexname << endl;
        obErrorLog.ThrowError(__FUNCTION__, errorMsg.str(), obError);
        return false;
      }

    vector<OBMol> patternMols;
    if(!ObtainTarget(pConv, patternMols, indexname))
      return false;

    bool exactmatch = pConv->IsOption("e",OBConversion::INOPTIONS)!=NULL;// -ae option

    //Open the datafile and put it in pConv
    //datafile name derived from index file probably won't have a file path
    //but indexname may. Derive a full datafile name
    string path;
    pos = indexname.find_last_of("/\\");
    if(pos==string::npos)
      path = datafilename;
    else
      path = indexname.substr(0,pos+1) + datafilename;

    ifstream datastream(path.c_str());
    if(!datastream)
      {
        errorMsg << "Difficulty opening " << path << endl;
        obErrorLog.ThrowError(__FUNCTION__, errorMsg.str(), obError);
        return false;
      }
    pConv->SetInStream(&datastream);

    //Input format is currently fs; set it appropriately
    if(!pConv->SetInAndOutFormats(pConv->FormatFromExt(datafilename.c_str()),pConv->GetOutFormat()))
      return false;

    // If target has dative bonds like -[N+](=O)[O-] convert it to the uncharged form
    // (-N(=O)=O and add uncharged form to vector of mols which are sent to
    // the -s (SMARTS)filter.
    // Also check whether the target has dative bonds in the uncharged form and supply
    // the charged form to the -s filter.
    // Together with the automatic conversion to the uncharged form when the fs index is made,
    // this ensures that both forms are found however they occur in the datafile or the taget.
    vector<OBBase*> extraSMARTSMols;
    vector<OBMol>extraUnchargedMols;
    for(unsigned i=0;i<patternMols.size();++i)
    {
      if(patternMols[i].ConvertDativeBonds())
        extraSMARTSMols.push_back(&patternMols[i]);
      else 
      {
        // If target has uncharged dative bonds, still use it for fastsearching,
        // but add the charged form for -s filter.
        extraUnchargedMols.push_back(patternMols[i]);
        if(extraUnchargedMols.back().MakeDativeBonds())
          extraSMARTSMols.push_back(&extraUnchargedMols.back());
      }
    }
    OBOp* sFilter = OBOp::FindType("s");
    if(sFilter)
      sFilter->ProcessVec(extraSMARTSMols);

    //Now do searching
    const char* p = pConv->IsOption("t",OBConversion::INOPTIONS);
    if(p)
      {
//.........这里部分代码省略.........
开发者ID:Acpharis,项目名称:openbabel,代码行数:101,代码来源:fastsearchformat.cpp


示例14: editor_name

	const t_string& editor_name() const { return editor_name_.empty() ? description() : editor_name_; }
开发者ID:ArtBears,项目名称:wesnoth,代码行数:1,代码来源:terrain.hpp


示例15: main

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

	int resultCode = EXIT_SUCCESS;

	std::string dataset;
	std::string input;
	std::string output;
	bool smallClusters;
	unsigned int activeClusters;

	boost::program_options::options_description description( "Allowed options" );
	description.add_options()
		( "help,h", "display this help" )
		( "file,f", boost::program_options::value< std::string >( &dataset ), "dataset file (SVM-Light format)" )
		( "input,i", boost::program_options::value< std::string >( &input ), "input model file" )
		( "output,o", boost::program_options::value< std::string >( &output ), "output text file" )
		( "small_clusters,s", boost::program_options::value< bool >( &smallClusters )->default_value( false ), "use size-16 instead of size-256 clusters?" )
		( "active_clusters,a", boost::program_options::value< unsigned int >( &activeClusters )->default_value( 64 ), "number of \"active\" clusters" )
	;

	try {

		boost::program_options::variables_map variables;
		boost::program_options::store( boost::program_options::command_line_parser( argc, argv ).options( description ).run(), variables );
		boost::program_options::notify( variables );

		if ( variables.count( "help" ) ) {

			std::cout <<
				"Classifies a dataset (in SVM-Light format). For binary classifiers, the result" << std::endl <<
				"is saved to a text file containing one floating-point number per line: the" << std::endl <<
				"value of the classification function applied the corresponding testing vector" << std::endl <<
				"(the signs of these numbers are the classifications). For multiclass" << std::endl <<
				"classifiers, each line of the output file contains a comma-separated list of" << std::endl <<
				"values of the classification functions of the classes, applied to the" << std::endl <<
				"corresponding testing vector (the index of the largest of these is the" << std::endl <<
				"classification)." << std::endl <<
				std::endl <<
				"This implementation handles sparsity using a greedy clustering approach. The" << std::endl <<
				"small_clusters parameter indicates the size of the clusters: 16 (small) or 256" << std::endl <<
				"(not small). Generally, size-256 clusters will give significantly better" << std::endl <<
				"performance. The active_clusters parameter is the number of clusters which will" << std::endl <<
				"be active at every point in the greedy clustering algorithm. We have found that" << std::endl <<
				"64 works well, but increasing this number will improve the quality of the" << std::endl <<
				"clustering (at the cost of more time being required to find it)." << std::endl <<
				std::endl <<
				description << std::endl;
		}
		else {

			if ( ! variables.count( "file" ) )
				throw std::runtime_error( "You must provide a dataset file" );
			if ( ! variables.count( "input" ) )
				throw std::runtime_error( "You must provide an input file" );
			if ( ! variables.count( "output" ) )
				throw std::runtime_error( "You must provide an output file" );

			// load the dataset file
			unsigned int rows    = 0;
			unsigned int columns = 0;
			std::vector< float  > values;
			std::vector< size_t > indices;
			std::vector< size_t > offsets;
			{	unsigned int const bufferSize = ( 1u << 24 );
				boost::shared_array< char > buffer( new char[ bufferSize ] );

				const boost::regex spaceRegex( "[[:space:]]+" );
				const boost::regex elementRegex( "^[[:space:]]*([[:digit:]]+):(-?[[:digit:]]+(\\.[[:digit:]]+)?([eE]-?[[:digit:]]+)?)[[:space:]]*$" );

				offsets.push_back( 0 );

				std::ifstream file( dataset.c_str() );
				if ( file.fail() )
					throw std::runtime_error( "Unable to open dataset file" );
				while ( ! file.eof() ) {

					file.getline( buffer.get(), bufferSize );
					if ( file.fail() )
						break;
					std::string lineString( buffer.get() );

					boost::sregex_token_iterator ii(
						lineString.begin(),
						lineString.end(),
						spaceRegex,
						-1
					);
					boost::sregex_token_iterator iiEnd;

					if ( ii != iiEnd ) {    // ignore blank lines

						std::string const signString = ii->str();
						if ( ii == iiEnd )
							throw std::runtime_error( "Failed to parse first element of dataset line" );
						// we don't care about the value of the label, since we're classifying

						int lastIndex = -1;
						for ( ++ii; ii != iiEnd; ++ii ) {

							std::string const elementString = ii->str();
//.........这里部分代码省略.........
开发者ID:niitsuma,项目名称:gtsvm,代码行数:101,代码来源:gtsvm_classify.cpp


示例16: get_name

//+----------------------------------------------------------------------------
//
// method : 		SimulatorCCDClass::write_class_property
// 
// description : 	Set class description as property in database
//
//-----------------------------------------------------------------------------
void SimulatorCCDClass::write_class_property()
{
	//	First time, check if database used
	//--------------------------------------------
	if (Tango::Util::_UseDb == false)
		return;

	Tango::DbData	data;
	string	classname = get_name();
	 

鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ descriptor函数代码示例发布时间:2022-05-30
下一篇:
C++ descend函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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