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


C++ Errors类代码示例

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


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

示例1: FileOpenErrExptn

PlugBoard::PlugBoard( char *pbFileName )
{
  
  /* Error and format check file */
  Errors checkPlugBoard; 
  checkPlugBoard.noRepContFile( pbFileName, 'p' );



  /* Open plugboard file. Loop through the file, counting
   * the total number of values in the file */
  ifstream pbfile;
  pbfile.open( pbFileName );
  int contact;
  mapLength = 0;                          // set @mapLength to zero
  if( pbfile.fail() ){                    // Throw error if cannot open 
    throw FileOpenErrExptn( ERROR_OPENING_CONFIGURATION_FILE, pbFileName );
  }

  while( !pbfile.eof() ){                 // Loop through file counting values
    if( !pbfile.eof() ){
      pbfile >> contact;
      mapLength++;
    }
  }
开发者ID:izaak-coleman,项目名称:Enigma,代码行数:25,代码来源:PlugBoard.cpp

示例2: FileOpenErrExptn

Reflector::Reflector( char *rfFileName )
{

  /* Error and format check file */
  Errors checkReflector; 
  checkReflector.noRepContFile( rfFileName, 'f' );



  /* Open given reflector file. */
  ifstream reflectorFile;
  reflectorFile.open( rfFileName );
  if( reflectorFile.fail() ){             // Throw error if cannot open
    throw FileOpenErrExptn( ERROR_OPENING_CONFIGURATION_FILE, rfFileName );
  }



  /* Initialize elements of reflectorMap, by convering the 
   * int values from given file into uppercase characters
   * and assign these characters to elements in @reflectorMap.
   * Each column contains a 'wired' pair of characters. */
  int contactOne;             // first value in 'wired' pair from file
  int contactTwo;             // second value in 'wired'  pair from file
  int pair = 0;
  while( !reflectorFile.eof() ){
    reflectorFile >> contactOne;
    reflectorFile >> contactTwo;
    if( !reflectorFile.eof() ){
      reflectorMap[pair][0] = (contactOne+65);  // +65 for u.case convert
      reflectorMap[pair][1] = (contactTwo+65);
      pair++;
    }
  }
}
开发者ID:izaak-coleman,项目名称:Enigma,代码行数:35,代码来源:Reflector.cpp

示例3: convertToJacobianFactorPtr

 /* ************************************************************************* */
 Errors GaussianFactorGraph::operator*(const VectorValues& x) const {
   Errors e;
   BOOST_FOREACH(const GaussianFactor::shared_ptr& Ai_G, *this) {
     JacobianFactor::shared_ptr Ai = convertToJacobianFactorPtr(Ai_G);
     e.push_back((*Ai) * x);
   }
   return e;
 }
开发者ID:DForger,项目名称:gtsam,代码行数:9,代码来源:GaussianFactorGraph.cpp

示例4: size

/* ************************************************************************* */
Errors Errors::operator-(const Errors& b) const {
#ifndef NDEBUG
  size_t m = size();
  if (b.size()!=m)
    throw(std::invalid_argument("Errors::operator-: incompatible sizes"));
#endif
  Errors result;
  Errors::const_iterator it = b.begin();
  BOOST_FOREACH(const Vector& ai, *this)
    result.push_back(ai - *(it++));
  return result;
}
开发者ID:DForger,项目名称:gtsam,代码行数:13,代码来源:Errors.cpp

示例5: dot

/* ************************************************************************* */
double dot(const Errors& a, const Errors& b) {
#ifndef NDEBUG
  size_t m = a.size();
  if (b.size()!=m)
    throw(std::invalid_argument("Errors::dot: incompatible sizes"));
#endif
  double result = 0.0;
  Errors::const_iterator it = b.begin();
  BOOST_FOREACH(const Vector& ai, a)
    result += gtsam::dot(ai, *(it++));
  return result;
}
开发者ID:DForger,项目名称:gtsam,代码行数:13,代码来源:Errors.cpp

示例6: if

bool SickS300::getData(LaserScannerData& data, Errors& error) {
    // Bouml preserved body begin 000211E7
    if (!this->open(error)) {
        return false;
    }
    try {

        if (newDataFlagOne == true) {
            {
                boost::mutex::scoped_lock dataMutex1(mutexData1);
                data.setMeasurements(distanceBufferOne, angleBufferOne, si::meter, radian); //TODO dictance in centimeter
            }
            newDataFlagOne = false;

        } else if (newDataFlagTwo == true) {
            {
                boost::mutex::scoped_lock dataMutex2(mutexData2);
                data.setMeasurements(distanceBufferTwo, angleBufferTwo, meter, radian); //TODO dictance in centimeter
            }
            newDataFlagTwo = false;
        } else {
            //   error.addError("unable_to_get_data", "could not get data from the Sick S300");
            return false;
        }

        //  LOG(trace) << "receiving range scan from Sick S300";
    } catch (...) {
        error.addError("unable_to_get_data", "could not get data from the Sick S300");
        return false;
    }

    return true;
    // Bouml preserved body end 000211E7
}
开发者ID:janpaulus,项目名称:BRICS_OODL,代码行数:34,代码来源:SickS300.cpp

示例7: if

Scanner::Scanner(kstring name, Syntax &stx, Positions &pos, Errors &err)
// ----------------------------------------------------------------------------
//   Open the file and make sure it's readable
// ----------------------------------------------------------------------------
    : syntax(stx),
      input(*new utf8_ifstream(name)),
      tokenText(""),
      textValue(""), realValue(0.0), intValue(0), base(10),
      indents(), indent(0), indentChar(0),
      position(0), lineStart(0),
      positions(pos), errors(err),
      caseSensitive(Options::options ? Options::options->case_sensitive : true),
      checkingIndent(false), settingIndent(false),
      hadSpaceBefore(false), hadSpaceAfter(false),
      mustDeleteInput(true)
{
    indents.push_back(0);       // We start with an indent of 0
    position = positions.OpenFile(name);
    if (input.fail())
        err.Log(Error("File $1 cannot be read: $2", position).
                Arg(name).Arg(strerror(errno)));

    // Skip UTF-8 BOM if present
    if (input.get() != 0xEF)
        input.unget();
    else if (input.get() != 0xBB)
        input.unget(), input.unget();
    else if(input.get() != 0xBF)
        input.unget(), input.unget(), input.unget();
}
开发者ID:c3d,项目名称:elfe,代码行数:30,代码来源:scanner.cpp

示例8: main

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

  (Logger::getInstance()).init();

  HokuyoURGConfiguration config;
  config.devicePath = "/dev/ttyACM0"; // Device path of the Sick LMS 2xx
  config.baud = BAUD_115200;
  config.scanAngleStart = 0 *radian;
  config.scanAngleStop = 1.5 *radian;

  HokuyoURG scanner;

  Errors errors;

  if (!scanner.setConfiguration(config, errors)) {
    errors.printErrorsToConsole();
    return -1;
  }


  
  LaserScannerTools tools;

 // tools.plot_laserscanner_values(scanner, errors);

  /*
   * Uninitialize the device
   */
  try {
    scanner.close(errors);
  } catch (...) {
    cerr << "Uninitialize failed!" << endl;
    return -1;
  }

  /* Success! */
  return 0;

}
开发者ID:janpaulus,项目名称:BRICS_OODL,代码行数:39,代码来源:plot_laserscanner_values.cpp

