本文整理汇总了C++中PathList::push_back方法的典型用法代码示例。如果您正苦于以下问题:C++ PathList::push_back方法的具体用法?C++ PathList::push_back怎么用?C++ PathList::push_back使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PathList
的用法示例。
在下文中一共展示了PathList::push_back方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: children
PathList Path::children() const
{
PathList children;
#if WENDY_SYSTEM_WIN32
WIN32_FIND_DATA data;
HANDLE search;
search = FindFirstFile(m_string.c_str(), &data);
if (search == INVALID_HANDLE_VALUE)
return PathList();
do
{
children.push_back(operator + (data.cFileName));
}
while (FindNextFile(search, &data));
FindClose(search);
#else
DIR* stream;
dirent* entry;
stream = opendir(m_string.c_str());
if (!stream)
return PathList();
while ((entry = readdir(stream)))
children.push_back(operator + (entry->d_name));
closedir(stream);
#endif
return children;
}
示例2: getChildren
bool Path::getChildren(PathList& children) const
{
#if WENDY_SYSTEM_WIN32
WIN32_FIND_DATA data;
HANDLE search;
search = FindFirstFile(path.c_str(), &data);
if (search == INVALID_HANDLE_VALUE)
return false;
do
{
children.push_back(operator + (data.cFileName));
}
while (FindNextFile(search, &data));
FindClose(search);
#else
DIR* stream;
dirent* entry;
stream = opendir(path.c_str());
if (!stream)
return false;
while ((entry = readdir(stream)))
children.push_back(operator + (entry->d_name));
closedir(stream);
#endif
return true;
}
示例3: findLinearIntersections
/* public */
void
SharedPathsOp::getSharedPaths(PathList& forwDir, PathList& backDir)
{
PathList paths;
findLinearIntersections(paths);
for (size_t i=0, n=paths.size(); i<n; ++i)
{
LineString* path = paths[i];
if ( isSameDirection(*path) ) forwDir.push_back(path);
else backDir.push_back(path);
}
}
示例4: full
/* private */
void
SharedPathsOp::findLinearIntersections(PathList& to)
{
using geos::operation::overlay::OverlayOp;
// TODO: optionally use the tolerance,
// snapping _g2 over _g1 ?
std::auto_ptr<Geometry> full ( OverlayOp::overlayOp(
&_g1, &_g2, OverlayOp::opINTERSECTION) );
// NOTE: intersection of equal lines yelds splitted lines,
// should we sew them back ?
for (size_t i=0, n=full->getNumGeometries(); i<n; ++i)
{
const Geometry* sub = full->getGeometryN(i);
const LineString* path = dynamic_cast<const LineString*>(sub);
if ( path ) {
// NOTE: we're making a copy here, wouldn't be needed
// for a simple predicate
to.push_back(_gf.createLineString(*path).release());
}
}
}
示例5: BFS
void GapFiller::BFS(const CondensedDeBruijnGraph& graph, const size_t from, const size_t to, int gap, size_t max_depth, size_t max_queue, PathList& pathlist) {
size_t step = 0;
Path path = boost::assign::list_of(from);
typedef std::pair< Path, int > Choice;
std::deque< Choice > Q = boost::assign::list_of(std::make_pair(
path, 0 - (_K - 1)
));
while (!Q.empty()) {
++step;
if (step > max_depth) {
LOG4CXX_DEBUG(logger, boost::format("BFS step is bigger than %d...") % max_depth);
break;
}
if (Q.size() > max_queue) {
LOG4CXX_DEBUG(logger, boost::format("BFS Q size=%d is greater than %d...") % Q.size() % max_queue);
break;
}
std::deque< Choice > nextQ;
while (!Q.empty()) {
Choice choice = Q.front();
Q.pop_front();
size_t node = choice.first.back();
if (node == to) {
pathlist.push_back(choice.first);
}
if (choice.second > gap - (_K - 1)) {
continue;
}
const CondensedDeBruijnGraph::CondensedEdge& edge = graph._indexer[node];
std::string suffix = edge.seq.substr(edge.seq.length() - (_K - 1), _K - 1);
CondensedDeBruijnGraph::NodeList::const_iterator i = graph._parents.find(suffix);
if (i != graph._parents.end()) {
for (CondensedDeBruijnGraph::EdgeList::const_iterator j = i->second.begin(); j != i->second.end(); ++j) {
//size_t length = graph._indexer[j->second].seq.length();
size_t length = graph._indexer[j->second].seq.length() - (_K - 1);
Choice new_choice(choice);
new_choice.first.push_back(j->second);
new_choice.second += length;
nextQ.push_back(new_choice);
}
}
}
Q = nextQ;
}
}
示例6: add_to_vector
// helps fill in the path matrix (see below)
void add_to_vector (PathList& previous_vector, wstring* to_add) {
wstring string_rep = represent_path (to_add, 2);
if (previous_vector.size() == 0) {
previous_vector.push_back (string_rep);
}
else {
PathList::iterator it;
// if there is more than one possible path, add to all of them
for (it=previous_vector.begin(); it != previous_vector.end(); it++) {
it->append (string_rep);
}
}
}
示例7: init
void init()
{
char* paths = getenv("INCLUDE");
if(paths && *paths != 0)
{
char* part = strtok(paths, ":");
while(part)
{
string s = part;
if(*(s.end()-1) != '/') s.push_back('/');
includePaths.push_back(s);
part = strtok(0, ":");
}
}
}
示例8: offset
void
BuildingGrowth::Init()
{
if (_tess) {
return;
}
const Plane* ground = _sketch->GroundPlane();
glm::vec2 offset(0, 0);
const float width = 8;
const float depth = 4;
CoplanarPath* rect =
_sketch->AddRectangle(width, depth, ground->Eqn, offset);
float height = 4;
PathList walls;
_sketch->PushPath(rect, height, &walls);
_sketch->PushPath(rect, -1, &walls);
CoplanarPath* roof = rect;
CoplanarPath* wall;
wall = dynamic_cast<CoplanarPath*>(walls[1]);
rect = _sketch->AddInscribedRectangle(1, 1.5, wall, vec2(0, 0));
_sketch->PushPath(rect, -0.5);
wall = dynamic_cast<CoplanarPath*>(walls[2]);
sketch::PathList cylinders;
for (float y = -3.25; y < 3.26; y += 1.0) {
CoplanarPath* circle = _sketch->AddInscribedPolygon(0.3, wall, vec2(0, y), 48);
cylinders.push_back(circle);
}
_sketch->PushPaths(cylinders, 3);
PathList inners;
FOR_EACH(circle, cylinders) {
CoplanarPath* outer = dynamic_cast<CoplanarPath*>(*circle);
CoplanarPath* inner = _sketch->AddInscribedPolygon(0.15, outer, vec2(0, 0), 8);
inners.push_back(inner);
}
示例9: SearchDirectory
PathList PathName::SearchDirectory(void) const {
PathList opl;
if (!this->IsDirectory())
return opl;
#if defined(WIN32)
#error This needs to be implemented
#else
DIR *dir;
struct dirent *dirp;
if ((dir = opendir(this->GetNativePathName().c_str())) != NULL) {
while ((dirp = readdir(dir)) != NULL) {
opl.push_back(PathName(dirp->d_name));
}
closedir(dir);
}
#endif
return opl;
}
示例10: EnumCallback
void EnumCallback(void* pUser, const char* path)
{
PathList* pList = (PathList*)pUser;
pList->push_back(path);
}
示例11: edit_distance
// calculates the edit distance between two words and tracks the differences
int edit_distance (Word first, Word second, PathList& paths) {
int first_length = first.size() + 1;
int second_length = second.size() + 1;
Word::iterator it1 = first.begin();
Word::iterator it2 = second.begin();
int distance_matrix [first_length][second_length];
PathList path_matrix [first_length][second_length];
wstring charstring[2];
bool match;
distance_matrix[0][0] = 0;
PathList newvector;
newvector.push_back(L"");
path_matrix[0][0] = newvector;
// fill in the top and left edges of the matrix (i.e. one string is empty)
for (int i=1; i != first_length; i++) {
path_matrix[i][0] = path_matrix[i-1][0];
distance_matrix[i][0] = i;
charstring[0] = *(it1++);
charstring[1] = NULL_CHAR;
add_to_vector (path_matrix[i][0], charstring);
}
for (int j=1; j != second_length; j++) {
path_matrix[0][j] = path_matrix[0][j-1];
distance_matrix[0][j] = j;
charstring[0] = NULL_CHAR;
charstring[1] = *(it2++);
add_to_vector (path_matrix[0][j], charstring);
}
it1 = first.begin();
for (int i=1; i != first_length; i++) {
it2 = second.begin();
for (int j=1; j != second_length; j++) {
int deletion = distance_matrix[i-1][j] + 1;
int insertion = distance_matrix[i][j-1] + 1;
int substitution = distance_matrix[i-1][j-1];
match = true;
if (*it1 != *it2) {
substitution++;
match = false;
}
int minimum_distance = min(deletion, min(insertion, substitution));
distance_matrix[i][j] = minimum_distance;
PathList* currcell = &path_matrix[i][j];
PathList::iterator it;
// add the changes to the current cell of the path matrix here
if (minimum_distance == deletion) {
PathList delcell = path_matrix[i-1][j];
charstring[0] = *it1;
charstring[1] = NULL_CHAR;
add_to_vector (delcell, charstring);
for (it=delcell.begin(); it != delcell.end(); it++)
currcell->push_back (*it);
}
if (minimum_distance == insertion) {
PathList inscell = path_matrix[i][j-1];
charstring[0] = NULL_CHAR;
charstring[1] = *it2;
add_to_vector (inscell, charstring);
for (it=inscell.begin(); it != inscell.end(); it++)
currcell->push_back (*it);
}
if (minimum_distance == substitution) {
PathList subcell = path_matrix[i-1][j-1];
// if the letters are identical, no need to track that
if (!match) {
charstring[0] = *it1;
charstring[1] = *it2;
add_to_vector (subcell, charstring);
}
for (it=subcell.begin(); it != subcell.end(); it++)
currcell->push_back (*it);
}
it2++;
}
it1++;
}
paths = path_matrix[first_length-1][second_length-1];
return distance_matrix[first_length-1][second_length-1];
}