本文整理汇总了C++中IData类的典型用法代码示例。如果您正苦于以下问题:C++ IData类的具体用法?C++ IData怎么用?C++ IData使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了IData类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: visitData
void visitData( const IData& d ) override
{
SpatialIndex::IShape* shape;
d.getShape( &shape );
mNewIndex->insertData( 0, 0, *shape, d.getIdentifier() );
delete shape;
}
示例2: visitData
virtual void visitData(const IData& in)
{
uint64_t id = in.getIdentifier();
const bool doDataDeserialization = true;
if(doDataDeserialization)
{
uint32_t dataLen;
byte* data;
in.getData(dataLen, &data);
MGArchive archive((const char*)data, dataLen);
Way way;
archive << way;
for (size_t i = 0; i < way.tags.size(); i++)
{
if (way.tags[i].key == key)
{
ways.push_back(id);
break;
}
}
delete data;
}
}
示例3: visitData
void VisitadorGP::visitData(const IData& d) {
IShape* pS;
d.getShape(&pS);
// do something.
Region r;
pS->getMBR(r);
// cout << "punto " << contador++ << ": " << r.m_pHigh[0] << " - " << r.m_pHigh[1] << endl;
//cout << r.m_pHigh[0] << " " << r.m_pHigh[1] << endl;
xy_pts_B.push_back(std::make_pair(r.m_pHigh[0], r.m_pHigh[1]));
contador++;
//cout<< "contador " << contador << endl;
delete pS;
// data should be an array of characters representing a Region as a string.
byte* pData = 0;
uint32_t cLen = 0;
d.getData(cLen, &pData);
// do something.
//string s = reinterpret_cast<char*>(pData);
//cout << s << endl;
delete[] pData;
//cout << d.getIdentifier() << endl;
// the ID of this data entry is an answer to the query. I will just print it to stdout.
}
示例4: getEntityTypeKey
/**
* DbManager::addDataNode
*
* Adds the DataNode to the Entity table.
*
* @param parentKey The pkey of the parent.
* @return unsigned int The pkey of the datanode.
*/
unsigned int DbManager::addDataNode( std::string name, unsigned int agentKey )
{
unsigned int dataNodeType = getEntityTypeKey( "DataNode" );
unsigned int dataNodeKey = 0;
IData* id = NULL;
std::vector<std::string> columns;
columns.push_back( "pkey" );
// See if the agent already exists.
id = m_db.executeQuery( "SELECT pkey FROM entity WHERE name = '"+name+"'", columns );
// Add the agent if it doesn't.
if ( id->getNumRows() == 0 )
{
delete id;
id = NULL;
std::ostringstream query;
query << "INSERT INTO entity ";
query << "(pkey,name,address,description,subsystemkey,locationkey,typekey,";
query << "agentkey,parentkey) VALUES (ENTITY_SEQ.NEXTVAL,'";
query << name;
query << "','Test DataNode','Test DataNode',6,1,";
query << dataNodeType;
query << ",";
query << agentKey;
query << ",";
query << agentKey;
query << ")";
m_db.executeModification( query.str() );
// Get the DataNode's pkey.
id = m_db.executeQuery( "SELECT pkey FROM entity WHERE name = '"+name+"'", columns );
dataNodeKey = id->getUnsignedLongData( 0, "pkey" );
delete id;
id = NULL;
}
else
{
// If the DataNode exists, make sure no parameters are set.
dataNodeKey = id->getUnsignedLongData( 0, "pkey" );
delete id;
id = NULL;
// Make sure the DataNode has no parameters.
removeParameters( dataNodeKey );
}
return dataNodeKey;
}
示例5: visitData
void visitData( const IData& d ) override
{
QgsFeatureId id = d.getIdentifier();
QgsGeometry* g = mLocator->mGeoms.value( id );
if ( g->intersects( mGeomPt ) )
mList << QgsPointLocator::Match( QgsPointLocator::Area, mLocator->mLayer, id, 0, QgsPoint() );
}
示例6: StringUintPair
/**
* DbManager::getEntityParameterKey
*
* Determines the pkey for EntityParameter 'name' associated with 'type'.
*
* @param name The name to find.
* @param type The type of the parameter.
*
* @return unsigned int The pkey.
*
*/
unsigned int DbManager::getEntityParameterKey( std::string name, unsigned int type )
{
// Search the type key map for the provided type name.
ParameterMap::iterator it = m_parameterKeys.find( StringUintPair(name,type) );
if ( it != m_parameterKeys.end() )
{
return it->second;
}
// If the key wasn't found retrieve it from the database.
unsigned int pkey = 0;
IData* id = NULL;
std::vector<std::string> columns;
columns.push_back( "pkey" );
std::ostringstream query;
query << "SELECT pkey FROM entityparameter WHERE name = '";
query << name;
query << "' AND typekey = ";
query << type;
id = m_db.executeQuery( query.str(), columns );
if ( id->getNumRows() == 1 )
{
pkey = id->getUnsignedLongData( 0, "pkey" );
delete id;
id = NULL;
}
else
{
delete id;
id = NULL;
std::string message = "Couldnt find unique EntityParameter "+name;
throw DatabaseException( message.c_str(), DatabaseException::REQUEST_FAILED );
}
// Insert the parameter into the map.
m_parameterKeys.insert( std::pair<StringUintPair,unsigned int>( StringUintPair(name,type), pkey ) );
return pkey;
}
示例7: VTrigger
bool Manager::VTrigger ( IData const & inEvent ) const
{
if ( ! VValidateType( inEvent.GetTypeId() ) )
return false;
EventListenerMap::const_iterator itWC = m_registry.find( 0 );
if ( itWC != m_registry.end() )
{
EventListenerTable const & table = itWC->second;
bool processed = false;
for ( EventListenerTable::const_iterator it2 = table.begin(), it2End = table.end();
it2 != it2End;
it2++ )
{
(*it2)->HandleEvent( inEvent );
}
}
EventListenerMap::const_iterator it = m_registry.find( inEvent.GetTypeId().Value() );
if ( it == m_registry.end() )
return false;
EventListenerTable const & table = it->second;
bool processed = false;
for ( EventListenerTable::const_iterator it2 = table.begin(), it2End = table.end();
it2 != it2End;
it2++ )
{
ListenerPtr listener = *it2;
if ( listener->HandleEvent( inEvent ) )
{
processed = true;
}
}
return processed;
}
示例8: addTestAgent
/**
* DbManager::addTestAgent
*
* Adds the test agent to the Entity table.
*
* @return unsigned int The pkey of the test agent.
*/
unsigned int DbManager::addTestAgent( unsigned int scadaRootType )
{
unsigned int agentKey = 0;
// Get the SCADAROOT type.
IData* id = NULL;
std::vector<std::string> columns;
columns.push_back( "pkey" );
// See if the agent already exists.
id = m_db.executeQuery( "SELECT pkey FROM entity WHERE name = '"+AgentName+"'", columns );
// Add the agent if it doesn't.
if ( id->getNumRows() == 0 )
{
delete id;
id = NULL;
std::ostringstream query;
query << "INSERT INTO entity ";
query << "(pkey,name,address,description,subsystemkey,locationkey,typekey,";
query << "agentkey,parentkey) VALUES (ENTITY_SEQ.NEXTVAL,'";
query << AgentName;
query << "','VIRTUAL','Test Agent',6,1,";
query << scadaRootType;
query << ",ENTITY_SEQ.NEXTVAL,0)";
m_db.executeModification( query.str() );
// Get the pkey of the agent.
id = m_db.executeQuery( "SELECT pkey FROM entity WHERE name = '"+AgentName+"'", columns );
}
agentKey = id->getUnsignedLongData( 0, "pkey" );
delete id;
id = NULL;
return agentKey;
}
示例9: addSafetyOutputInfo
/**
* DbManager::addSafetyOutputInfo
*
* Adds the correct information to the SafetyOutputDataPoint.
*
* @param entityKey The entity key to add the information to.
*/
void DbManager::addSafetyOutputInfo( unsigned int safetyKey, unsigned int output0Key, unsigned int output1Key )
{
unsigned int state0Key = 0;
unsigned int state1Key = 0;
IData* id = NULL;
std::vector<std::string> columns;
columns.push_back( "scdsta_id" );
std::ostringstream query;
// Add the states.
query.str("");
query << "INSERT INTO sc_derived_state ( scdsta_id,derived_dp_pkey,state_value,";
query << "state_description,alarm_enabled,alarm_delay,alarm_message,";
query << "alarm_severity ) VALUES ( SCADA_SEQ.NEXTVAL,";
query << safetyKey;
query << ",0,'State 0',0,0,'State 0 Alarm',0 )";
m_db.executeModification( query.str() );
query.str("");
query << "INSERT INTO sc_derived_state ( scdsta_id,derived_dp_pkey,state_value,";
query << "state_description,alarm_enabled,alarm_delay,alarm_message,";
query << "alarm_severity ) VALUES ( SCADA_SEQ.NEXTVAL,";
query << safetyKey;
query << ",1,'State 1',0,0,'State 1 Alarm',0 )";
m_db.executeModification( query.str() );
// Get the keys.
query.str("");
query << "SELECT scdsta_id FROM sc_derived_state WHERE derived_dp_pkey = ";
query << safetyKey;
query << " ORDER BY scdsta_id";
id = m_db.executeQuery( query.str(), columns );
if ( id->getNumRows() != 2 )
{
delete id;
id = NULL;
throw DatabaseException( "Couldn't find both safety output states!", DatabaseException::REQUEST_FAILED );
}
state0Key = id->getUnsignedLongData( 0, "scdsta_id" );
state1Key = id->getUnsignedLongData( 1, "scdsta_id" );
delete id;
id = NULL;
// Add the output associations.
query.str("");
query << "INSERT INTO sc_derived_output_association ( scdoas_id,scdsta_id,";
query << "output_dp_pkey,output_value ) VALUES ( SCADA_SEQ.NEXTVAL,";
query << state0Key;
query << ",";
query << output0Key;
query << ",1 )";
m_db.executeModification( query.str() );
query.str("");
query << "INSERT INTO sc_derived_output_association ( scdoas_id,scdsta_id,";
query << "output_dp_pkey,output_value ) VALUES ( SCADA_SEQ.NEXTVAL,";
query << state0Key;
query << ",";
query << output1Key;
query << ",0 )";
m_db.executeModification( query.str() );
query.str("");
query << "INSERT INTO sc_derived_output_association ( scdoas_id,scdsta_id,";
query << "output_dp_pkey,output_value ) VALUES ( SCADA_SEQ.NEXTVAL,";
query << state1Key;
query << ",";
query << output0Key;
query << ",0 )";
m_db.executeModification( query.str() );
query.str("");
query << "INSERT INTO sc_derived_output_association ( scdoas_id,scdsta_id,";
query << "output_dp_pkey,output_value ) VALUES ( SCADA_SEQ.NEXTVAL,";
query << state1Key;
query << ",";
query << output1Key;
query << ",1 )";
m_db.executeModification( query.str() );
}
示例10: visitData
void visitData(const IData& d)
{
hits.push_back(d.getIdentifier());
//std::cout << d.getIdentifier()<< std::endl;
}