本文整理汇总了C++中boost::iequals方法的典型用法代码示例。如果您正苦于以下问题:C++ boost::iequals方法的具体用法?C++ boost::iequals怎么用?C++ boost::iequals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类boost
的用法示例。
在下文中一共展示了boost::iequals方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: lookup_argument
vector<string> lookup_argument(const string& argument) {
using boost::iequals;
vector<string> args;
if (iequals(argument, "int")) {
args.push_back("int");
} else if (iequals(argument, "ints")) {
args.push_back("int");
args.push_back("std::vector<int>");
args.push_back("Eigen::Matrix<int, Eigen::Dynamic, 1>");
args.push_back("Eigen::Matrix<int, 1, Eigen::Dynamic>");
} else if (iequals(argument, "double")) {
args.push_back("double");
args.push_back("var");
} else if (iequals(argument, "doubles")) {
args.push_back("double");
args.push_back("std::vector<double>");
args.push_back("Eigen::Matrix<double, Eigen::Dynamic, 1>");
args.push_back("Eigen::Matrix<double, 1, Eigen::Dynamic>");
args.push_back("var");
args.push_back("std::vector<var>");
args.push_back("Eigen::Matrix<var, Eigen::Dynamic, 1>");
args.push_back("Eigen::Matrix<var, 1, Eigen::Dynamic>");
}
return args;
}
示例2: Handle
void Gatekeeper::Handle()
{
std::stringstream r(message_);
std::string s;
r >> s;
if( iequals( s, "GIV" ) )
{
std::getline(r, s);
const std::size_t pos = s.find(':');
std::string hex = s.substr(pos + 1, 2 * 16);
GUID guid;
assert(hex.size() == 32);
Conv::Hex::Decode(hex.begin(), hex.end(), guid.begin());
std::vector< DownloadPtr > v;
System::GetDownloadMgr()->Dump(std::back_inserter(v));
for(uint i = 0; i < v.size(); ++i)
if(v[i]->HandleGIV(this, guid))
break;
return;
}
else if(iequals(s, "GET"))
{
if(message_.find("\r\n\r\n") == std::string::npos)
throw MessageIncomplete();
System::GetUploadMgr()->Accept(this);
}
else
throw std::runtime_error("Unhandled");
}
示例3:
bool
FortranProgramDeclarationsAndDefinitions::checkModuleExists (
std::string const & moduleName)
{
using boost::iequals;
using std::string;
using std::map;
using std::vector;
bool found = false;
for (map <string, vector <string> >::const_iterator it =
fileNameToModuleNames.begin (); it != fileNameToModuleNames.end (); ++it)
{
string fileName = it->first;
vector <string> moduleNames = it->second;
for (vector <string>::const_iterator vectorIt = moduleNames.begin (); vectorIt
!= moduleNames.end (); ++vectorIt)
{
if (iequals (*vectorIt, moduleName))
{
found = true;
}
}
}
return found;
}
示例4: buildDoubleType
SgType *
FortranProgramDeclarationsAndDefinitions::getTypeFromString (std::string const & opDataBaseTypeString,
std::string const & variableName)
{
using namespace SageBuilder;
using boost::iequals;
if ( iequals(opDataBaseTypeString, OP2::FortranSpecific::PrimitiveTypes::real8) )
return buildDoubleType ();
else if ( iequals(opDataBaseTypeString, OP2::FortranSpecific::PrimitiveTypes::real4) )
return buildFloatType ();
else if ( iequals(opDataBaseTypeString, OP2::FortranSpecific::PrimitiveTypes::integer4) )
return buildIntType ();
else
throw Exceptions::ParallelLoop::UnsupportedBaseTypeException ("Bad type specified for GENERIC OP_DAT '"
+ variableName + "' ");
}
示例5: TranslateRequest
void UploaderImp::TranslateRequest()
{
std::istream s( &request_ );
std::string line;
s >> line; //method
if( line == "GET" ) method_ = GET;
else if( line == "HEAD" ) method_ = HEAD;
else throw Unhandled(400, "Unknown method" );
s >> line; //object
if( !starts_with( line, "/uri-res/N2R?" ) )
throw Unhandled(400, "Requested uri type is not supported");
std::string last = urn_;
urn_ = line.substr(line.find('?') + 1);
fileInfo_ = System::GetShareMgr()->GetByUrn( urn_ );
if(last != urn_)
{
System::LogBas() << "Host " << endpoint_ << " requested file: " << fileInfo_.Name() << std::endl;
fileInfo_.IncreaseRequests();
}
while( std::getline( s, line ) && line != "\r" )
{
std::string value = boost::trim_copy( line.substr( line.find( ':' ) + 1 ) );
if( istarts_with( line, "Connection:" ) )
keepAlive_ = iequals( value, "keep-alive" );
else if( istarts_with( line, "X-Nick:" ) )
nick_ = value;
else if(istarts_with(line, "User-Agent:") && client_ != value)
{
client_ = value;
if(System::GetSecurity()->AgentRestricted(client_))
throw Unhandled(403, "Client software is restricted");
}
else if( istarts_with( line, "Range:" ) )
{
file_offset_t first = 0;
file_offset_t last = 0;
int result = sscanf( value.c_str(), "bytes=%llu-%llu", &first, &last );
if( result == 0 ) throw Unhandled(416, "Couldn't parse range");
if( result == 1 ) range_.SetBoundary( first, fileInfo_.Size() - 1);
if( result == 2 ) range_.SetBoundary( first, last );
}
}
if( range_.Empty() ) throw std::range_error( "Range is empty" );
// std::cout << range_.Last() << " " << fileInfo.Size() << std::endl;
if( range_.Last() >= fileInfo_.Size() )
throw Unhandled(416, "Range is too large" );
}
示例6: aabbReader
LASPointReader::LASPointReader(string path){
this->path = path;
if(fs::is_directory(path)){
// if directory is specified, find all las and laz files inside directory
for(fs::directory_iterator it(path); it != fs::directory_iterator(); it++){
fs::path filepath = it->path();
if(fs::is_regular_file(filepath)){
if(iequals(fs::extension(filepath), ".las") || iequals(fs::extension(filepath), ".laz")){
files.push_back(filepath.string());
}
}
}
}else{
files.push_back(path);
}
// read bounding box
for(int i = 0; i < files.size(); i++){
string file = files[i];
LIBLASReader aabbReader(file);
AABB lAABB = aabbReader.getAABB();
aabb.update(lAABB.min);
aabb.update(lAABB.max);
aabbReader.close();
}
// open first file
currentFile = files.begin();
reader = new LIBLASReader(*currentFile);
// cout << "let's go..." << endl;
}
示例7: visit
virtual void
visit (SgNode * node)
{
using boost::iequals;
using boost::filesystem::path;
using boost::filesystem::system_complete;
SgSourceFile * file = isSgSourceFile (node);
if (file != NULL)
{
path p = system_complete (path (file->getFileName ()));
if (generator->isDirty (p.filename ()))
{
Debug::getInstance ()->debugMessage ("Unparsing '"
+ p.filename () + "'", Debug::FUNCTION_LEVEL, __FILE__,
__LINE__);
outputFiles.push_back ("rose_" + p.filename ());
file->unparse ();
}
else if (iequals (p.filename (), generator->getFileName ()))
{
Debug::getInstance ()->debugMessage ("Unparsing generated file '"
+ p.filename () + "'", Debug::FUNCTION_LEVEL, __FILE__,
__LINE__);
outputFiles.push_back (p.filename ());
generatedFile = p.filename ();
file->unparse ();
}
else
{
Debug::getInstance ()->debugMessage ("File '" + p.filename ()
+ "' remains unchanged", Debug::FUNCTION_LEVEL, __FILE__,
__LINE__);
outputFiles.push_back ("rose_" + p.filename ());
file->unparse ();
}
}
}
示例8: if
void
FortranCUDAUserSubroutine::createStatements ()
{
using namespace SageInterface;
using boost::iequals;
using std::string;
using std::vector;
class TreeVisitor: public AstSimpleProcessing
{
private:
/*
* ======================================================
* The recursive visit of a user subroutine populates
* this vector with successive function calls which are
* then appended after the visit
* ======================================================
*/
vector < SgProcedureHeaderStatement * > calledRoutines;
public:
vector < SgProcedureHeaderStatement * > getCalledRoutinesInStatement()
{
return calledRoutines;
}
TreeVisitor ()
{
}
virtual void
visit (SgNode * node)
{
SgExprStatement * isExprStatement = isSgExprStatement ( node );
if ( isExprStatement != NULL )
{
SgFunctionCallExp * functionCallExp = isSgFunctionCallExp ( isExprStatement->get_expression() );
if ( functionCallExp != NULL )
{
string const
calleeName =
functionCallExp->getAssociatedFunctionSymbol ()->get_name ().getString ();
Debug::getInstance ()->debugMessage ("Found function call in user subroutine "
+ calleeName + "'", Debug::OUTER_LOOP_LEVEL, __FILE__, __LINE__);
/*
* ======================================================
* As we are in fortran, all user subroutines must be
* SgProcedureHeaderStatements = subroutines and not
* functions. This might be extended to cover also
* functions in the future (?). Probably not in OP2
* ======================================================
*/
SgProcedureHeaderStatement * isProcedureHeaderStatement = isSgProcedureHeaderStatement (
functionCallExp->getAssociatedFunctionDeclaration() );
calledRoutines.push_back ( isProcedureHeaderStatement );
}
}
}
};
Debug::getInstance ()->debugMessage ("User subroutine: outputting and modifying statements",
Debug::FUNCTION_LEVEL, __FILE__, __LINE__);
SgFunctionParameterList * originalParameters =
originalSubroutine->get_parameterList ();
vector <SgStatement *> originalStatements =
originalSubroutine->get_definition ()->get_body ()->get_statements ();
for (vector <SgStatement *>::iterator it = originalStatements.begin (); it
!= originalStatements.end (); ++it)
{
SgExprStatement * isExprStatement = isSgExprStatement ( *it );
if ( isExprStatement != NULL )
{
SgFunctionCallExp * functionCallExp = isSgFunctionCallExp ( isExprStatement->get_expression() );
if ( functionCallExp != NULL )
{
string const
calleeName =
functionCallExp->getAssociatedFunctionSymbol ()->get_name ().getString ();
Debug::getInstance ()->debugMessage ("Found function call in user subroutine "
+ calleeName + "'", Debug::OUTER_LOOP_LEVEL, __FILE__, __LINE__);
/*
* ======================================================
* As we are in fortran, all user subroutines must be
* SgProcedureHeaderStatements = subroutines and not
* functions. This might be extended to cover also
* functions in the future (probably not in OP2)
* ======================================================
*/
//.........这里部分代码省略.........
示例9: appendAdditionalSubroutines
/*
* ======================================================
* This function appends all additional subroutines
* called inside the user subroutine. It is specialised
* for CUDA in the related subclass
* ======================================================
*/
void FortranCUDAUserSubroutine::appendAdditionalSubroutines ( SgScopeStatement * moduleScope,
FortranParallelLoop * parallelLoop, FortranProgramDeclarationsAndDefinitions * declarations,
FortranConstantDeclarations * CUDAconstants, std::vector < SgProcedureHeaderStatement * > * allCalledRoutines)
{
using std::vector;
using boost::iequals;
/*
* ======================================================
* First removes duplicates in calledRoutines itself
* ======================================================
*/
sort ( calledRoutines.begin(), calledRoutines.end() );
calledRoutines.erase ( unique ( calledRoutines.begin(), calledRoutines.end() ), calledRoutines.end() );
Debug::getInstance ()->debugMessage ("Before removing, the list of routine calls found in the user kernels is: ",
Debug::FUNCTION_LEVEL, __FILE__, __LINE__);
vector < SgProcedureHeaderStatement * > :: iterator routinesIt2;
for ( routinesIt2 = calledRoutines.begin (); routinesIt2 != calledRoutines.end (); routinesIt2++ )
{
string appendingSubroutine = (*routinesIt2)->get_name ().getString ();
Debug::getInstance ()->debugMessage (appendingSubroutine,
Debug::FUNCTION_LEVEL, __FILE__, __LINE__);
}
/*
* ======================================================
* The removes routines already appended by other user
* kernels, using the list in allCalledRoutines
* ======================================================
*/
Debug::getInstance ()->debugMessage ("Removing global duplicates, the number of routines in the list is: '"
+ boost::lexical_cast<string> ((int) calledRoutines.size()) + "'", Debug::FUNCTION_LEVEL, __FILE__, __LINE__);
vector < SgProcedureHeaderStatement * > :: iterator routinesIt;
for ( routinesIt = calledRoutines.begin (); routinesIt != calledRoutines.end (); ) //routinesIt++ )
{
string appendingSubroutine = (*routinesIt)->get_name ().getString ();
Debug::getInstance ()->debugMessage ("Checking routine for deletion: '"
+ appendingSubroutine + "'", Debug::FUNCTION_LEVEL, __FILE__, __LINE__);
bool foundAndErased = false;
vector < SgProcedureHeaderStatement * > :: iterator finder;
for ( finder = allCalledRoutines->begin (); finder != allCalledRoutines->end (); finder++ )
{
Debug::getInstance ()->debugMessage ("Checking against: '"
+ (*finder)->get_name ().getString () + "'", Debug::FUNCTION_LEVEL, __FILE__, __LINE__);
if ( iequals ((*finder)->get_name ().getString (), appendingSubroutine) )
{
/*
* ======================================================
* Routine already appended by another user kernel:
* delete it from list of routines to be appended for
* this user kernel, and exit this loop
* ======================================================
*/
Debug::getInstance ()->debugMessage ("Deleting: '"
+ appendingSubroutine + "'", Debug::FUNCTION_LEVEL, __FILE__, __LINE__);
calledRoutines.erase (routinesIt++);
if ( calledRoutines.empty () ) return;
foundAndErased = true;
routinesIt--;
break;
}
}
if ( foundAndErased == false )
{
/*
* ======================================================
* New routine: it must be added to the list of
* routines called by all previous user kernels because
* recursively called routines need to discard those
* already appended by this routine
* ======================================================
*/
Debug::getInstance ()->debugMessage ("Not found, appending: '"
+ appendingSubroutine + "'", Debug::FUNCTION_LEVEL, __FILE__, __LINE__);
allCalledRoutines->push_back ( *routinesIt );
routinesIt++;
}
}
vector < SgProcedureHeaderStatement * > :: iterator it;
for ( it = calledRoutines.begin(); it != calledRoutines.end(); it++ )
//.........这里部分代码省略.........
示例10: if
void
FortranProgramDeclarationsAndDefinitions::visit (SgNode * node)
{
using boost::filesystem::path;
using boost::filesystem::system_complete;
using boost::iequals;
using boost::starts_with;
using boost::lexical_cast;
using std::string;
if (isSgSourceFile (node))
{
path p = system_complete (path (isSgSourceFile (node)->getFileName ()));
currentSourceFile = p.filename ();
Debug::getInstance ()->debugMessage ("Source file '" + currentSourceFile
+ "' detected", Debug::OUTER_LOOP_LEVEL, __FILE__, __LINE__ );
}
else if (Globals::getInstance ()->isInputFile (currentSourceFile))
{
/*
* ======================================================
* Only process this portion of the AST if we recognise
* this source file as one passed on the command line. In
* Fortran, .rmod files are sometimes generated whose
* traversal should be avoided
* ======================================================
*/
switch (node->variantT ())
{
case V_SgModuleStatement:
{
SgModuleStatement * moduleStatement = isSgModuleStatement (node);
currentModuleName = moduleStatement->get_name ().getString ();
fileNameToModuleNames[currentSourceFile].push_back (currentModuleName);
moduleNameToFileName[currentModuleName] = currentSourceFile;
Debug::getInstance ()->debugMessage ("Module '" + currentModuleName
+ "' in file '" + currentSourceFile + "'", Debug::OUTER_LOOP_LEVEL,
__FILE__, __LINE__ );
break;
}
case V_SgProcedureHeaderStatement:
{
/*
* ======================================================
* We need to store all subroutine definitions since we
* later have to copy and modify the user kernel subroutine
* ======================================================
*/
SgProcedureHeaderStatement * procedureHeaderStatement =
isSgProcedureHeaderStatement (node);
string const subroutineName =
procedureHeaderStatement->get_name ().getString ();
subroutinesInSourceCode[subroutineName] = procedureHeaderStatement;
ROSE_ASSERT (currentModuleName.size() > 0);
moduleNameToSubroutines[currentModuleName].push_back (subroutineName);
subroutineToFileName[subroutineName] = currentSourceFile;
Debug::getInstance ()->debugMessage (
"Found procedure header statement '"
+ procedureHeaderStatement->get_name ().getString ()
+ "' in file '" + currentSourceFile + "', and module '"
+ currentModuleName + "'", Debug::FUNCTION_LEVEL, __FILE__,
__LINE__);
break;
}
case V_SgFunctionCallExp:
{
/*
* ======================================================
* Function call found in the AST. Get its actual arguments
* and the callee name
* ======================================================
*/
SgFunctionCallExp * functionCallExp = isSgFunctionCallExp (node);
SgExprListExp * actualArguments = functionCallExp->get_args ();
string const
calleeName =
functionCallExp->getAssociatedFunctionSymbol ()->get_name ().getString ();
Debug::getInstance ()->debugMessage ("Found function call '"
+ calleeName + "'", Debug::OUTER_LOOP_LEVEL, __FILE__, __LINE__);
//.........这里部分代码省略.........
示例11: executeRandomWalkSimulator
//! Execute random walk simulator application mode.
void executeRandomWalkSimulator(
const std::string databasePath,
const tudat::input_output::parsed_data_vector_utilities::ParsedDataVectorPtr parsedData )
{
///////////////////////////////////////////////////////////////////////////
// Declare using-statements.
using std::advance;
using std::cerr;
using std::cout;
using std::endl;
using std::max_element;
using std::min_element;
using std::numeric_limits;
using std::ofstream;
using std::ostringstream;
using std::setprecision;
using std::string;
using boost::iequals;
using namespace boost::filesystem;
using boost::make_shared;
using namespace assist::astrodynamics;
using namespace assist::basics;
using namespace assist::mathematics;
using namespace tudat::basic_astrodynamics::orbital_element_conversions;
using namespace tudat::basic_mathematics::mathematical_constants;
using namespace tudat::input_output;
using namespace tudat::input_output::dictionary;
using namespace tudat::statistics;
using namespace stomi::astrodynamics;
using namespace stomi::database;
using namespace stomi::input_output;
///////////////////////////////////////////////////////////////////////////
// Extract input parameters.
// Get dictionary.
const DictionaryPointer dictionary = getRandomWalkSimulatorDictionary( );
// Print database path to console.
cout << "Database "
<< databasePath << endl;
// Extract required parameters.
const string randomWalkRunName = extractParameterValue< string >(
parsedData->begin( ), parsedData->end( ),
findEntry( dictionary, "RANDOMWALKRUN" ) );
cout << "Random walk run "
<< randomWalkRunName << endl;
// Extract optional parameters.
const int numberOfThreads = extractParameterValue< int >(
parsedData->begin( ), parsedData->end( ),
findEntry( dictionary, "NUMBEROFTHREADS" ), 1 );
cout << "Number of threads "
<< numberOfThreads << endl;
const string outputMode = extractParameterValue< string >(
parsedData->begin( ), parsedData->end( ),
findEntry( dictionary, "OUTPUTMODE" ), "DATABASE" );
cout << "Output mode "
<< outputMode << endl;
const string fileOutputDirectory = extractParameterValue< string >(
parsedData->begin( ), parsedData->end( ),
findEntry( dictionary, "FILEOUTPUTDIRECTORY" ), "" ) + "/";
cout << "File output directory "
<< fileOutputDirectory << endl;
const string randomWalkSimulations = extractParameterValue< string >(
parsedData->begin( ), parsedData->end( ),
findEntry( dictionary, "RANDOMWALKSIMULATIONS" ), "ALL" );
cout << "Random walk simulations "
<< randomWalkSimulations << endl;
const string randomWalkRunTableName = extractParameterValue< string >(
parsedData->begin( ), parsedData->end( ),
findEntry( dictionary, "RANDOMWALKRUNTABLENAME" ), "random_walk_run" );
cout << "Random walk run table "
<< randomWalkRunTableName << endl;
const string randomWalkInputTableName = extractParameterValue< string >(
parsedData->begin( ), parsedData->end( ),
findEntry( dictionary, "RANDOMWALKINPUTTABLENAME" ), "random_walk_input" );
cout << "Random walk input table "
<< randomWalkInputTableName << endl;
const string randomWalkPerturberTableName = extractParameterValue< string >(
parsedData->begin( ), parsedData->end( ),
findEntry( dictionary, "RANDOMWALKPERTURBERTABLENAME" ),
"random_walk_perturbers" );
cout << "Random walk perturber table "
<< randomWalkPerturberTableName << endl;
//.........这里部分代码省略.........