示例9: LOG

bool SickS300::getConfiguration(LaserScannerConfiguration& configuration, Errors& error) {
    // Bouml preserved body begin 000210E7
    if (!this->open(error)) {
        return false;
    }
    try {
        configuration.vendor = "SICK";
        configuration.product = "S300";

        configuration.scanAngleStart = -135.0 / 180.0 * M_PI * radian;
        configuration.scanAngleStop = 135.0 / 180.0 * M_PI * radian;
        configuration.scanResolution = ((-configuration.scanAngleStart) + configuration.scanAngleStop) / (double) numberOfScanPoints;


        LOG(trace) << "read Sick LMS configuration";

    } catch (...) {
        error.addError("unable_to_read_configuration", "could not get the configuration from the Sick S300");
        return false;
    }

    return true;
    // Bouml preserved body end 000210E7
}
开发者ID:janpaulus,项目名称:BRICS_OODL,代码行数:24,代码来源:SickS300.cpp

示例10: syntax

Scanner::Scanner(std::istream &input,
                 Syntax &stx, Positions &pos, Errors &err,
                 kstring fileName)
// ----------------------------------------------------------------------------
//   Open the file and make sure it's readable
// ----------------------------------------------------------------------------
    : syntax(stx),
      input(input),
      tokenText(""),
      textValue(""), realValue(0.0), intValue(0), base(10),
      indents(), indent(0), indentChar(0),
      position(0), lineStart(0),
      positions(pos), errors(err),
      caseSensitive(Options::options ? Options::options->case_sensitive : true),
      checkingIndent(false), settingIndent(false),
      hadSpaceBefore(false), hadSpaceAfter(false),
      mustDeleteInput(false)
{
    indents.push_back(0);       // We start with an indent of 0
    position = positions.OpenFile(fileName);
    if (input.fail())
        err.Log(Error("Input stream cannot be read: $1", position)
                .Arg(strerror(errno)));
}
开发者ID:c3d,项目名称:elfe,代码行数:24,代码来源:scanner.cpp

