本文整理汇总了C++中MapInfo类的典型用法代码示例。如果您正苦于以下问题:C++ MapInfo类的具体用法?C++ MapInfo怎么用?C++ MapInfo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MapInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TEST_F
TEST_F(MapInfoCreateMemoryTest, process_memory) {
MapInfo info;
info.start = 0x2000;
info.end = 0x3000;
info.offset = 0;
// Verify that the the process_memory object is used, so seed it
// with memory.
std::vector<uint8_t> buffer(1024);
for (size_t i = 0; i < buffer.size(); i++) {
buffer[i] = i % 256;
}
memory_->SetMemory(info.start, buffer.data(), buffer.size());
std::unique_ptr<Memory> memory(info.CreateMemory(process_memory_));
ASSERT_TRUE(memory.get() != nullptr);
memset(buffer.data(), 0, buffer.size());
ASSERT_TRUE(memory->Read(0, buffer.data(), buffer.size()));
for (size_t i = 0; i < buffer.size(); i++) {
ASSERT_EQ(i % 256, buffer[i]) << "Failed at byte " << i;
}
// Try to read outside of the map size.
ASSERT_FALSE(memory->Read(buffer.size(), buffer.data(), 1));
}
示例2: getEIC
short BaseColumn::codeGen(Generator * generator)
{
// if this column has not been added to the map table or
// it does not have a valid offset, and
// it has an EIC list, then add it to the map table and
// assign attributes from the one of the EIC values.
MapInfo * mapInfo = generator->getMapInfoAsIs(getValueId());
if ((!mapInfo ||
!mapInfo->isOffsetAssigned()) &&
(!getEIC().isEmpty()))
{
MapInfo * index_col_map_info;
short done = 0;
for (ValueId val_id = getEIC().init();
!done && getEIC().next(val_id);
getEIC().advance(val_id))
{
if (index_col_map_info = generator->getMapInfoAsIs(val_id))
{
Attributes * attr =
generator->addMapInfo(getValueId(), 0)->getAttr();
attr->copyLocationAttrs(index_col_map_info->getAttr());
done = -1;
}
}
}
return 0;
}
示例3: protectiveSequenceFunctionTransformation
// A transformation method for protecting sequence functions from not
// being evaluated due to short-circuit evaluation. This is the base
// class implementation which simply recurses on the children unless
// they have already been code-generated.
//
void ItemExpr::protectiveSequenceFunctionTransformation(Generator *generator)
{
for(Int32 i=0; i<getArity(); i++)
{
MapInfo *mapInfo = generator->getMapInfoAsIs(child(i));
if(!mapInfo || !mapInfo->isCodeGenerated())
child(i)->protectiveSequenceFunctionTransformation(generator);
}
}
示例4: codeGen
short Aggregate::codeGen(Generator * generator)
{
Attributes ** attr;
// If this Aggr has already been codeGenned, then bug out early.
//
MapInfo * aggrMapInfo = generator->getMapInfoAsIs(getValueId());
if (aggrMapInfo && aggrMapInfo->isCodeGenerated())
return 0;
if (getOperatorType() != ITM_ONE_ROW)
{
if (generator->getExpGenerator()->genItemExpr(this, &attr, (1+getArity()), -1) == 1)
return 0;
}
ex_clause * clause = 0;
switch (getOperatorType())
{
case ITM_ONE_ROW:
{
Int32 degree = 0;
findnumleaves(this, degree); // degree has number of leaves in the tree
if (generator->getExpGenerator()->genItemExpr(this, &attr, (1+degree),
-1) == 1)
return 0;
clause =
new(generator->getSpace()) ex_aggr_one_row_clause(getOperatorType(),
(short)(1+degree),
attr,
generator->getSpace());
}
break;
case ITM_ANY_TRUE_MAX:
{
clause =
new(generator->getSpace()) ex_aggr_any_true_max_clause(getOperatorType(),
(short)(1+getArity()),
attr, generator->getSpace());
}
break;
default:
break;
}
GenAssert(clause, "Aggregate::codeGen -- missing clause!");
generator->getExpGenerator()->linkClause(this, clause);
return 0;
}
示例5:
void
TerrainEngineNode::onMapInfoEstablished( const MapInfo& mapInfo )
{
// set up the CSN values
mapInfo.getProfile()->getSRS()->populateCoordinateSystemNode( this );
// OSG's CSN likes a NULL ellipsoid to represent projected mode.
if ( !mapInfo.isGeocentric() )
this->setEllipsoidModel( NULL );
}
示例6: generateMarkedEntries
void
generateMarkedEntries(Generator *generator, ValueIdSet &marks)
{
for(ValueId vid = marks.init(); marks.next(vid); marks.advance(vid)) {
MapInfo *mapInfo =
generator->getMapInfoAsIs(vid);
if(mapInfo)
mapInfo->codeGenerated();
}
}
示例7: markGeneratedEntries
void
markGeneratedEntries(Generator *generator, ItemExpr *item, ValueIdSet &marks)
{
if(item) {
MapInfo *mapInfo =
generator->getMapInfoAsIs(item->getValueId());
if(mapInfo && mapInfo->isCodeGenerated())
marks += item->getValueId();
for(Int32 i = 0; i < item->getArity(); i++) {
markGeneratedEntries(generator,item->child(i), marks);
}
}
}
示例8: unGenerate
void
unGenerate(Generator *generator, ItemExpr *item)
{
if(item) {
MapInfo *mapInfo =
generator->getMapInfoAsIs(item->getValueId());
if(mapInfo)
mapInfo->resetCodeGenerated();
for(Int32 i = 0; i < item->getArity(); i++) {
unGenerate(generator,item->child(i));
}
}
}
示例9: while
std::vector<MapInfo> Map::analyzePathsHelper(std::map<std::string, DotPairT*>::iterator map_it, MapInfo curMap, bool &found){
if (found){
std::vector<MapInfo> something;
return something;
}
// Exception control;
//std::cout<<"Analyze for "<<map_it->first<<std::endl;
// Actual work;
PathNodeT* tmp;
std::vector<MapInfo> solutions;
std::vector<MapInfo> tmpSol;
for (std::vector<PathNodeT*>::iterator it = possiblePaths[map_it->first]->begin();
it != possiblePaths[map_it->first]->end();
++it){
tmp = (*it);
bool collide = false;
MapInfo tmpMap = curMap;
while(tmp){
if (tmpMap.find(std::pair<int, int>(tmp->cur.x, tmp->cur.y)) != tmpMap.end()){
collide = true;
break;
}
else{
tmpMap.insert(std::pair<std::pair<int, int>, std::string>(std::pair<int, int>(tmp->cur.x, tmp->cur.y), map_it->first));
tmp = tmp->prev;
}
}
if (!collide){
std::map<std::string, DotPairT*>::iterator tmpIt = map_it;
++tmpIt;
if (tmpIt == DotsMap.end()){
solutions.push_back(tmpMap);
found = true;
return solutions;
}
else{
tmpSol = analyzePathsHelper(tmpIt, tmpMap, found);
solutions.insert(solutions.end(), tmpSol.begin(), tmpSol.end());
if (found)
return solutions;
}
}
}
return solutions;
}
示例10: QGraphicsView
SpriteScene::SpriteScene(QGraphicsView *parent)
: QGraphicsView(parent)
{
this->_scene = new QGraphicsScene(0,0,800,600);
this->setScene(this->_scene);
this->setSceneRect(0,0,795,595);
this->setWindowFlags(Qt::FramelessWindowHint);
QString basefile("base1.png");
MapInfo* mapinfo = new MapInfo(basefile);
QString map1data("ansi1.mdt");
mapinfo->readMap(map1data);
MapManager* manager1 = new MapManager(this->_scene);
manager1->initMap(mapinfo);
//this->_scene->createItemGroup(this->_scene->items())->setPos(100,100);
}
示例11:
static const char *mapAddressToName(const void* pc, const char* def,
void const** start)
{
uint64_t s;
char const* name = sMapInfo.map_to_name(uint64_t(uintptr_t(pc)), def, &s);
if (start) {
*start = (void*)s;
}
return name;
}
示例12:
void
GeometryPool::createKeyForTileKey(const TileKey& tileKey,
unsigned size,
const MapInfo& mapInfo,
GeometryPool::GeometryKey& out) const
{
out.lod = tileKey.getLOD();
out.yMin = mapInfo.isGeocentric()? tileKey.getExtent().yMin() : 0.0;
out.size = size;
}
示例13: codeGen
// ItmPersistentExpressionVar::codeGen
//
// Adds the persistent variable to the expression generator.
//
short ItmPersistentExpressionVar::codeGen(Generator * generator) {
// If the variable has already been codeGenned, bug out...
//
MapInfo * mi = generator->getMapInfoAsIs(getValueId());
if (mi && mi->isCodeGenerated()) return 0;
// Otherwise, generate the code and add it to the map table.
//
generator->getExpGenerator()->addPersistent(getValueId(),
generator->getMapTable());
// Add the initial value to the persistent list in the ExpGenerator.
//
generator->getExpGenerator()->linkPersistent(this);
// ok...
//
return 0;
}
示例14:
ex_expr *
PhysSequence::generateChildProjectExpression(Generator *generator,
MapTable *mapTable,
MapTable *localMapTable,
const ValueIdSet &childProjectIds) const
{
ex_expr * projectExpr = NULL;
if(NOT childProjectIds.isEmpty())
{
// Generate the clauses for the expression
//
generator->getExpGenerator()->generateSetExpr(childProjectIds,
ex_expr::exp_ARITH_EXPR,
&projectExpr);
// Add the projected values to the local map table.
//
ValueId valId;
for(valId = childProjectIds.init();
childProjectIds.next(valId);
childProjectIds.advance(valId))
{
// Get the attribute information from the convert destination.
//
Attributes *newAttr = mapTable->getMapInfo(valId)->getAttr();
// Add the original value to the local map table with the
// attribute information from the convert desination.
//
MapInfo *mapInfo = localMapTable->addMapInfoToThis
(valId.getItemExpr()->child(0)->getValueId(), newAttr);
// Nothing more needs to be done for this item.
//
mapInfo->codeGenerated();
}
}
return projectExpr;
} // PhysSequence::generateChildProjectExpression
示例15: getValueId
short Assign::codeGen(Generator * generator)
{
Attributes ** attr;
// If this Assign has already been codeGenned, then bug out early.
//
MapInfo * assignMapInfo = generator->getMapInfoAsIs(getValueId());
if (assignMapInfo && assignMapInfo->isCodeGenerated())
return 0;
// If the left child (lvalue) is already in the map table, then
// add the Assign value Id to the map table with the same attributes
// as the let child. Mark the Assign node as codeGenned. Also, allocate
// space for the attributes.
//
MapInfo *leftChildMapInfo = generator->getMapInfoAsIs
(child(0)->castToItemExpr()->getValueId());
if (leftChildMapInfo)
{
if (! assignMapInfo)
assignMapInfo =
generator->addMapInfoToThis(generator->getLastMapTable(),
getValueId(),
leftChildMapInfo->getAttr());
assignMapInfo->codeGenerated();
attr = new(generator->wHeap()) Attributes*[2];
// Set the result attribute
//
attr[0] = assignMapInfo->getAttr();
}
// Otherwise, go ahead and generate the Assign attributes (which also
// allocates space for the Assign result). Add the left child to the
// map table with the same attributes as the Assign node.
//
else
{
generator->getExpGenerator()->genItemExpr(this, &attr, 2, 0);
generator->addMapInfoToThis(generator->getLastMapTable(),
child(0)->castToItemExpr()->getValueId(),
attr[0]);
}
attr[0]->resetShowplan();
// Now, generate code for the right child (rvalue).
//
generator->getExpGenerator()->setClauseLinked(FALSE);
child(1)->codeGen(generator);
attr[1] = generator->getAttr(child(1));
generator->getExpGenerator()->setClauseLinked(FALSE);
ex_conv_clause * conv_clause =
new(generator->getSpace()) ex_conv_clause
(getOperatorType(), attr, generator->getSpace());
generator->getExpGenerator()->linkClause(this, conv_clause);
return 0;
}