Overview     Modules     Class Hierarchy     Classes     Members  
tlp::CSVToGraphNodeIdMapping Class Reference

Try to map CSV file rows to nodes according to value between a CSV column and a graph property. More...

#include <CSVGraphImport.h>

Inheritance diagram for tlp::CSVToGraphNodeIdMapping:
Collaboration diagram for tlp::CSVToGraphNodeIdMapping:

Public Member Functions

 CSVToGraphNodeIdMapping (tlp::Graph *graph, unsigned int columnIndex, const std::string &propertyName, bool createNode=false)
void init (unsigned int rowNumber)
- Public Member Functions inherited from tlp::AbstractCSVToGraphDataMapping
 AbstractCSVToGraphDataMapping (tlp::Graph *graph, tlp::ElementType type, unsigned int columnIndex, const std::string &propertyName)
virtual ~AbstractCSVToGraphDataMapping ()
std::pair< tlp::ElementType,
unsigned int > 
getElementForRow (const std::vector< std::string > &tokens)
- Public Member Functions inherited from tlp::CSVToGraphDataMapping
virtual ~CSVToGraphDataMapping ()

Protected Member Functions

unsigned int buildIndexForRow (unsigned int row, const std::string &indexKey, tlp::Graph *graph, tlp::PropertyInterface *keyProperty)
 Create a new element if no elements for the given row was found.

Additional Inherited Members

- Protected Attributes inherited from tlp::AbstractCSVToGraphDataMapping
TLP_HASH_MAP< std::string,
unsigned int > 
valueToId
tlp::Graph * graph
tlp::ElementType type
unsigned int columnIndex
tlp::PropertyInterface * keyProperty

Detailed Description

Try to map CSV file rows to nodes according to value between a CSV column and a graph property.

Be sure there is a property with the given name in the graph before using it.

Constructor & Destructor Documentation

tlp::CSVToGraphNodeIdMapping::CSVToGraphNodeIdMapping ( tlp::Graph *  graph,
unsigned int  columnIndex,
const std::string &  propertyName,
bool  createNode = false 
)
Parameters
graphThe graph where the nodes will be searched.
columnIndexThe index of the column with the ids in the CSV file.
propertyNameThe name of the property to search ids.
firstRowThe first row to search ids.
lastRowThe last row to search ids.
createNodeIf set to true if there is no node for an id in the CSV file a new node will be created for this id.

Member Function Documentation

unsigned int tlp::CSVToGraphNodeIdMapping::buildIndexForRow ( unsigned int  row,
const std::string &  indexKey,
tlp::Graph *  graph,
tlp::PropertyInterface *  keyProperty 
)
protectedvirtual

Create a new element if no elements for the given row was found.

Returns
Return the graph element id or UINT_MAX if no new element is created.

Implements tlp::AbstractCSVToGraphDataMapping.

void tlp::CSVToGraphNodeIdMapping::init ( unsigned int  rowNumber)
virtual


Tulip Software by LaBRI Visualization Team    2001 - 2012