示例11: switch

bool SickS300::open(Errors& error) {
    // Bouml preserved body begin 00021367
    if (this->isConnected) {
        return true;
    }

    if (this->config->devicePath == "") {
        error.addError("no_DevicePath", "the device path is not specified in the configuration");
        this->isConnected = false;
        return false;
    }

    {
        boost::mutex::scoped_lock lock_it(mutexSickS300);

        if (sickS300 != NULL) {
            error.addError("still_Connected", "a previous connection was not closed correctly please close it again.");
            this->isConnected = false;
            return false;
        }

        this->sickS300 = new ScannerSickS300();

    }

    unsigned int desired_baud = 500000;

    switch (this->config->baud) {
    case BAUD_9600:
        desired_baud = 9600;
        LOG(trace) << "using 9600 baut to comunicate to Sick S300";
        break;
    case BAUD_19200:
        desired_baud = 19200;
        LOG(trace) << "using 19200 baut to comunicate to Sick S300";
        break;
    case BAUD_38400:
        desired_baud = 38400;
        LOG(trace) << "using 38400 baut to comunicate to Sick S300";
        break;
    case BAUD_500K:
        desired_baud = 500000;
        LOG(trace) << "using 500000 baut to comunicate to Sick S300";
        break;
    case BAUD_UNKNOWN:
        desired_baud = 0;
        break;
    }

    //Initialize the Sick S300
    try {
        {
            boost::mutex::scoped_lock lock_it(mutexSickS300);
            if (!sickS300->open(this->config->devicePath.c_str(), desired_baud)) {
                throw "could not initilize Sick S300";
            }
            this->isConnected = true;
        }
        LOG(trace) << "connection to Sick S300 initialized";

        stopThread = false;

        threads.create_thread(boost::bind(&SickS300::receiveScan, this));

    } catch (...) {
        error.addError("Initialize_failed", "could not initilize Sick S300");
        {
            boost::mutex::scoped_lock lock_it(mutexSickS300);
            this->isConnected = false;
            delete sickS300;
            sickS300 = NULL;
        }
        return false;
    }
    return true;
    // Bouml preserved body end 00021367
}
开发者ID:janpaulus,项目名称:BRICS_OODL,代码行数:77,代码来源:SickS300.cpp

示例12:

bool SickS300::resetDevice(Errors& error) {
    // Bouml preserved body begin 000212E7
    error.addError("unable_to_reset_sick_s300", "could not reset the Sick S300");
    return false;
    // Bouml preserved body end 000212E7
}
开发者ID:janpaulus,项目名称:BRICS_OODL,代码行数:6,代码来源:SickS300.cpp

示例13: printErrors

void Reporter::printErrors(std::ostream& os, Errors& errors, const int verbose)
{
    StrStream strstream;    
    strstream << "Summary:";
    
    // Parsing (not really errors)
    if (unlikely(errors.commentedLines))
    {
        strstream << "\n [" << errors.commentedLines << "] commented lines";
    }
    if (unlikely(errors.blankLines))
    {
        strstream << "\n [" << errors.blankLines << "] blank lines";
    }
    
    auto nbErrors = errors.nbErrors();
    if (unlikely(nbErrors > 0))
    {
        strstream << "\nFound " << nbErrors << " error:";
        
        // Parsing
        if (unlikely(errors.corruptedMessages))
        {
            strstream << "\n [" << errors.corruptedMessages << "] corrupted messages";
        }
        if (unlikely(errors.IncompleteMessages))
        {
            strstream << "\n [" << errors.IncompleteMessages << "] incomplete messages";
        }
        if (unlikely(errors.wrongActions))
        {
            strstream << "\n [" << errors.wrongActions << "] wrong actions";
        }
        if (unlikely(errors.wrongSides))
        {
            strstream << "\n [" << errors.wrongSides << "] wrong sides";
        }
        if (unlikely(errors.negativeOrderIds))
        {
            strstream << "\n [" << errors.negativeOrderIds << "] negative orderIds";
        }
        if (unlikely(errors.negativeQuantities))
        {
            strstream << "\n [" << errors.negativeQuantities << "] negative quantities";
        }
        if (unlikely(errors.negativePrices))
        {
            strstream << "\n [" << errors.negativePrices << "] negative prices";
        }
        if (unlikely(errors.missingActions))
        {
            strstream << "\n [" << errors.missingActions << "] missing actions";
        }
        if (unlikely(errors.missingOrderIds))
        {
            strstream << "\n [" << errors.missingOrderIds << "] missing orderIds";
        }
        if (unlikely(errors.missingSides))
        {
            strstream << "\n [" << errors.missingSides << "] missing sides";
        }
        if (unlikely(errors.missingQuantities))
        {
            strstream << "\n [" << errors.missingQuantities << "] missing quantities";
        }
        if (unlikely(errors.missingPrices))
        {
            strstream << "\n [" << errors.missingPrices << "] missing prices";
        }
        if (unlikely(errors.zeroOrderIds))
        {
            strstream << "\n [" << errors.zeroOrderIds << "] zero orderIds";
        }
        if (unlikely(errors.zeroQuantities))
        {
            strstream << "\n [" << errors.zeroQuantities << "] zero quantities";
        }
        if (unlikely(errors.zeroPrices))
        {
            strstream << "\n [" << errors.zeroPrices << "] zero prices";
        }
        if (unlikely(errors.outOfBoundsOrderIds))
        {
            strstream << "\n [" << errors.outOfBoundsOrderIds << "] out of bounds orderIds";
        }
        if (unlikely(errors.outOfBoundsQuantities))
        {
            strstream << "\n [" << errors.outOfBoundsQuantities << "] out of bounds quantities";
        }
        if (unlikely(errors.outOfBoundsPrices))
        {
            strstream << "\n [" << errors.outOfBoundsPrices << "] out of bounds prices";
        }
        
        // Order Management
        if (unlikely(errors.duplicateOrderIds))
        {
            strstream << "\n [" << errors.duplicateOrderIds << "] duplicate OrderIds";
        }
        if (unlikely(errors.modifiesWithUnknownOrderId))
//.........这里部分代码省略.........
开发者ID:bgn9000,项目名称:Cpp1y-OrderBook,代码行数:101,代码来源:Reporter.cpp

示例14: equals

bool Errors::equals(const Errors& expected, double tol) const {
  if( size() != expected.size() ) return false;
  return equal(begin(),end(),expected.begin(),equalsVector(tol));
}
开发者ID:DForger,项目名称:gtsam,代码行数:4,代码来源:Errors.cpp

示例15: print

/* ************************************************************************* */
void print(const Errors& a, const string& s) {
  a.print(s);
}
开发者ID:DForger,项目名称:gtsam,代码行数:4,代码来源:Errors.cpp


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